typingtools¶
This module implements some “types” to be used for static (and eventually dynamical) typing.
Module typingtools implements the following members:
ArrayFloatType variable.
ArrayFloatFlexType variable.
FloatType variable.
NameType for strings that represent names.
P_Parameter specification variable.
ScalarType variable.
T1Type variable.
T2Type variable.
T3Type variable.
TG_coType variable.
TM_coType variable.
TOM_coType variable.
T_coType variable.
T_contraType variable.
T_invType variable.
VectorFloatFlexType variable.
FastAccessVectorA 1-dimensional array handled by a fastaccess object.
FastAccessMatrixA 2-dimensional array handled by a fastaccess object.
FastAccessTensorA 3-dimensional array handled by a fastaccess object or a Cython extension class.
ConditionsGroupThe values of all condition sequences of a specific group (e.g. states) of a specific model instance, accessible via the sequences’ names.
ConditionsSubmodelThe values of all condition sequences of a specific model instance, accessible via the sequence groups’ names (e.g. states).
ConditionsModelThe values of all condition sequences of a specific main model instance and its submodels, accessible via the submodels’ (dotted) names (e.g. model or model.rconcmodel).
SharableConfigurationSpecification of the configuration data that main models can share with their submodels.
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.
CySubstepModelProtocolThe protocol of Cython extension classes for defining efficient model implementations compatible with classSubstepModel.
- class hydpy.core.typingtools.AbstractContextManager[source]¶
Bases:
ABCAn abstract base class for context managers.
- class hydpy.core.typingtools.ConditionsGroup(*args, **kwargs)[source]¶
Bases:
Protocol[TM_co,TG_co]The values of all condition sequences of a specific group (e.g. states) of a specific model instance, accessible via the sequences’ names.
The type parameters (the model type and the group name) only serve to allow HydPy’s Mypy plugin to determine the actual type of each condition value.
- values() ValuesView[float | NDArray[float64]][source]¶
Return all entries.
- class hydpy.core.typingtools.ConditionsModel(*args, **kwargs)[source]¶
Bases:
Protocol[TM_co]The values of all condition sequences of a specific main model instance and its submodels, accessible via the submodels’ (dotted) names (e.g. model or model.rconcmodel).
The type parameter (the main model type) only serves to allow HydPy’s Mypy plugin to determine the actual type of each condition value.
- values() ValuesView[ConditionsSubmodel[modeltools.Model]][source]¶
Return all entries.
- items() ItemsView[str, ConditionsSubmodel[modeltools.Model]][source]¶
Return all (name, entry) pairs.
- class hydpy.core.typingtools.ConditionsSubmodel(*args, **kwargs)[source]¶
Bases:
Protocol[TM_co]The values of all condition sequences of a specific model instance, accessible via the sequence groups’ names (e.g. states).
The type parameter (the model type) only serves to allow HydPy’s Mypy plugin to determine the actual type of each condition value.
- values() ValuesView[ConditionsGroup[TM_co, str]][source]¶
Return all entries.
- class hydpy.core.typingtools.CyModelProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolThe protocol of Cython extension classes for defining efficient model implementations.
Class
Cythonizergenerates the actual, model-specific implementations automatically.- parameters: CyParametersProtocol¶
- sequences: CySequencesProtocol¶
- class hydpy.core.typingtools.CySubstepModelProtocol(*args, **kwargs)[source]¶
Bases:
CyModelProtocolThe protocol of Cython extension classes for defining efficient model implementations compatible with class
SubstepModel.Class
Cythonizergenerates the actual, model-specific implementations automatically.
- class hydpy.core.typingtools.FastAccessMatrix(*args, **kwargs)[source]¶
Bases:
Protocol[T_inv]A 2-dimensional array handled by a fastaccess object.
HydPy’s Mypy plugin applies this protocol to all 2-dimensional variables. In contrast to Numpy’s type stubs, indexing with a tuple of two integers returns a scalar of the array’s value type, and indexing with a single integer returns a
FastAccessVector.
- class hydpy.core.typingtools.FastAccessTensor(*args, **kwargs)[source]¶
Bases:
Protocol[T_inv]A 3-dimensional array handled by a fastaccess object or a Cython extension class.
Indexing with a tuple of three integers returns a scalar of the array’s value type, and indexing with a single integer returns a
FastAccessMatrix.
- class hydpy.core.typingtools.FastAccessVector(*args, **kwargs)[source]¶
Bases:
Protocol[T_inv]A 1-dimensional array handled by a fastaccess object.
HydPy’s Mypy plugin applies this protocol to all 1-dimensional variables. In contrast to Numpy’s type stubs, indexing with an integer returns a scalar of the array’s value type.
- class hydpy.core.typingtools.SharableConfiguration[source]¶
Bases:
TypedDictSpecification of the configuration data that main models can share with their submodels.
- landtype_constants: parametertools.Constants | None¶
Land cover type-related constants.
- soiltype_constants: parametertools.Constants | None¶
Soil type-related constants.
- landtype_refindices: parametertools.NameParameter | None¶
Reference to a land cover type-related index parameter.
- soiltype_refindices: parametertools.NameParameter | None¶
Reference to a soil type-related index parameter.
- refweights: parametertools.Parameter | None¶
Reference to a weighting parameter (probably handling the size of some computational subunits like the area of hydrological response units).