Internals¶
These classes are intended to be used by layout implementors.
- class txf.layouts.DictReader(iterable[, fieldnames=None[, **config]])¶
A base record iterator class.
- fieldnames¶
A tuple of the field names in the fixed schema being iterated over. If the field names were not specified in the constructor, then it will read them from the first row. If the row is a dictionary, the field names are extracted and the row itself is buffered. If the row is a tuple, it is presumed to contain the field names. If the row is a single value, that value is the single field name. If the
iterable
is empty, the field names are taken from thedefault_fieldnames
member of theconfig
.
- line_num¶
The current line number.
- next()¶
Reads the next set of values from the input iterator. If the values are a
dict
, the record is updated with the contents of the dictionary. If the values are atuple
, the record is constructed from the values and the ordered field names. Otherwise, the values are returned as the value for every field name. Missing field names are set toNone
.