declare_types function

(Shortest import: from brian2 import declare_types)

brian2.core.functions.declare_types(**types)[source]

Decorator to declare argument and result types for a function

Usage is similar to check_units() except that types must be one of {VALID_ARG_TYPES} and the result type must be one of {VALID_RETURN_TYPES}. Unspecified argument types are assumed to be 'all' (i.e. anything is permitted), and an unspecified result type is assumed to be 'float'. Note that the 'highest' option for result type will give the highest type of its argument, e.g. if the arguments were boolean and integer then the result would be integer, if the arguments were integer and float it would be float.