Enable creating custom methods
This commit is contained in:
@@ -10,6 +10,7 @@ class Type(Enum):
|
||||
LIST = (list, lambda x: f"[{', '.join([e.stringify() for e in x])}]")
|
||||
PERCENT = (float, lambda x: f"{int(x * 100)}%")
|
||||
NOTE = (Note, lambda x: x.note.name)
|
||||
TYPE = (None, lambda x: str(x.type.name.lower()))
|
||||
VOID = (type(None), lambda x: _failStringify(Type.VOID))
|
||||
|
||||
def stringify(self, element):
|
||||
|
||||
@@ -5,7 +5,7 @@ class Value:
|
||||
def __init__(self, objectType, value):
|
||||
self.value = value
|
||||
|
||||
if type(value) == objectType.value[0]:
|
||||
if objectType.value[0] is None or type(value) == objectType.value[0]:
|
||||
self.type = objectType
|
||||
|
||||
elif type(value) == Value:
|
||||
|
||||
Reference in New Issue
Block a user