deephaven.lang.tools¶
Helper functions for analyzing and generating AST produced by ast.parse().
The contents of this module are intended only for internal Deephaven use and may change at any time.
-
arg_or_name(name, name_ctx=<_ast.Param object>)¶ AST argument or name.
-
array_access(var_name, index)¶ AST array access.
-
assign(target, value)¶ AST assignment.
-
check_if_none(val, body, orelse=[])¶ AST check if None.
-
decorate(fun, args)¶ Create a decorator call. To get jit(nopython=True), call decorate(‘jit’, {“nopython”: “True”}
-
field_read(scope, field)¶ AST field read.
-
float32_(a)¶ Converts the input to a numpy float32 array.
- Parameters
a – input
- Returns
numpy array
-
float64_(a)¶ Converts the input to a numpy float64 array.
- Parameters
a – input
- Returns
numpy array
-
int32_(a)¶ Converts the input to a numpy int32 array.
- Parameters
a – input
- Returns
numpy array
-
int64_(a)¶ Converts the input to a numpy int64 array.
- Parameters
a – input
- Returns
numpy array
-
int_or_float(s)¶ Returns if a string representation of an input type is an int or float.
-
itr(arr)¶ Iterate over a collection.
-
keyword_arg(name, value)¶ AST keyword value.
-
merge_two_dicts(x, y)¶ Merges the contents of two dictionaries.
-
method_call(scope, args, keywords=None)¶ AST method call.
-
name_constant(name)¶ AST constant for True, False, and None.
-
new_func(func_name, args, body, decorators=None, defaults=None)¶ AST function.
-
new_list(items)¶ AST list.
-
class
not_py3¶ We need to import some ast types that only exist in py3, and we want to isinstance() check some variables against those types. So, we’ll use this junk class in python 2 and real imports for python 3.
-
num_size(s)¶ Returns the size in bits of a type represented as a string.
-
param(name)¶ AST parameter.
-
read(name)¶ AST read.
-
read_false()¶ AST read a False.
-
read_none()¶ AST read a None.
-
read_true()¶ AST read a True.
-
to_ast(item)¶ Returns an AST
-
to_numba_type(item_type)¶ Returns the numba type for a given item type.
-
values(dct)¶ Returns a list of all values in a dictionary.
-
write(name)¶ AST write.
-
write_array(var_name, index)¶ AST writing to an array element.