mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Update Distance comparison operators
remove order=True and implement the comparison operators manually to fix typing error
This commit is contained in:
parent
54745e786e
commit
795df1a93f
@ -26,7 +26,7 @@ INHG_TO_MMHG = 25.400002776728
|
|||||||
LBS_TO_KG = 0.453592
|
LBS_TO_KG = 0.453592
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, order=True)
|
@dataclass(frozen=True)
|
||||||
class Distance:
|
class Distance:
|
||||||
distance_in_meters: float
|
distance_in_meters: float
|
||||||
|
|
||||||
@ -78,6 +78,18 @@ class Distance:
|
|||||||
def __bool__(self) -> bool:
|
def __bool__(self) -> bool:
|
||||||
return not math.isclose(self.meters, 0.0)
|
return not math.isclose(self.meters, 0.0)
|
||||||
|
|
||||||
|
def __lt__(self, other: Distance) -> bool:
|
||||||
|
return self.meters < other.meters
|
||||||
|
|
||||||
|
def __le__(self, other: Distance) -> bool:
|
||||||
|
return self.meters <= other.meters
|
||||||
|
|
||||||
|
def __gt__(self, other: Distance) -> bool:
|
||||||
|
return self.meters > other.meters
|
||||||
|
|
||||||
|
def __ge__(self, other: Distance) -> bool:
|
||||||
|
return self.meters >= other.meters
|
||||||
|
|
||||||
|
|
||||||
def feet(value: float) -> Distance:
|
def feet(value: float) -> Distance:
|
||||||
return Distance.from_feet(value)
|
return Distance.from_feet(value)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user