|
| 1 | +# via https://github.com/pypa/packaging/blob/22.0/packaging/_structures.py |
| 2 | +# This file is dual licensed under the terms of the Apache License, Version |
| 3 | +# 2.0, and the BSD License. See the LICENSE file in the root of this repository |
| 4 | +# for complete details. |
| 5 | + |
| 6 | + |
| 7 | +class InfinityType: |
| 8 | + def __repr__(self) -> str: |
| 9 | + return "Infinity" |
| 10 | + |
| 11 | + def __hash__(self) -> int: |
| 12 | + return hash(repr(self)) |
| 13 | + |
| 14 | + def __lt__(self, other: object) -> bool: |
| 15 | + return False |
| 16 | + |
| 17 | + def __le__(self, other: object) -> bool: |
| 18 | + return False |
| 19 | + |
| 20 | + def __eq__(self, other: object) -> bool: |
| 21 | + return isinstance(other, self.__class__) |
| 22 | + |
| 23 | + def __gt__(self, other: object) -> bool: |
| 24 | + return True |
| 25 | + |
| 26 | + def __ge__(self, other: object) -> bool: |
| 27 | + return True |
| 28 | + |
| 29 | + def __neg__(self: object) -> "NegativeInfinityType": |
| 30 | + return NegativeInfinity |
| 31 | + |
| 32 | + |
| 33 | +Infinity = InfinityType() |
| 34 | + |
| 35 | + |
| 36 | +class NegativeInfinityType: |
| 37 | + def __repr__(self) -> str: |
| 38 | + return "-Infinity" |
| 39 | + |
| 40 | + def __hash__(self) -> int: |
| 41 | + return hash(repr(self)) |
| 42 | + |
| 43 | + def __lt__(self, other: object) -> bool: |
| 44 | + return True |
| 45 | + |
| 46 | + def __le__(self, other: object) -> bool: |
| 47 | + return True |
| 48 | + |
| 49 | + def __eq__(self, other: object) -> bool: |
| 50 | + return isinstance(other, self.__class__) |
| 51 | + |
| 52 | + def __gt__(self, other: object) -> bool: |
| 53 | + return False |
| 54 | + |
| 55 | + def __ge__(self, other: object) -> bool: |
| 56 | + return False |
| 57 | + |
| 58 | + def __neg__(self: object) -> InfinityType: |
| 59 | + return Infinity |
| 60 | + |
| 61 | + |
| 62 | +NegativeInfinity = NegativeInfinityType() |
0 commit comments