Home | Trees | Indices | Help |
|
---|
|
Common code for coding and decoding VOTable data.
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
__package__ =
|
Function Details |
returns the source for a function encoding rows of tableDefition in the format implied encoderModule tableDefinition is a VOTable.TABLE instance, encoderModule is one of the enc_whatever modules (this function needs getLinesFor and getPostamble from them). |
returns a compiled function for source in env. Source is the result of one of the makeXXX functions in this module, env typically the result of a getGlobals() on the codec module. |
returns None or the nullvalue defined for field. validator is a function that raises some exception if the nullvalue is inappropriate. It should do so in particular on everything that contains quotes and such; the nullvalues are included in source code and thus might be used to inject code if not validated. |
turns a flat sequence into an n-dim array as specfied by the votable arraysize spec arraysize. arraysize is <int>{"x"<int>}*?|*. No padding or cropping will take place. This means that the last row(s) may have improper sizes if seq is incompatible with arraysize. >>> unravelArray("2x3", "012345") ['01', '23', '45'] >>> unravelArray("2x*", "012345") ['01', '23', '45'] >>> unravelArray("3x2x*", "012345012345") [['012', '345'], ['012', '345']] |
parses a single VOTable arraysize number to (flexible, length). This will accept single numbers (returns False, number), number* (returns True, number) and just * (returns 0, number). This is used to parse the last part of an ND array spec. Everything before that must be an integer only. |
returns code lines to validate an an array shape against a flat sequence in row. This is used by the array decoders. |
expands flattens out any sub-sequences (lists or tuples) in seq recursively. This is used by the array encoders. |
returns seq with length arraysize. arraysize is an int; you should just use field.getLength() when trimming VOTable arraysizes since the arraysize attribute is rather complex. Arraysize may be None for convenience; trim is a no-op then. If seq is shorter, padder*missing will be appended, if it is longer, seq will be shortened from the end. This is intended as a helper for array encoders. |
returns val flattened and padded with padChar/cropped to length. field is a V.FIELD or V.PARAM instance for which val should be prepared. val can also be a sequence of strings (or nested more deeply. In that case, trimString will flatten the value(s), padding and cropping as neccessary. If val is None, then as many padChars will be returned as arraysize wants (which is 0 for variable-length fields). For chars, arraysize None is equivalent to arraysize 1. >>> trimString("abc", "4") 'abc ' >>> trimString(["abc", "de", "f"], "2x*") 'abdef ' >>> trimString([["abc", "cd", "e"], ["", "fgh", "i"]], "2x4x3") 'abcde fgi ' >>> trimString(None, "4x2", 'z') 'zzzzzzzz' >>> trimString(None, "4x2*", 'z') '' >>> trimString("abc", None) 'a' |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu May 2 07:29:09 2019 | http://epydoc.sourceforge.net |