gavo.rscdef.rowtriggers module

Framework for ignoring rows based on various conditions.

class gavo.rscdef.rowtriggers.And(parent, **kwargs)[source]

Bases: ConditionBase

A trigger that is true when all its children are true.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.MultiStructListAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'keyIs': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyMissing': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyNull': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyPresent': <gavo.base.complexattrs.MultiStructListAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'not': <gavo.base.complexattrs.MultiStructListAttribute object>, 'triggers': <gavo.base.complexattrs.MultiStructListAttribute object>}
name_ = 'and'
class gavo.rscdef.rowtriggers.ConditionBase(parent, **kwargs)[source]

Bases: TriggerBase

is an abstract base for anything that can incorporate the basic triggers.

If you don’t override __call__, the basic operation is or-ing together all embedded conditions.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.MultiStructListAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'keyIs': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyMissing': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyNull': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyPresent': <gavo.base.complexattrs.MultiStructListAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'triggers': <gavo.base.complexattrs.MultiStructListAttribute object>}
class gavo.rscdef.rowtriggers.IgnoreOn(parent, **kwargs)[source]

Bases: ConditionBase

A condition on a row that, if true, causes the row to be dropped.

Here, you can set bail to abort an import when the condition is met rather than just dropping the row.

attrSeq = [<gavo.base.attrdef.BooleanAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.MultiStructListAttribute object>]
completedCallbacks = []
managedAttrs = {'and': <gavo.base.complexattrs.MultiStructListAttribute object>, 'bail': <gavo.base.attrdef.BooleanAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'keyIs': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyMissing': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyNull': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyPresent': <gavo.base.complexattrs.MultiStructListAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'not': <gavo.base.complexattrs.MultiStructListAttribute object>, 'triggers': <gavo.base.complexattrs.MultiStructListAttribute object>}
name_ = 'ignoreOn'
class gavo.rscdef.rowtriggers.KeyIs(parent, **kwargs)[source]

Bases: KeyedCondition

A trigger firing when the value of key in row is equal to the value given.

Missing keys are always accepted. You can define an SQL type; value will then be interpreted as a literal for this type, and this literal’s value will be compared against the key’s value. This is only needed for grammars like fitsProductGrammar that actually yield typed values.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'key': <gavo.base.attrdef.UnicodeAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'type': <gavo.base.attrdef.UnicodeAttribute object>, 'value': <gavo.base.attrdef.UnicodeAttribute object>}
name_ = 'keyIs'
onElementComplete()[source]
class gavo.rscdef.rowtriggers.KeyMissing(parent, **kwargs)[source]

Bases: KeyedCondition

A trigger firing if a certain key is missing in the dict.

This is equivalent to:

<not><keyPresent key="xy"/></not>
attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'key': <gavo.base.attrdef.UnicodeAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>}
name_ = 'keyMissing'
class gavo.rscdef.rowtriggers.KeyNull(parent, **kwargs)[source]

Bases: KeyedCondition

A trigger firing if a certain key is missing or NULL/None

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'key': <gavo.base.attrdef.UnicodeAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>}
name_ = 'keyNull'
class gavo.rscdef.rowtriggers.KeyPresent(parent, **kwargs)[source]

Bases: KeyedCondition

A trigger firing if a certain key is present in the dict.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'key': <gavo.base.attrdef.UnicodeAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>}
name_ = 'keyPresent'
class gavo.rscdef.rowtriggers.KeyedCondition(parent, **kwargs)[source]

Bases: TriggerBase

is an abstract base class for triggers firing on a single key.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'key': <gavo.base.attrdef.UnicodeAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>}
class gavo.rscdef.rowtriggers.Not(parent, **kwargs)[source]

Bases: ConditionBase

A trigger that is false when its children, or-ed together, are true and vice versa.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.MultiStructListAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'keyIs': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyMissing': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyNull': <gavo.base.complexattrs.MultiStructListAttribute object>, 'keyPresent': <gavo.base.complexattrs.MultiStructListAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>, 'triggers': <gavo.base.complexattrs.MultiStructListAttribute object>}
name_ = 'not'
class gavo.rscdef.rowtriggers.TriggerBase(parent, **kwargs)[source]

Bases: Structure

A trigger, i.e., a boolean construct.

This element does not actually occur in resource descriptors. Refer to Triggers_ for triggers actually available.

attrSeq = [<gavo.base.parsecontext.IdAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
completedCallbacks = []
managedAttrs = {'id': <gavo.base.parsecontext.IdAttribute object>, 'name': <gavo.base.attrdef.UnicodeAttribute object>}
name_ = 'trigger'
exception gavo.rscdef.rowtriggers.TriggerPulled(msg, triggerName)[source]

Bases: Error

gavo.rscdef.rowtriggers.getTrigger(name)[source]
gavo.rscdef.rowtriggers.registerTrigger(trigger)[source]