@@ 105-114 (lines=10) @@ | ||
102 | return self_index > other_index |
|
103 | raise TypeError |
|
104 | ||
105 | def __ge__(self, other: tuple) -> bool: |
|
106 | if other.__class__ is self.__class__: |
|
107 | return unpack(self) >= unpack(other) |
|
108 | self_base = sum_base(self) |
|
109 | if sum_base(other) is self_base and self_base is not None: |
|
110 | order = SUBCLASS_ORDER[self_base] |
|
111 | self_index = order.index(self.__class__) |
|
112 | other_index = order.index(other.__class__) |
|
113 | return self_index >= other_index |
|
114 | raise TypeError |
|
115 | ||
116 | ||
117 | __all__ = ["PrewrittenProductMethods", "PrewrittenSumMethods"] |
|
@@ 94-103 (lines=10) @@ | ||
91 | return self_index <= other_index |
|
92 | raise TypeError |
|
93 | ||
94 | def __gt__(self, other: tuple) -> bool: |
|
95 | if other.__class__ is self.__class__: |
|
96 | return unpack(self) > unpack(other) |
|
97 | self_base = sum_base(self) |
|
98 | if sum_base(other) is self_base and self_base is not None: |
|
99 | order = SUBCLASS_ORDER[self_base] |
|
100 | self_index = order.index(self.__class__) |
|
101 | other_index = order.index(other.__class__) |
|
102 | return self_index > other_index |
|
103 | raise TypeError |
|
104 | ||
105 | def __ge__(self, other: tuple) -> bool: |
|
106 | if other.__class__ is self.__class__: |
|
@@ 83-92 (lines=10) @@ | ||
80 | return self_index < other_index |
|
81 | raise TypeError |
|
82 | ||
83 | def __le__(self, other: tuple) -> bool: |
|
84 | if other.__class__ is self.__class__: |
|
85 | return unpack(self) <= unpack(other) |
|
86 | self_base = sum_base(self) |
|
87 | if sum_base(other) is self_base and self_base is not None: |
|
88 | order = SUBCLASS_ORDER[self_base] |
|
89 | self_index = order.index(self.__class__) |
|
90 | other_index = order.index(other.__class__) |
|
91 | return self_index <= other_index |
|
92 | raise TypeError |
|
93 | ||
94 | def __gt__(self, other: tuple) -> bool: |
|
95 | if other.__class__ is self.__class__: |
|
@@ 72-81 (lines=10) @@ | ||
69 | def __init_subclass__(cls, **kwargs: typing.Any) -> None: |
|
70 | raise TypeError(f"Cannot further subclass the class {cls.__name__}") |
|
71 | ||
72 | def __lt__(self, other: tuple) -> bool: |
|
73 | if other.__class__ is self.__class__: |
|
74 | return unpack(self) < unpack(other) |
|
75 | self_base = sum_base(self) |
|
76 | if sum_base(other) is self_base and self_base is not None: |
|
77 | order = SUBCLASS_ORDER[self_base] |
|
78 | self_index = order.index(self.__class__) |
|
79 | other_index = order.index(other.__class__) |
|
80 | return self_index < other_index |
|
81 | raise TypeError |
|
82 | ||
83 | def __le__(self, other: tuple) -> bool: |
|
84 | if other.__class__ is self.__class__: |