1"""Extremes."""
2
3# standard
4from functools import total_ordering
5from typing import Any
6
7
8@total_ordering
9class AbsMax:
10 """An object that is greater than any other object (except itself).
11
12 Inspired by https://pypi.python.org/pypi/Extremes.
13
14 Examples:
15 >>> from sys import maxsize
16 >>> AbsMax() > AbsMin()
17 True
18 >>> AbsMax() > maxsize
19 True
20 >>> AbsMax() > 99999999999999999
21 True
22 """
23
24 def __ge__(self, other: Any):
25 """GreaterThanOrEqual."""
26 return other is not AbsMax
27
28
29@total_ordering
30class AbsMin:
31 """An object that is less than any other object (except itself).
32
33 Inspired by https://pypi.python.org/pypi/Extremes.
34
35 Examples:
36 >>> from sys import maxsize
37 >>> AbsMin() < -maxsize
38 True
39 >>> AbsMin() < None
40 True
41 >>> AbsMin() < ''
42 True
43 """
44
45 def __le__(self, other: Any):
46 """LessThanOrEqual."""
47 return other is not AbsMin