karld.record_reader Package¶
karld.record_reader
Package¶
When your data can be divided into logical units, but is each unit takes up varying amounts of multiple lines of a file, use this to consume them in those units. Just provide a function that takes a line and tells if it’s a start line or not.
-
karld.record_reader.__init__.
multi_line_records
(lines, is_line_start=None)[source]¶ Iterate over lines, yielding a sequence for group of lines that end where the next multi-line record begins. The beginning of the record is determined by calling the given is_line_delimiter function, which is called on the every line.
Parameters: - lines – An iterator of unicode lines.
- is_line_start (callable that returns if a line is the beginning of a record.) – determine the beginning line of a record.
Yields: deque of lines.