deephaven.lang.analyzer¶
The analyzer is used for inspecting the user’s source, detecting column and variable references as well as inferring return types using numba’s internal infrastructure.
The contents of this module are intended only for internal Deephaven use and may change at any time.
-
class
Analyzer
(cols, refs)¶ Analyze the parsed source code from the user.
This operation is O(n) on the input source, which should usually be quite small. If you do not specify an explicit return type, we will use numba type inference to guess it.
-
generic_visit
(node)¶ Called on every visit; we override mostly to set a breakpoint or add extra logging
-
type_map
= {bool: <function Analyzer.<lambda>>, int64: <function Analyzer.<lambda>>, float32: <function Analyzer.<lambda>>, int8: <function Analyzer.<lambda>>, int16: <function Analyzer.<lambda>>, int32: <function Analyzer.<lambda>>, uint8: <function Analyzer.<lambda>>, uint16: <function Analyzer.<lambda>>, uint32: <function Analyzer.<lambda>>, uint64: <function Analyzer.<lambda>>, float64: <function Analyzer.<lambda>>, complex64: <function Analyzer.<lambda>>, complex128: <function Analyzer.<lambda>>, <class 'numpy.bool_'>: <function Analyzer.<lambda>>, <class 'numpy.int64'>: <function Analyzer.<lambda>>, <class 'numpy.float64'>: <function Analyzer.<lambda>>, <class 'numpy.int8'>: <function Analyzer.<lambda>>, <class 'numpy.int16'>: <function Analyzer.<lambda>>, <class 'numpy.int32'>: <function Analyzer.<lambda>>, <class 'numpy.uint8'>: <function Analyzer.<lambda>>, <class 'numpy.uint16'>: <function Analyzer.<lambda>>, <class 'numpy.uint32'>: <function Analyzer.<lambda>>, <class 'numpy.uint64'>: <function Analyzer.<lambda>>, <class 'numpy.float32'>: <function Analyzer.<lambda>>, <class 'numpy.complex64'>: <function Analyzer.<lambda>>, <class 'numpy.complex128'>: <function Analyzer.<lambda>>, <class 'numpy.object_'>: <function Analyzer.<lambda>>}¶ The contents of this map determine what kind of ad-hoc variables we create when seeding numba type-inferer.
-
visit_Assign
(node)¶ If you use any assignments, we expect the last assignment to be the ‘final output to return’
-
visit_FunctionDef
(node)¶ We will ignore all function defs, as we don’t want to visit their bodies (or the `Name`s in the arg list)
-
visit_Name
(node)¶ This represents any Name ast node
-
visit_Statement
(node)¶ Visit a statement.
-
visit_Subscript
(node)¶ This represent an array access
-