gavo.grammars.csvgrammar module

A grammar using python’s csv module to parse files.

class gavo.grammars.csvgrammar.CSVGrammar(parent, **kwargs)[source]

Bases: Grammar, FileRowAttributes

A grammar that uses python’s csv module to parse files.

Note that these grammars by default interpret the first line of the input file as the column names. When your files don’t follow that convention, you must give names (as in names='raj2000, dej2000, magV'), or you’ll lose the first line and have silly column names.

If data is left after filling the defined keys, it is available under the NOTASSIGNED key.

attrSeq = [<gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.BooleanAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.attrdef.StringListAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.attrdef.BooleanAttribute object>, <gavo.base.attrdef.IntAttribute object>]
clearProperty(name)
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
hasProperty(name)
managedAttrs = {'delimiter': <gavo.base.attrdef.UnicodeAttribute object>, 'enc': <gavo.base.attrdef.UnicodeAttribute object>, 'gunzip': <gavo.base.attrdef.BooleanAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'ignoreOn': <gavo.base.complexattrs.StructAttribute object>, 'mapKeys': <gavo.base.complexattrs.StructAttribute object>, 'names': <gavo.base.attrdef.StringListAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'preFilter': <gavo.base.attrdef.UnicodeAttribute 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>, 'strip': <gavo.base.attrdef.BooleanAttribute object>, 'topIgnoredLines': <gavo.base.attrdef.IntAttribute object>}
name_ = 'csvGrammar'
property rd
rowIterator

alias of CSVIterator

setProperty(name, value)
class gavo.grammars.csvgrammar.CSVIterator(grammar, sourceToken, **kwargs)[source]

Bases: FileRowIterator

getLocator()[source]