diff --git a/phasmplatform/common/method.py b/phasmplatform/common/method.py index de2d198..8d4bbc8 100644 --- a/phasmplatform/common/method.py +++ b/phasmplatform/common/method.py @@ -1,4 +1,4 @@ -from typing import List +from typing import Any, List from .valuetype import ValueType @@ -14,6 +14,12 @@ class MethodArgument: self.name = name self.value_type = value_type + def __eq__(self, other: Any) -> bool: + if not isinstance(other, MethodArgument): + raise NotImplementedError + + return self.name == other.name and self.value_type == other.value_type + class Method: __slots__ = ('name', 'args', 'return_type', ) diff --git a/phasmplatform/common/valuetype.py b/phasmplatform/common/valuetype.py index 8d01684..36f544e 100644 --- a/phasmplatform/common/valuetype.py +++ b/phasmplatform/common/valuetype.py @@ -1,3 +1,6 @@ +from typing import Any + + class ValueType: __slots__ = ('name', ) @@ -6,6 +9,12 @@ class ValueType: def __init__(self, name: str) -> None: self.name = name + def __eq__(self, other: Any) -> bool: + if not isinstance(other, ValueType): + raise NotImplementedError + + return self is other + bytes = ValueType('bytes')