MCPcopy
hub / github.com/scrapy/scrapy / _configure

Method _configure

scrapy/exporters.py:44–56  ·  view source on GitHub ↗

Configure the exporter by popping options from the ``options`` dict. If dont_fail is set, it won't raise an exception on unexpected options (useful for using with keyword arguments in subclasses ``__init__`` methods)

(self, options: dict[str, Any], dont_fail: bool = False)

Source from the content-addressed store, hash-verified

42 self._configure(kwargs, dont_fail=dont_fail)
43
44 def _configure(self, options: dict[str, Any], dont_fail: bool = False) -> None:
45 """Configure the exporter by popping options from the ``options`` dict.
46 If dont_fail is set, it won't raise an exception on unexpected options
47 (useful for using with keyword arguments in subclasses ``__init__`` methods)
48 """
49 self.encoding: str | None = options.pop("encoding", None)
50 self.fields_to_export: Mapping[str, str] | Iterable[str] | None = options.pop(
51 "fields_to_export", None
52 )
53 self.export_empty_fields: bool = options.pop("export_empty_fields", False)
54 self.indent: int | None = options.pop("indent", None)
55 if not dont_fail and options:
56 raise TypeError(f"Unexpected options: {', '.join(options.keys())}")
57
58 @abstractmethod
59 def export_item(self, item: Any) -> None:

Callers 2

__init__Method · 0.95
_configureMethod · 0.45

Calls 3

keysMethod · 0.80
popMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected