gavo.stc.common module

Definitions and shared code for STC processing.

class gavo.stc.common.ASTNode(id=None, ucd=None)[source]

Bases: AutoNode

The base class for all nodes in STC ASTs.

ensureId()[source]

sets id to some value if still None.

inexactAttrs = {}
class gavo.stc.common.ColRef(dest)[source]

Bases: Stub

A column reference instead of a true value, occurring in an STC-S tree.

apply(func)[source]

does nothing.

Stubs don’t have what Element.apply needs, so we don’t even pretend.

encode(encoding)[source]
isoformat()[source]
name_ = '_colRef'
toParam = False
class gavo.stc.common.GeometryColRef(dest)[source]

Bases: ColRef

A ColRef that refers to an in-DB geometry.

These comprise the entire arguments of a geometry (or all coordinates of a vector). They implement __len__ as soon as they are validated (in stcsast; we don’t do col. refs in stc-x); their len is the expected number of elements.

expectedLength = None
exception gavo.stc.common.STCError(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

exception gavo.stc.common.STCInternalError(msg: str = '', hint: Optional[str] = None)[source]

Bases: STCError

is raised when assumptions about the library behaviour are violated.

exception gavo.stc.common.STCLiteralError(msg, literal=None)[source]

Bases: STCError

is raised when a literal is not well-formed.

There is an attribute literal giving the malformed literal.

exception gavo.stc.common.STCNotImplementedError(msg: str = '', hint: Optional[str] = None)[source]

Bases: STCError

is raised when the current implementation limits are reached.

exception gavo.stc.common.STCSParseError(msg, expr=None, pos=None)[source]

Bases: STCError

is raised if an STC-S expression could not be parsed.

Low-level routines raise a pyparsing ParseException. Only higher level functions raise this error. The offending expression is in the expr attribute, the start position of the offending phrase in pos.

exception gavo.stc.common.STCUnitError(msg: str = '', hint: Optional[str] = None)[source]

Bases: STCError

is raised when some impossible operation on units is requested.

exception gavo.stc.common.STCValueError(msg: str = '', hint: Optional[str] = None)[source]

Bases: STCError

is raised when some STC specification is inconsistent.

exception gavo.stc.common.STCXBadError(msg: str = '', hint: Optional[str] = None)[source]

Bases: STCError

is raised when something is wrong with STC-X.

gavo.stc.common.clampLat(val)[source]

returns val standardized as a latitude.

Our latitudes are always in [-pi, pi].

gavo.stc.common.clampLong(val)[source]

returns val standardized as a latitude.

Our latitudes are always in [0, 2*pi].