| 86 | self.to_csv_kwargs = to_csv_kwargs |
| 87 | |
| 88 | def write(self) -> int: |
| 89 | _ = self.to_csv_kwargs.pop("path_or_buf", None) |
| 90 | header = self.to_csv_kwargs.pop("header", True) |
| 91 | index = self.to_csv_kwargs.pop("index", False) |
| 92 | |
| 93 | if isinstance(self.path_or_buf, (str, bytes, os.PathLike)): |
| 94 | with fsspec.open(self.path_or_buf, "wb", **(self.storage_options or {})) as buffer: |
| 95 | written = self._write(file_obj=buffer, header=header, index=index, **self.to_csv_kwargs) |
| 96 | else: |
| 97 | written = self._write(file_obj=self.path_or_buf, header=header, index=index, **self.to_csv_kwargs) |
| 98 | return written |
| 99 | |
| 100 | def _batch_csv(self, args): |
| 101 | offset, header, index, to_csv_kwargs = args |