class documentation

Undocumented

Method parse Undocumented
Method _chunk_parse Returns an element tree structure corresponding to a toolbox data file parsed according to the chunk grammar.
Method _record_parse Returns an element tree structure corresponding to a toolbox data file with all markers at the same level.
Method _tree2etree Undocumented

Inherited from StandardFormat:

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 parse(self, grammar=None, **kwargs): (source)

Undocumented

def _chunk_parse(self, grammar=None, root_label='record', trace=0, **kwargs): (source)

Returns an element tree structure corresponding to a toolbox data file parsed according to the chunk grammar.

Parameters
grammar:strContains the chunking rules used to parse the database. See chunk.RegExp for documentation.
root_label:strThe node value that should be used for the top node of the chunk structure.
trace:intThe level of tracing that should be used when parsing a text. 0 will generate no tracing output; 1 will generate normal tracing output; and 2 or higher will generate verbose tracing output.
**kwargs:dictKeyword arguments passed to toolbox.StandardFormat.fields()
Returns
ElementTree._ElementInterfaceUndocumented
def _record_parse(self, key=None, **kwargs): (source)

Returns an element tree structure corresponding to a toolbox data file with all markers at the same level.

Thus the following Toolbox database::

_sh v3.0 400 Rotokas Dictionary _DateStampHasFourDigitYear

lx kaa ps V.A ge gag gp nek i pas

lx kaa ps V.B ge strangle gp pasim nek

after parsing will end up with the same structure (ignoring the extra whitespace) as the following XML fragment after being parsed by ElementTree:

<toolbox_data>
    <header>
        <_sh>v3.0  400  Rotokas Dictionary</_sh>
        <_DateStampHasFourDigitYear/>
    </header>

    <record>
        <lx>kaa</lx>
        <ps>V.A</ps>
        <ge>gag</ge>
        <gp>nek i pas</gp>
    </record>

    <record>
        <lx>kaa</lx>
        <ps>V.B</ps>
        <ge>strangle</ge>
        <gp>pasim nek</gp>
    </record>
</toolbox_data>
Parameters
key:strName of key marker at the start of each record. If set to None (the default value) the first marker that doesn't begin with an underscore is assumed to be the key.
**kwargs:dictKeyword arguments passed to StandardFormat.fields()
Returns
ElementTree._ElementInterfacecontents of toolbox data divided into header and records
def _tree2etree(self, parent): (source)

Undocumented