gavo.votable.paramval module

Serialisation of python values to VOTable PARAM values.

This has two aspects:

  • Guessing proper VOTable type descriptors for python values (use guessParamAttrsForValue)

  • Serialising the python values to strings suitable for the PARAM. (use serializeToParam)

class gavo.votable.paramval.PrimitiveAnnotatedColumn(datatype, arraysize, xtype)[source]

Bases: dict

A stand-in for serializers.AnnotatedColumn.

We don’t want to use the full thing as it’s too fat here, and getVOTSerializer doesn’t have the original param anyway (as it shouldn’t, as that would break memoization).

class original[source]

Bases: object

stc = None
xtype = None
gavo.votable.paramval.getVOTParser(datatype, arraysize, xtype)[source]

returns a function deserializing values in a param with datatype, arraysize, and xtype.

gavo.votable.paramval.getVOTSerializer(datatype, arraysize, xtype)[source]

returns a function serializing for values of params with the attributes given.

gavo.votable.paramval.guessParamAttrsForValue(pythonVal)[source]

returns a dict of proposed attributes for a PARAM to keep pythonVal.

There is, of course, quite a bit of heuristics involved. For instance, we assume sequences are homogeneous.

gavo.votable.paramval.serializeToParam(param, val)[source]

changes the VOTable PARAM param such that val is represented.

This may involve adding a null value.