__eq__ operators
This commit is contained in:
parent
bb9ac649bf
commit
8c5a2893d6
@ -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', )
|
||||
|
||||
@ -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')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user