-
Notifications
You must be signed in to change notification settings - Fork 0
vtf textbuffer bufferreader
class bufferreader.Reader(IO) ¶
Independent io object to read from a TextBuffer.
Readerhas, apart from the known reading methods, methods to read lines by a number, a number of rows or specific data ranges. A line is defined as the content between two line breaks + final line break, a row corresponds to one _Row in theTextBuffer.To assign different endings to the rows during reading, a dictionary can be passed via the endings parameter, which contains the different replacements. The keys can be selected from
None(no ending),"\n"(newline) and""(unbroken newline) and the value can be assigned as bytes.To create
Readeras a binary read object, an encoding orTrue(UTF8) can be specified by the parameter bin_mode.Set tabs_to_blanks to a tab size or to
True(same size as inTextBuffer) to convert tab shifts to blanks when reading or replace the tab characters via replace_tabs, the replacement is specified as bytes.Define progress to set an approximate starting point (starts at the beginning of the applicable row) or define the data ranges to be read with dat_ranges as a sorted list
[ [<start>, <stop>], ... ]. Theprogressattribute is NOT updated during reading.buffer: AnyStr
progress: int
Reader__exit__(exc_type, exc_val, exc_tb) -> None ¶
Execute theclosemethod ofReader__init__(__buffer__, *, bin_mode=False, endings=None, tabs_to_blanks=False, replace_tabs=None, progress=0, dat_ranges=None) ¶
__iter__() -> Iterator[str] ¶
row iterator__next__() -> str ¶
next rowclose() -> None ¶
Delete the internal buffer attributes ofReaderand thus free memory (subsequent read processes will raiseAttributeError).@propertyclosed() -> bool ¶Whether the reader buffer is deleted.@propertyencoding() -> str ¶@propertyeof() -> bool ¶Whether the end of the data has been reached.fileno() -> int ¶
passflush() -> None ¶
passisatty() -> bool ¶
False@propertymode() -> str ¶"r"|"rb"@propertyname() -> str ¶""read(__lim=None) -> AnyStr ¶
Read all data in
TextBufferor until a character limit is reached.
raises:
- EOFError: End of data reached.
readable() -> bool ¶
Truereaditeration(__lim=None) -> AnyStr ¶
Read the next iteration (the next data range if configured, otherwise the next row) completely or until a character limit is reached.
raises:
- EOFError: End of data reached.
readiterations(__n, __hint=None) -> list[AnyStr] ¶
Read a number of iterations (data ranges if configured, otherwise the rows) or until the iterations read include the character hint.
raises:
- EOFError: End of data reached.
readline(__lim=None) -> AnyStr ¶
Read until the next real line break or at most until the character limit is reached.
raises:
- EOFError: End of data reached.
readlines(__hint=None) -> list[AnyStr] ¶
Read all lines in the
TextBufferor until the lines read include the character hint and keep"\n".
raises:
- EOFError: End of data reached.
readnlines(__n, __hint=None) -> list[AnyStr] ¶
Read a number of lines or until the lines read include the character hint and keep
"\n".
raises:
- EOFError: End of data reached.
readrow(__lim=None) -> AnyStr ¶
Read the next row into the reader buffer if it is empty and return the entire buffer or up to the character limit (corresponds to the remaining characters or an entire row).
raises:
- EOFError: End of data reached.
readrows(__n, __hint=None) -> list[AnyStr] ¶
Read a number of rows or until the rows read include the character hint.
raises:
- EOFError: End of data reached.
seek(__offset, __whence=...) -> int ¶
Raises NotImplementedError.seekable() -> bool ¶
Falsetell() -> int ¶
progresstruncate(__size=...) -> int ¶
Raises NotImplementedError.writable() -> bool ¶
Falsewrite(__s) -> int ¶
Raises UnsupportedOperation.writelines(__lines) -> None ¶
Raises UnsupportedOperation.
| Date: | 21 Dec 2022 |
|---|---|
| Version: | 0.1 |
| Author: | Adrian Hoefflin [srccircumflex] |
| Doc-Generator: | "pyiStructure-RSTGenerator" <prototype> |
