55
66import numpy
77
8- from openfisca_core .types import ArrayType , Encodable
8+ from openfisca_core .types import ArrayType , SupportsEncode
99
1010from .. import indexed_enums as enums
1111from .enum_array import EnumArray
1212
1313A = Union [
1414 EnumArray ,
15- ArrayType [Encodable ],
15+ ArrayType [SupportsEncode ],
1616 ArrayType [bytes ],
1717 ArrayType [int ],
1818 ArrayType [str ],
@@ -133,6 +133,18 @@ def __repr__(self) -> str:
133133 def __str__ (self ) -> str :
134134 return f"{ self .__class__ .__name__ } .{ self .name } "
135135
136+ def __eq__ (self , other : object ) -> bool :
137+ if not isinstance (other , Enum ):
138+ return NotImplemented
139+
140+ return self .index == other .index
141+
142+ def __ne__ (self , other : object ) -> bool :
143+ if not isinstance (other , Enum ):
144+ return NotImplemented
145+
146+ return self .index != other .index
147+
136148 def __lt__ (self , other : object ) -> bool :
137149 if not isinstance (other , Enum ):
138150 return NotImplemented
@@ -157,9 +169,6 @@ def __ge__(self, other: object) -> bool:
157169
158170 return self .index >= other .index
159171
160- __eq__ = object .__eq__
161- """Bypass the slow :meth:`~enum.Enum.__eq__`."""
162-
163172 __hash__ = object .__hash__
164173 """:meth:`.__hash__` must also be defined as so to stay hashable."""
165174
0 commit comments