Package gavo :: Package stc :: Module utypegen
[frames] | no frames]

Module utypegen

source code

Generating a utype/value sequence for ASTs.

Yet another insane serialization for an insane data model. Sigh.

The way we come up with the STC utypes here is described in an IVOA note.

Since the utypes are basically xpaths into STC-X, there is not terribly much we need to do here. However, due to STC-X being a nightmare, certain rules need to be formulated what utypes to generate.

Here, we use UtypeMakers for this. There's a default UtypeMaker that implements the basic algorithm of the STC note (in iterUtypes, a method that yields all utype/value pairs for an STC-X node, which is a stanxml Element).

To customize what is being generated, define _gener_<child name> methods, where <child name> is a key within the dictionaries returned by stanxml.Element's getChildDict method.

To make the definition of the _gener_ methods easer, there's the handles decorator that you can pass a list of such child names.

Classes
  UtypeMaker_t
A metaclass to facilite easy definition of UtypeMakers.
  UtypeMaker
An object encapsulating information on how to turn a stanxml node into a sequence of utype/value pairs.
  TimeFrameMaker
  SpaceFrameMaker
  RedshiftFrameMaker
  SpectralFrameMaker
  TimeInstantMaker
  StartTimeMaker
  StopTimeMaker
Functions
 
handles(seq)
is a decorator for UtypeMaker methods.
source code
 
utypejoin(*utypes) source code
 
getUtypes(ast, includeDMURI=False, suppressXtype=True)
returns a lists of utype/value pairs for an STC AST.
source code
Variables
  __package__ = 'gavo.stc'
Function Details

handles(seq)

source code 

is a decorator for UtypeMaker methods.

It adds a "handles" attribute as evaluated by AutoUtypeMaker.

getUtypes(ast, includeDMURI=False, suppressXtype=True)

source code 

returns a lists of utype/value pairs for an STC AST.

If you pass includeDMURI, a utype/value pair for the data model URI will be generated in addition to what comes in from ast.