Line and character format interpretation and serialization.
Sequence
Iterable
Callable
TypeAlias0
partial0
struct0
Fields0
Format configuration for separating the fields in a line of syntax.
Essentially, a structured partial instance that provides an interface consistent with other format data structures. separation intends to be used to identify the configuration that isolate uses in order separate the fields of a string. In many cases, separation should be the instance of a class and isolate should be an unbound method that performs the desired functionality.
Fieldspartial0
partial(self, *argv, **kw)
Construct a direct call to isolate with separation and the given arguments bound to the call.
Fieldsstructure0Iterable[Sequence[tuple[str,str]]]
structure(self, lines)
Fieldssequence0Iterable[str]
sequence(self, fields)
Reconstruct the original lines from the given field vectors.
Lines0
Format configuration for reading and writing indented syntax lines.
Linestermination0str
termination: str = '\n'
Linesindentation0str
indentation: str = '\t'
@staticmethod
Lines_splitpartial0tuple[str, Sequence[str]]
_splitpartial(lt, text)
Interpret the given text as a sequence of lines using the configured termination character.
The leading string is prefixed to the first line in the split, and the final line is removed and returned as the remainder to be passed back in as leading to the next call.
Use split when text is known to be complete.
Lines_splitpartialReturns
A pair of values. The remainder from the split and the split lines with the given leading prefixed on the first line.
Linesmeasure_partial_termination0int
measure_partial_termination(self, line)
Identify the number of characters at the end of the line that intersect with termination.
Linesmeasure_indentation187%int
measure_indentation(self, line)
Identify the indentation level of the given line by counting the leading indentation characters.
Lineslevel0tuple[int, str]
level(self, line)
Measure the indentation of line and reconstruct it as a tuple expressing the indentation level as an integer and the content of the line without the indentation characters.
Linesstructure193%Iterable[tuple[int, str]]
structure(self, itext)
Structure the given iterator of strings as an iterator of lines.
Excludes a final empty line.
Linessequence0Iterable[str]
sequence(self, ilines)
Reconstruct the original lines from an iterable of indentation level and line content pairs.
Includes a final empty line.
Characters0
Character encoding and decoding configuration.
Primarily, a minor abstraction for Python's codecs providing structure and sequence interfaces that can be composed with Lines.
Characters_alloc_coder_pair0
_alloc_coder_pair(coder, method, final)
Characters_alloc_codec_constructors0
_alloc_codec_constructors(ci, errors)
Charactersfrom_codec0
from_codec(Class, encoding, errors)
Create an instance using a Python encoding and errors handling scheme.
If mixed error handling is needed in one instance, create two instances with from_codec and combine the fields as needed into a third instance.
Characterssequence0Iterable[bytes]
sequence(self, itext)
Charactersstructure0Iterable[str]
structure(self, ibytes)
Decode the data produced by ibytes as unicode strings.