diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-09-03 11:42:53 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-09-08 20:15:59 +0200 |
commit | 4253bf62814997bd2c985a2a72e86c260338fb4d (patch) | |
tree | 0c6a6b1f52a6fd9d354369064362cc0d2d9942c1 /mesonbuild/mesonlib.py | |
parent | 1743f636fdb67c7569711e8cabd2d7440ba265be (diff) | |
download | meson-4253bf62814997bd2c985a2a72e86c260338fb4d.zip meson-4253bf62814997bd2c985a2a72e86c260338fb4d.tar.gz meson-4253bf62814997bd2c985a2a72e86c260338fb4d.tar.bz2 |
typing: Fix code review
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 6cc3c08..f649738 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -19,7 +19,7 @@ import stat import time import platform, subprocess, operator, os, shlex, shutil, re import collections -from enum import Enum +from enum import IntEnum from functools import lru_cache, wraps from itertools import tee, filterfalse import typing as T @@ -323,32 +323,7 @@ def classify_unity_sources(compilers: T.Iterable['CompilerType'], sources: T.Ite return compsrclist -class OrderedEnum(Enum): - """ - An Enum which additionally offers homogeneous ordered comparison. - """ - def __ge__(self, other: object) -> bool: - if self.__class__ is other.__class__ and isinstance(other, OrderedEnum)and isinstance(self.value, int) and isinstance(other.value, int): - return self.value >= other.value - return NotImplemented - - def __gt__(self, other: object) -> bool: - if self.__class__ is other.__class__ and isinstance(other, OrderedEnum)and isinstance(self.value, int) and isinstance(other.value, int): - return self.value > other.value - return NotImplemented - - def __le__(self, other: object) -> bool: - if self.__class__ is other.__class__ and isinstance(other, OrderedEnum)and isinstance(self.value, int) and isinstance(other.value, int): - return self.value <= other.value - return NotImplemented - - def __lt__(self, other: object) -> bool: - if self.__class__ is other.__class__ and isinstance(other, OrderedEnum) and isinstance(self.value, int) and isinstance(other.value, int): - return self.value < other.value - return NotImplemented - - -class MachineChoice(OrderedEnum): +class MachineChoice(IntEnum): """Enum class representing one of the two abstract machine names used in most places: the build, and host, machines. @@ -1572,7 +1547,7 @@ def path_is_in_root(path: Path, root: Path, resolve: bool = False) -> bool: return False return True -class LibType(Enum): +class LibType(IntEnum): """Enumeration for library types.""" |