mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +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
|
||||
|
||||
|
||||
@dataclass(frozen=True, order=True)
|
||||
@dataclass(frozen=True)
|
||||
class Distance:
|
||||
distance_in_meters: float
|
||||
|
||||
@ -78,6 +78,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