Skip to content

Commit

Permalink
Add Type Hints for cadCAD objects (#313)
Browse files Browse the repository at this point in the history
* add types.py
  • Loading branch information
danlessa authored Dec 14, 2023
1 parent b9d2918 commit 0a291e8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cadCAD/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import TypedDict, Callable, Union, Dict, List, Tuple

State = Dict[str, object]
Parameters = Dict[str, object]
Substep = int
StateHistory = List[List[State]]
PolicyOutput = Dict[str, object]
StateVariable = object

PolicyFunction = Callable[[Parameters, Substep, StateHistory, State], PolicyOutput]
StateUpdateFunction = Callable[[Parameters, Substep, StateHistory, State, PolicyOutput], Tuple[str, StateVariable]]

class StateUpdateBlock(TypedDict):
policies: Dict[str, PolicyFunction]
variables: Dict[str, StateUpdateFunction]


StateUpdateBlocks = List[StateUpdateBlock]

0 comments on commit 0a291e8

Please sign in to comment.