class documentation

Class for reading and processing standard format marker files and strings.

Method __init__ Undocumented
Method close Close a previously opened standard format marker file or string.
Method fields Return an iterator that returns the next field in a (marker, value) tuple, where marker and value are unicode strings if an encoding was specified in the fields() method. Otherwise they are non-unicode strings.
Method open Open a standard format marker file for sequential reading.
Method open_string Open a standard format marker string for sequential reading.
Method raw_fields Return an iterator that returns the next field in a (marker, value) tuple. Linebreaks and trailing white space are preserved except for the final newline in each field.
Instance Variable line_num Undocumented
Instance Variable _encoding Undocumented
Instance Variable _file Undocumented
def __init__(self, filename=None, encoding=None): (source)

Undocumented

def close(self): (source)

Close a previously opened standard format marker file or string.

def fields(self, strip=True, unwrap=True, encoding=None, errors='strict', unicode_fields=None): (source)

Return an iterator that returns the next field in a (marker, value) tuple, where marker and value are unicode strings if an encoding was specified in the fields() method. Otherwise they are non-unicode strings.

Parameters
strip:boolstrip trailing whitespace from the last line of each field
unwrap:boolConvert newlines in a field to spaces.
encoding:str or NoneName of an encoding to use. If it is specified then the fields() method returns unicode strings rather than non unicode strings.
errors:strError handling scheme for codec. Same as the decode() builtin string method.
unicode_fields:sequenceSet of marker names whose values are UTF-8 encoded. Ignored if encoding is None. If the whole file is UTF-8 encoded set encoding='utf8' and leave unicode_fields with its default value of None.
Returns
iter(tuple(str, str))Undocumented
def open(self, sfm_file): (source)

Open a standard format marker file for sequential reading.

Parameters
sfm_file:strname of the standard format marker input file
def open_string(self, s): (source)

Open a standard format marker string for sequential reading.

Parameters
s:strstring to parse as a standard format marker input file
def raw_fields(self): (source)

Return an iterator that returns the next field in a (marker, value) tuple. Linebreaks and trailing white space are preserved except for the final newline in each field.

Returns
iter(tuple(str, str))Undocumented
line_num: int = (source)

Undocumented

_encoding = (source)

Undocumented

Undocumented