Skip to content

Commit

Permalink
Data structure cross-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ManicJamie committed Dec 10, 2023
1 parent a114e91 commit 0500920
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion speedruncompy/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ class Datatype():
def __repr__(self) -> str:
return str(self.__dict__)

def __getitem__(self, key):
return self.__dict__[key]

def __setitem__(self, key, value):
self.__dict__[key] = value

class VariableValue(Datatype):
def __init__(self, construct:Union[tuple[str, str], dict[str, str]]) -> None:
if type(construct) is tuple:
Expand Down Expand Up @@ -44,4 +50,4 @@ def __init__(self, dict:dict[str, Any] = {}) -> None:
self.video = dict.get("video", 0)
self.comment = dict.get("comment", "")
self.date = dict.get("date", "")
self.values: list[VariableValue] = dict.get("values", [])
self.values: list[VariableValue] = VariableValue(dict.get("values", []))

0 comments on commit 0500920

Please sign in to comment.