ColumnDef¶
TabularParser¶
- class TabularParser(columns: list[ColumnDef], storage: str | StorageType = '', delimiter: str | bytes | None = None)[source]¶
Transforms lists of text lines into a dict-of-lists keyed by column name, and provides the inverse format_rows() operation.
Supports both fixed-width positional parsing (
delimiter=None, the default) and delimiter-separated parsing. For delimited lines each token is stripped of whitespace before being passed to the field reader;field.starting_positionis ignored and onlyfield.size(maximum token width) applies.Note: splitting uses
str.split(delimiter)and does not support quoted fields.- format_rows(data: dict[str, list[Any]]) list[str][source]¶
Format a dict-of-lists into text lines — the inverse of parse_lines().
Returns one line per row; each line ends with
\nbecause Line.write() always appends one.