parsing package¶
bast
module¶
Brian AST representation
This is a standard Python AST representation with additional information added.
Exported members:
brian_ast
, BrianASTRenderer
, dtype_hierarchy
Classes
BrianASTRenderer (variables[, copy_variables]) |
This class is modelled after NodeRenderer - see there for details. |
Functions
brian_ast (expr, variables) |
Returns an AST tree representation with additional information |
brian_dtype_from_dtype (dtype) |
Returns ‘boolean’, ‘integer’ or ‘float’ |
brian_dtype_from_value (value) |
Returns ‘boolean’, ‘integer’ or ‘float’ |
is_boolean (value) |
is_boolean_dtype (obj) |
is_float (value) |
is_float_dtype (obj) |
is_integer (value) |
is_integer_dtype (obj) |
dependencies
module¶
Exported members:
abstract_code_dependencies
Functions
abstract_code_dependencies (code[, ...]) |
Analyses identifiers used in abstract code blocks |
get_read_write_funcs (parsed_code) |
expressions
module¶
AST parsing based analysis of expressions
Exported members:
is_boolean_expression
, parse_expression_unit
Functions
is_boolean_expression (expr, variables) |
Determines if an expression is of boolean type or not |
parse_expression_unit (expr, variables) |
Returns the unit value of an expression, and checks its validity |
functions
module¶
Exported members:
AbstractCodeFunction
, abstract_code_from_function
, extract_abstract_code_functions
, substitute_abstract_code_functions
Classes
AbstractCodeFunction (name, args, code, ...) |
The information defining an abstract code function |
FunctionRewriter (func[, numcalls]) |
Inlines a function call using temporary variables |
VarRewriter (pre) |
Rewrites all variable names in names by prepending pre |
Functions
abstract_code_from_function (func) |
Converts the body of the function to abstract code |
extract_abstract_code_functions (code) |
Returns a set of abstract code functions from function definitions. |
substitute_abstract_code_functions (code, funcs) |
Performs inline substitution of all the functions in the code |
rendering
module¶
Exported members:
NodeRenderer
, NumpyNodeRenderer
, CPPNodeRenderer
, SympyNodeRenderer
Classes
CPPNodeRenderer ([use_vectorisation_idx]) |
Methods |
NodeRenderer ([use_vectorisation_idx]) |
Methods |
NumpyNodeRenderer ([use_vectorisation_idx]) |
Methods |
SympyNodeRenderer ([use_vectorisation_idx]) |
Methods |
sympytools
module¶
Utility functions for parsing expressions and statements.
Classes
CustomSympyPrinter ([settings]) |
Printer that overrides the printing of some basic sympy objects. |
Functions
check_expression_for_multiple_stateful_functions (...) |
expression_complexity (expr[, complexity]) |
Returns the complexity of an expression (either string or sympy) |
replace_constants (sympy_expr[, variables]) |
Replace constant values in a sympy expression with their numerical value. |
str_to_sympy (expr[, variables]) |
Parses a string into a sympy expression. |
sympy_to_str (sympy_expr) |
Converts a sympy expression into a string. |
Objects
PRINTER |
Printer that overrides the printing of some basic sympy objects. |