typingtools¶
This module implements some “types” to be used for static (and eventually dynamical) typing.
Module typingtools implements the following members:
ArrayFloatType variable.
Float1Type variable.
Float2Type variable.
Float_coType variable.
MatrixInputThe central part of internal API.
TType variable.
T1Type variable.
T2Type variable.
T3Type variable.
VectorInputProtocol class for providing input to “mathematical”, 1-dimensional arrays.
VectorProtocol class for defining “mathematical”, 1-dimensional sequences.
MatrixProtocol class for providing input to “mathematical”, 2-dimensional arrays.
IterableNonStringAbstract base class for checking if an object is iterable but not a string.
VariableProtocolProtocol to identify objects as “variables”.
CyParametersProtocolThe protocol for the parameters attribute of Cython extension classes.
CySequencesProtocolThe protocol for the sequences attribute of Cython extension classes.
CyModelProtocolThe protocol of Cython extension classes for defining efficient model implementations.
ScriptFunctionCallback protocol for functions to be executed from the command line (see the documentation on functionexecute_scriptfunction()and modulehydfor further information).
-
class
hydpy.core.typingtools.CyModelProtocol(*args, **kwds)[source]¶ Bases:
typing_extensions.ProtocolThe protocol of Cython extension classes for defining efficient model implementations.
Class
Cythonizergenerates the actual, model specific implementations automatically.-
parameters: hydpy.core.typingtools.CyParametersProtocol¶
-
sequences: hydpy.core.typingtools.CySequencesProtocol¶
-
-
class
hydpy.core.typingtools.IterableNonString(*args, **kwds)[source]¶ Bases:
Iterable[object],abc.ABCAbstract base class for checking if an object is iterable but not a string.
>>> from hydpy.core.typingtools import IterableNonString >>> isinstance("asdf", IterableNonString) False >>> isinstance(["asdf"], IterableNonString) True >>> issubclass(str, IterableNonString) False >>> issubclass(list, IterableNonString) True
-
class
hydpy.core.typingtools.Matrix(*args, **kwds)[source]¶ Bases:
hydpy.core.typingtools.VectorInput[hydpy.core.typingtools.VectorInput[hydpy.core.typingtools.Float1]]Protocol class for providing input to “mathematical”, 2-dimensional arrays.
-
class
hydpy.core.typingtools.ScriptFunction(*args, **kwds)[source]¶ Bases:
typing_extensions.ProtocolCallback protocol for functions to be executed from the command line (see the documentation on function
execute_scriptfunction()and modulehydfor further information).
-
class
hydpy.core.typingtools.VariableProtocol(*args, **kwds)[source]¶ Bases:
typing_extensions.ProtocolProtocol to identify objects as “variables”.