CodeObjectTemplate class¶
(Shortest import: from brian2.codegen.templates import CodeObjectTemplate)
-
class
brian2.codegen.templates.CodeObjectTemplate(template, template_source)[source]¶ Bases:
objectSingle template object returned by
Templaterand used for final code generationShould not be instantiated by the user, but only directly by
Templater.Notes
The final code is obtained from this by calling the template (see
__call__).Attributes
allows_scalar_writeDoes this template allow writing to scalar variables? iterate_allThe indices over which the template iterates completely variablesThe set of variables in this template writes_read_onlyRead-only variables that are changed by this template Methods
__call__(scalar_code, vector_code, **kwds)Return a usable code block or blocks from this template. Details
-
allows_scalar_write¶ Does this template allow writing to scalar variables?
-
iterate_all¶ The indices over which the template iterates completely
-
variables¶ The set of variables in this template
-
writes_read_only¶ Read-only variables that are changed by this template
-
__call__(scalar_code, vector_code, **kwds)[source]¶ Return a usable code block or blocks from this template.
Parameters: scalar_code : dict
Dictionary of scalar code blocks.
vector_code : dict
Dictionary of vector code blocks
**kwds :
Additional parameters to pass to the template
Notes
Returns either a string (if macros were not used in the template), or a
MultiTemplate(if macros were used).
-