Skip to content

Typing

typing

Custom Typing Helpers.

This module centralizes type aliases used throughout the project and makes it easy to keep runtime imports lightweight while still providing precise type information. The goal is to express common shapes and dtypes once, so internal modules can share consistent, readable annotations without repeating NumPy typing boilerplate.

Examples:

>>> from flepimop2.typing import Float64NDArray
>>> Float64NDArray
numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]

Float64NDArray = npt.NDArray[np.float64] module-attribute

Alias for a NumPy ndarray with float64 data type.

RaiseOnMissing = RaiseOnMissingType() module-attribute

Sentinel value indicating an error should be raised if a value is missing.

RaiseOnMissingType

A sentinel type indicating an error should be raised if a value is missing.

__reduce__()

Helper for pickling the RaiseOnMissingType singleton.

Returns:

Type Description
Literal['RaiseOnMissing']

The string "RaiseOnMissing".

Source code in src/flepimop2/typing.py
42
43
44
45
46
47
48
49
def __reduce__(self) -> Literal["RaiseOnMissing"]:
    """
    Helper for pickling the `RaiseOnMissingType` singleton.

    Returns:
        The string "RaiseOnMissing".
    """
    return "RaiseOnMissing"

__repr__()

String representation of the RaiseOnMissingType.

Returns:

Type Description
Literal['RaiseOnMissing']

The string "RaiseOnMissing".

Source code in src/flepimop2/typing.py
33
34
35
36
37
38
39
40
def __repr__(self) -> Literal["RaiseOnMissing"]:
    """
    String representation of the `RaiseOnMissingType`.

    Returns:
        The string "RaiseOnMissing".
    """
    return "RaiseOnMissing"

StateChangeEnum

Bases: StrEnum

Enumeration of types of state changes in a system.

Examples:

>>> from flepimop2.typing import StateChangeEnum
>>> StateChangeEnum.DELTA
<StateChangeEnum.DELTA: 'delta'>
>>> StateChangeEnum.FLOW
<StateChangeEnum.FLOW: 'flow'>

DELTA = 'delta' class-attribute instance-attribute

The state change is described directly by the changes in the state variables, i.e. \( x(t + \Delta t) = x(t) + \Delta x \).

FLOW = 'flow' class-attribute instance-attribute

The state change is described directly by the flow rates, or derivatives, of the state variables. I.e. \( dx/dt = f(x, t) \).

STATE = 'state' class-attribute instance-attribute

The state change is described directly by the new state values, i.e. \( x(t + \Delta t) = x_{new} \).