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 cherry-pick from 795df1a9
This commit is contained in:
parent
f63fae2d4f
commit
57ee611d06
@ -21,7 +21,7 @@ INHG_TO_HPA = 33.86389
|
||||
INHG_TO_MMHG = 25.400002776728
|
||||
|
||||
|
||||
@dataclass(frozen=True, order=True)
|
||||
@dataclass(frozen=True)
|
||||
class Distance:
|
||||
distance_in_meters: float
|
||||
|
||||
@ -73,6 +73,18 @@ class Distance:
|
||||
def __bool__(self) -> bool:
|
||||
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:
|
||||
return Distance.from_feet(value)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user