Skip to content
Snippets Groups Projects

started to seperate state and parameters, ended up doing more work on keeping private variables private

Merged Martin Högstedt requested to merge 20-separate-states-and-parameters into main
Files
27
@@ -84,19 +84,23 @@ class Demux(Module):
@@ -84,19 +84,23 @@ class Demux(Module):
def get_state(self) -> dict[str, Any]:
def get_state(self) -> dict[str, Any]:
state = super().get_state()
state = super().get_state()
state["value"] = self._value
state["value"] = self._value
state["bit_length"] = self._bit_length
return state
return state
 
def get_parameter(self) -> dict[str, Any]:
 
parameter = super().get_parameter()
 
parameter["bit_length"] = self._bit_length
 
 
return parameter
 
def set_state(self, state: dict[str, Any]) -> None:
def set_state(self, state: dict[str, Any]) -> None:
"""Set the name and value of the demux.
"""Set the name and value of the demux.
Parameters
Parameters
----------
----------
state : dict[str, Any]
state : dict[str, Any]
The state of the demux to load. Should contain the keys "value" and
The state of the demux to load. Should contain the key
"bit_length", both with values of type ``int``.
"value" of type ``int``.
"""
"""
super().set_state(state)
super().set_state(state)
self._value = state["value"]
self._value = state["value"]
self._bit_length = state["bit_length"]
Loading