Package gavo :: Package grammars :: Module common :: Class Rowfilter
[frames] | no frames]

Class Rowfilter

source code

                   object --+                    
                            |                    
 base.structure.StructureBase --+                
                                |                
                   object --+   |                
                            |   |                
           base.common.Parser --+                
                                |                
base.structure.ParseableStructure --+            
                                    |            
             base.structure.Structure --+        
                                        |        
                           object --+   |        
                                    |   |        
      base.structure.RestrictionMixin --+        
                                        |        
                   rscdef.procdef.ProcDef --+    
                                            |    
                       rscdef.procdef.ProcApp --+
                                                |
                                               Rowfilter

A generator for rows coming from a grammar.

Rowfilters receive rows (i.e., dictionaries) as yielded by a grammar under the name row. Additionally, the embedding row iterator is available under the name rowIter.

Macros are expanded within the embedding grammar.

The procedure definition *must* result in a generator, i.e., there must be at least one yield; in general, this will typically be a ``yield row``, but a rowfilter may swallow or create as many rows as desired.

If you forget to have a yield in the rowfilter source, you'll get a "NoneType is not iterable" error that's a bit hard to understand.

Here, you can only access whatever comes from the grammar. You can access grammar keys in late parameters as row[key] or, if key is like an identifier, as @key.

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
getFuncCode(self)
returns a function definition for this proc application.
source code

Inherited from rscdef.procdef.ProcApp: breakCircles, compile, completeElement, getBodySetupCode, getLateSetupCode, getParSetupCode, getSetupCode, getSetupPars, onElementComplete, validate

Inherited from rscdef.procdef.ProcDef: getCode

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'rowfilter'
hash(x)
  requiredType = 'rowfilter'
hash(x)
  formalArgs = 'row, rowIter'

Inherited from rscdef.procdef.ProcApp: additionalNamesForProcs, attrSeq, managedAttrs

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__

Method Details

getFuncCode(self)

source code 

returns a function definition for this proc application.

This includes bindings of late parameters.

Locally defined code overrides code defined in a procDef.

Overrides: rscdef.procdef.ProcApp.getFuncCode
(inherited documentation)