zut.TabDumper
- class zut.TabDumper(dst: str | Path | IOBase | None = None, *, headers: Iterable[Header | Any] | None = None, truncate: bool = None, archivate: bool | str | Path | None = None, title: str | bool | None = None, dst_name: str | bool = True, dir: str | Path = None, delay=False, optional: str | Sequence[str] | Literal['*', True] | None = None, add_columns: bool | Literal['warn'] = False, after1970: bool | None = None, notz: bool | tzinfo | str | None = None, encoding: str | None = None, intfmt: str | None = None, floatfmt: str | None = None, **kwargs)
Bases:
TabularDumper
[str
|Path
|IOBase
]- __init__(dst: str | Path | IOBase | None = None, *, headers: Iterable[Header | Any] | None = None, truncate: bool = None, archivate: bool | str | Path | None = None, title: str | bool | None = None, dst_name: str | bool = True, dir: str | Path = None, delay=False, optional: str | Sequence[str] | Literal['*', True] | None = None, add_columns: bool | Literal['warn'] = False, after1970: bool | None = None, notz: bool | tzinfo | str | None = None, encoding: str | None = None, intfmt: str | None = None, floatfmt: str | None = None, **kwargs)
Methods
__init__
([dst, headers, truncate, ...])append
(row)close
()Called at exit.
export
(row)Called for each exported row.
export_headers
(headers)Called at first exported row, if there are no pre-existing headers.
flush
()is_available
()new_headers
(headers)Called at first exported row, if there are headers that did not exist in pre-existing headers, and for dict rows having additional keys (if additional_headers is True).
open
()Called at first exported row, before headers are analyzed.
Attributes
after1970
foreign_id_keys
foreign_name_keys
truncate
dst
Number of appended rows.
Number of exported rows.
- close()
Called at exit.
- count
Number of appended rows.
- export(row: list)
Called for each exported row. Row has been prepared and is a list, with values already converted if necessary. Rows are already reordered to match order of existing rows (if any), i.e. they match self._combined_headers (if defined).
- export_headers(headers: list[Header])
Called at first exported row, if there are no pre-existing headers.
- exported_count
Number of exported rows.
- new_headers(headers: list[Header]) bool | None
Called at first exported row, if there are headers that did not exist in pre-existing headers, and for dict rows having additional keys (if additional_headers is True).
Return None to prevent adding any new header, False to allow new columns but without a header name, and True to allow updating header names.