Skip to content

Commit

Permalink
add generic suf f
Browse files Browse the repository at this point in the history
  • Loading branch information
danlessa committed May 11, 2021
1 parent 19d775c commit b8d8b50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cadCAD_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from cadCAD_tools.execution import easy_run
from cadCAD_tools.profiling import profile_run
from cadCAD_tools.profiling import profile_run
from cadCAD_tools.utils import generic_suf
17 changes: 17 additions & 0 deletions cadCAD_tools/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from .types import Signal, StateUpdate, VariableUpdate

def generic_suf(variable: str,
signal: str='') -> StateUpdate:
"""
Generate a State Update Function that assigns the signal value to the
given variable. By default, the signal has the same identifier as the
variable.
"""
if signal is '':
signal = variable
else:
pass

def suf(_1, _2, _3, _4, signals: Signal) -> VariableUpdate:
return (variable, signals[signal])
return suf

0 comments on commit b8d8b50

Please sign in to comment.