abstract_code_dependencies function¶
(Shortest import: from brian2.parsing.dependencies import abstract_code_dependencies)
-
brian2.parsing.dependencies.abstract_code_dependencies(code, known_vars=None, known_funcs=None)[source]¶ Analyses identifiers used in abstract code blocks
- Parameters
code : str
The abstract code block.
known_vars : set
The set of known variable names.
known_funcs : set
The set of known function names.
- Returns
results : namedtuple with the following fields
allThe set of all identifiers that appear in this code block, including functions.
readThe set of values that are read, excluding functions.
writeThe set of all values that are written to.
funcsThe set of all function names.
known_allThe set of all identifiers that appear in this code block and are known.
known_readThe set of known values that are read, excluding functions.
known_writeThe set of known values that are written to.
known_funcsThe set of known functions that are used.
unknown_readThe set of all unknown variables whose values are read. Equal to
read-known_vars.unknown_writeThe set of all unknown variables written to. Equal to
write-known_vars.unknown_funcsThe set of all unknown function names, equal to
funcs-known_funcs.undefined_readThe set of all unknown variables whose values are read before they are written to. If this set is nonempty it usually indicates an error, since a variable that is read should either have been defined in the code block (in which case it will appear in
newly_defined) or already be known.newly_definedThe set of all variable names which are newly defined in this abstract code block.