format297%python.module
fault.syntax

Line and character format interpretation and serialization.

Sequence
import

Iterable
import

Callable
import

TypeAlias0
import

partial0
import

struct0
import

Fields0
class

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
method

partial(self, *argv, **kw)

Construct a direct call to isolate with separation and the given arguments bound to the call.

Fieldsstructure0
method
Iterable[Sequence[tuple[str,str]]]

structure(self, lines)

Perform isolate against the given lines.

Fieldssequence0
method
Iterable[str]

sequence(self, fields)

Reconstruct the original lines from the given field vectors.

Lines0
class

Format configuration for reading and writing indented syntax lines.

Linestermination0
data
str

termination: str = '\n'

Linesindentation0
data
str

indentation: str = '\t'
	@staticmethod

Lines_splitpartial0
staticmethod
tuple[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_termination0
method
int

measure_partial_termination(self, line)

Identify the number of characters at the end of the line that intersect with termination.

Linesmeasure_indentation187%
method
int

measure_indentation(self, line)

Identify the indentation level of the given line by counting the leading indentation characters.

Lineslevel0
method
tuple[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%
method
Iterable[tuple[int, str]]

structure(self, itext)

Structure the given iterator of strings as an iterator of lines.

Excludes a final empty line.

Linessequence0
method
Iterable[str]

sequence(self, ilines)

Reconstruct the original lines from an iterable of indentation level and line content pairs.

Includes a final empty line.

Characters0
class

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
staticmethod

_alloc_coder_pair(coder, method, final)

Characters_alloc_codec_constructors0
staticmethod

_alloc_codec_constructors(ci, errors)

Charactersfrom_codec0
classmethod

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.

Characterssequence0
method
Iterable[bytes]

sequence(self, itext)

Encode the strings produced by itext as bytes.

Charactersstructure0
method
Iterable[str]

structure(self, ibytes)

Decode the data produced by ibytes as unicode strings.