Package gavo :: Package svcs :: Module vizierexprs
[frames] | no frames]

Module vizierexprs

source code

Classes and methods to support vizier-type specifications on fields.

Classes
  ParseNode
is a parse node, consisting of an operator and children.
  NumericNode
A node containing numeric operands (floats or dates).
  DateNode
A node containing date operands (datetime objects, as a rule).
  MJDNode
  StringNode
A node containing string operands.
  ToVexprConverter
Functions
 
getComplexGrammar(baseLiteral, pmBuilder, errorLiteral=None, nodeClass=<class 'gavo.svcs.vizierexprs.NumericNode'>)
returns the root element of a grammar parsing numeric vizier-like expressions.
source code
 
parseFloat(s, pos, tok) source code
 
parseDateTime(s, pos, tok)
returns a datetime from a date/time spec.
source code
 
parseNumericExpr(str, baseSymbol={expr StringEnd})
returns a parse tree for vizier-like expressions over floats.
source code
 
parseDateExpr(str, baseSymbol={expr StringEnd})
returns a parse tree for vizier-like expressions over ISO dates.
source code
 
parseDateExprToMJD(str, baseSymbol={expr StringEnd})
returns a parse tree for vizier-like expression of ISO dates with parsed values in MJD.
source code
 
getStringGrammar()
returns a grammar for parsing vizier-like string expressions.
source code
 
parseStringExpr(str, baseSymbol={StringExpr StringEnd}) source code
 
getVexprFor(sqlType) source code
 
makeConeSearchFor(inputKey)
returns an //scs#makeSpointCD condDesc tailored for inputKey.
source code
 
format_placeholder(min_val, max_val, formatter)
returns a placeholder string for a possibly open interval.
source code
 
getPlaceholderFor(inputKey, values)
returns a placeholder (suggested input) for inputKey, where values is the original values element.
source code
 
adaptInputKey(inputKey)
returns ik changed to generate SQL for Vizier-like expressions.
source code
Variables
  floatLiteral = Re:('[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\...
  __package__ = 'gavo.svcs'
Function Details

getComplexGrammar(baseLiteral, pmBuilder, errorLiteral=None, nodeClass=<class 'gavo.svcs.vizierexprs.NumericNode'>)

source code 

returns the root element of a grammar parsing numeric vizier-like expressions.

This is used for both dates and floats, use baseLiteral to match the operand terminal. The trouble with dates is that the +/- operator has a simple float as the second operand, and that's why you can pass in an errorLiteral and and pmBuilder.

parseDateTime(s, pos, tok)

source code 

returns a datetime from a date/time spec.

This can be an ISO string or a julian year, JD, or MJD by heuristics (see DateNode for details).

parseDateExpr(str, baseSymbol={expr StringEnd})

source code 

returns a parse tree for vizier-like expressions over ISO dates.

Note that the semantic validity of the date (like, month<13) is not checked by the grammar.

format_placeholder(min_val, max_val, formatter)

source code 

returns a placeholder string for a possibly open interval.

*_val may be None, formatter has to accept a non-None value and return the proper representation for the placeholder string.

If no placeholder can be generated, this function returns None.

getPlaceholderFor(inputKey, values)

source code 

returns a placeholder (suggested input) for inputKey, where values is the original values element.

This will currently be None unless we do a numeric input.

adaptInputKey(inputKey)

source code 

returns ik changed to generate SQL for Vizier-like expressions.

This is used for buildFrom on CondDescs and renderers having parameterStyle form.


Variables Details

floatLiteral

Value:
Re:('[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?')