Skip to content

Commit

Permalink
src/sim_explorer/utils/types.py : cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaasRostock committed Jan 30, 2025
1 parent 1f6f39f commit 840f6b0
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions src/sim_explorer/utils/types.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
from collections.abc import Callable, Mapping, Sequence
from collections.abc import Sequence
from typing import (
TypeAlias,
)

# ===== Arguments (Variables) =====================================================================
TNumeric: TypeAlias = int | float
TValue: TypeAlias = (
int | float | bool | str # | Sequence[int | float | bool | str]
) # single (scalar) value, as e.g. also serialized to/from Json5 atom
TValue: TypeAlias = int | float | bool | str # single (scalar) value, as e.g. also serialized to/from Json5 atom
TTimeColumn: TypeAlias = list[int] | list[float] # X column, but limited to numeric types. Typically indicating time.
TDataColumn: TypeAlias = list[int] | list[float] | list[bool] # | list[str] # X column
TDataRow: TypeAlias = Sequence[TValue | Sequence[TValue]] # | TNumeric # X row without variable names (just values)
TDataTable: TypeAlias = Sequence[TDataRow] # X table
TArguments: TypeAlias = Mapping[str, TValue] # X row with variable names
TArgs: TypeAlias = dict[str, TValue]
# TArguments: TypeAlias = Mapping[str, TValue] # X row with variable names # noqa: ERA001
# TArgs: TypeAlias = dict[str, TValue] # noqa: ERA001


# ===== System Interface =====================================================================
Expand All @@ -23,22 +21,3 @@
TSetActionArgs: TypeAlias = tuple[str, str, tuple[int, ...], tuple[TValue, ...]]
#: Arguments for action functions
TActionArgs: TypeAlias = TGetActionArgs | TSetActionArgs

#: Function signature for action functions
TActionFunc: TypeAlias = Callable[[int | float, TActionArgs, type], bool]
#: Function signature for action step functions
TActionStepFunc: TypeAlias = Callable[[TActionArgs, type], Callable[..., TValue]]

#: Function signature for initial action functions
TInitialActionFunc: TypeAlias = Callable[[int | float, TSetActionArgs], bool]
#: Function signature for initial action functions
TInitialActionStepFunc: TypeAlias = Callable[[TSetActionArgs], Callable[..., TValue]]

#: Function signature for get action functions
TGetActionFunc: TypeAlias = Callable[[TGetActionArgs], TValue]
#: Function signature for set action functions
TSetActionFunc: TypeAlias = Callable[[TSetActionArgs], bool]
#: Function signature for get action step functions
TGetActionStepFunc: TypeAlias = Callable[[TGetActionArgs], Callable[..., TValue]]
#: Function signature for set action step functions
TSetActionStepFunc: TypeAlias = Callable[[TSetActionArgs], Callable[..., TValue]]

0 comments on commit 840f6b0

Please sign in to comment.