Skip to content

Commit

Permalink
add new method for typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 30, 2024
1 parent 7691d3c commit 66ef6ea
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spinnman/messages/spinnaker_boot/system_variable_boot_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ class _DataType(Enum):
LONG = (8, "<Q")
BYTE_ARRAY = (16, "s")

def __init__(self, value, struct_code):
self._value_ = value
def __new__(cls, value: int, struct_code: str) -> "_DataType" :
obj = object.__new__(cls)
obj._value_ = value
return obj

def __init__(self, value: int, struct_code: str):
self._struct_code = struct_code

@property
Expand Down Expand Up @@ -383,14 +387,14 @@ class SystemVariableBootValues(object):
"""
__slot__ = "_values",

def __init__(self):
def __init__(self) -> None:
# Create a dict of variable values
self._values = dict()
for variable in SystemVariableDefinition:
self._values[variable] = variable.default

def set_value(self, system_variable_definition: SystemVariableDefinition,
value: Any):
value: Any) -> None:
"""
Save a value to the system_variable_definition Enum as the key
Expand Down

0 comments on commit 66ef6ea

Please sign in to comment.