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

Class MapKeys

source code

                   object --+            
                            |            
 base.structure.StructureBase --+        
                                |        
                   object --+   |        
                            |   |        
           base.common.Parser --+        
                                |        
base.structure.ParseableStructure --+    
                                    |    
             base.structure.Structure --+
                                        |
                                       MapKeys

Mapping of names, specified in long or short forms.

mapKeys is necessary in grammars like keyValueGrammar or fitsProdGrammar. In these, the source files themselves give key names. Within the GAVO DC, keys are required to be valid python identifiers (i.e., match ``[A-Za-z\_][A-Za-z\_0-9]*``). If keys coming in do not have this form, mapping can force proper names.

mapKeys could also be used to make incoming names more suitable for matching with shell patterns (like in rowmaker idmaps).

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
onElementComplete(self) source code
 
doMap(self, aDict)
returns dict with the keys mapped according to the defined mappings.
source code

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

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

Inherited from base.structure.StructureBase: __providedBy__, adopt, breakCircles, 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_ = 'mapKeys'
a sentinel for all kinds of undefined values.
  attrSeq = [<gavo.base.structure.DataContent object>, <gavo.bas...
  managedAttrs = {'content_': <gavo.base.structure.DataContent o...

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__

Method Details

onElementComplete(self)

source code 
Overrides: base.structure.Structure.onElementComplete

Class Variable Details

attrSeq

Value:
[<gavo.base.structure.DataContent object>,
 <gavo.base.parsecontext.IdAttribute object>,
 <gavo.base.complexattrs.DictAttribute object>]

managedAttrs

Value:
{'content_': <gavo.base.structure.DataContent object>,
 'id': <gavo.base.parsecontext.IdAttribute object>,
 'map': <gavo.base.complexattrs.DictAttribute object>,
 'maps': <gavo.base.complexattrs.DictAttribute object>}