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)
| 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: |
no test coverage detected