Beispiel #1
0
    def __eq__(self, other):
        if (isinstance(other, DynamicEnum) and
                # compare dynamic enums by name and value identity
                other.name == self.name and other.value == self.value):
            return True

        return Enum.__eq__(self, other)
Beispiel #2
0
 def __eq__(self, other):
     """Override equality for string comparison."""
     if isinstance(other, str):
         return other.upper() == self.name
     return Enum.__eq__(self, other)
 def __eq__(self, other):
     return int(self).__eq__(other) if isinstance(other, int) else Enum.__eq__(self, other)
Beispiel #4
0
 def __eq__(self, o: object) -> bool:
     if type(o) == str:
         return self.value == o
     else:
         return Enum.__eq__(o)
Beispiel #5
0
 def __eq__(self, other):
     return Enum.__eq__(self, other)
Beispiel #6
0
 def __eq__(self, other):
     # noinspection PyArgumentList
     return Enum.__eq__(self, other)
Beispiel #7
0
 def __eq__(self, other):
     return int(self).__eq__(other) if isinstance(other, int) else Enum.__eq__(self, other)