gavo.grammars.customgrammar module

A grammar that imports a user-defined module and takes the RowIterator from there.

The module has to define a RowIterator derived from CustomRowIterator. It may define a function makeDataPack receiving the grammar as its argument and returning anything. This anything will then be available as self.grammar.dataPack to the row iterator. Use this for expensive, one-time preparations your row iterator has to perform.

class gavo.grammars.customgrammar.CustomGrammar(parent, **kwargs)[source]

Bases: Grammar, RestrictionMixin

A Grammar with a user-defined row iterator taken from a module.

See the `Writing Custom Grammars`_ (in the reference manual) for details.

attrSeq = [<gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.attrdef.BooleanAttribute object>, <gavo.rscdef.common.ResdirRelativeAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.complexattrs.StructAttribute object>]
clearProperty(name)
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
hasProperty(name)
managedAttrs = {'enc': <gavo.base.attrdef.UnicodeAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'ignoreOn': <gavo.base.complexattrs.StructAttribute object>, 'isDispatching': <gavo.base.attrdef.BooleanAttribute object>, 'module': <gavo.rscdef.common.ResdirRelativeAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'properties': <gavo.base.complexattrs.PropertyAttribute object>, 'property': <gavo.base.complexattrs.PropertyAttribute object>, 'rd': <gavo.rscdef.common.RDAttribute object>, 'rowfilter': <gavo.base.complexattrs.StructListAttribute object>, 'rowfilters': <gavo.base.complexattrs.StructListAttribute object>, 'sourceFields': <gavo.base.complexattrs.StructAttribute object>}
property module
name_ = 'customGrammar'
parse(*args, **kwargs)[source]
property rd
setProperty(name, value)
class gavo.grammars.customgrammar.CustomRowIterator(grammar, sourceToken, sourceRow=None)[source]

Bases: RowIterator

is a base class for custom row iterators.

Implement at least _iterRows. And pass on any keyword args to __init__ to the next constructor.

gavo.grammars.customgrammar.getModuleName()[source]