slither.utils.comparable_enum

 1from enum import Enum
 2
 3# pylint: disable=comparison-with-callable
 4from typing import Any
 5
 6
 7class ComparableEnum(Enum):
 8    def __eq__(self, other: Any) -> bool:
 9        if isinstance(other, ComparableEnum):
10            return self.value == other.value
11        return False
12
13    def __ne__(self, other: Any) -> bool:
14        if isinstance(other, ComparableEnum):
15            return self.value != other.value
16        return False
17
18    def __lt__(self, other: Any) -> bool:
19        if isinstance(other, ComparableEnum):
20            return self.value < other.value
21        return False
22
23    def __repr__(self) -> str:
24        return f"{str(self.value)}"
25
26    def __hash__(self) -> int:
27        return hash(self.value)
class ComparableEnum(enum.Enum):
 8class ComparableEnum(Enum):
 9    def __eq__(self, other: Any) -> bool:
10        if isinstance(other, ComparableEnum):
11            return self.value == other.value
12        return False
13
14    def __ne__(self, other: Any) -> bool:
15        if isinstance(other, ComparableEnum):
16            return self.value != other.value
17        return False
18
19    def __lt__(self, other: Any) -> bool:
20        if isinstance(other, ComparableEnum):
21            return self.value < other.value
22        return False
23
24    def __repr__(self) -> str:
25        return f"{str(self.value)}"
26
27    def __hash__(self) -> int:
28        return hash(self.value)

An enumeration.

Inherited Members
enum.Enum
name
value