(self, file: BytesIO, **kwargs: Any)
| 125 | |
| 126 | class JsonItemExporter(BaseItemExporter): |
| 127 | def __init__(self, file: BytesIO, **kwargs: Any): |
| 128 | super().__init__(dont_fail=True, **kwargs) |
| 129 | self.file: BytesIO = file |
| 130 | # there is a small difference between the behaviour or JsonItemExporter.indent |
| 131 | # and ScrapyJSONEncoder.indent. ScrapyJSONEncoder.indent=None is needed to prevent |
| 132 | # the addition of newlines everywhere |
| 133 | json_indent = ( |
| 134 | self.indent if self.indent is not None and self.indent > 0 else None |
| 135 | ) |
| 136 | self._kwargs.setdefault("indent", json_indent) |
| 137 | self._kwargs.setdefault("ensure_ascii", not self.encoding) |
| 138 | self.encoder = ScrapyJSONEncoder(**self._kwargs) |
| 139 | self.first_item = True |
| 140 | |
| 141 | def _beautify_newline(self) -> None: |
| 142 | if self.indent is not None: |
nothing calls this directly
no test coverage detected