MCPcopy
hub / github.com/scrapy/scrapy / __init__

Method __init__

scrapy/exporters.py:225–247  ·  view source on GitHub ↗
(
        self,
        file: BytesIO,
        include_headers_line: bool = True,
        join_multivalued: str = ",",
        errors: str | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

223
224class CsvItemExporter(BaseItemExporter):
225 def __init__(
226 self,
227 file: BytesIO,
228 include_headers_line: bool = True,
229 join_multivalued: str = ",",
230 errors: str | None = None,
231 **kwargs: Any,
232 ):
233 super().__init__(dont_fail=True, **kwargs)
234 if not self.encoding:
235 self.encoding = "utf-8"
236 self.include_headers_line = include_headers_line
237 self.stream = TextIOWrapper(
238 file,
239 line_buffering=False,
240 write_through=True,
241 encoding=self.encoding,
242 newline="", # Windows needs this https://github.com/scrapy/scrapy/issues/3034
243 errors=errors,
244 )
245 self.csv_writer = csv.writer(self.stream, **self._kwargs)
246 self._headers_not_written = True
247 self._join_multivalued = join_multivalued
248
249 def serialize_field(
250 self, field: Mapping[str, Any] | Field, name: str, value: Any

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected