cmp3 0.3.1__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cmp3-0.3.1/src/cmp3.egg-info → cmp3-0.5.0}/PKG-INFO +1 -1
- {cmp3-0.3.1 → cmp3-0.5.0}/pyproject.toml +1 -1
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3/core/__init__.py +8 -14
- {cmp3-0.3.1 → cmp3-0.5.0/src/cmp3.egg-info}/PKG-INFO +1 -1
- {cmp3-0.3.1 → cmp3-0.5.0}/LICENSE.txt +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/MANIFEST.in +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/README.rst +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/setup.cfg +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3/__init__.py +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3/tests/__init__.py +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3/tests/test_1984.py +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3.egg-info/SOURCES.txt +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3.egg-info/dependency_links.txt +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3.egg-info/requires.txt +0 -0
- {cmp3-0.3.1 → cmp3-0.5.0}/src/cmp3.egg-info/top_level.txt +0 -0
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from functools import partial
|
|
3
2
|
from typing import *
|
|
4
3
|
|
|
5
4
|
import setdoc
|
|
6
5
|
|
|
7
|
-
__all__ = ["
|
|
6
|
+
__all__ = ["CmpABC", "cmpDeco"]
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
def
|
|
11
|
-
"This
|
|
12
|
-
return partial(update_rich_cmp, overwrites=overwrites)
|
|
9
|
+
def cmpDeco(cls: type, /) -> type:
|
|
10
|
+
"This decorator enforces the use of __cmp__ upon a class."
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
def update_rich_cmp(cls: type, /, *, overwrites: Any = False) -> type:
|
|
16
12
|
@setdoc.basic
|
|
17
13
|
def __eq__(self: Self, other: Any) -> Any:
|
|
18
14
|
return self.__cmp__(other).__eq__(0)
|
|
@@ -38,18 +34,16 @@ def update_rich_cmp(cls: type, /, *, overwrites: Any = False) -> type:
|
|
|
38
34
|
return self.__cmp__(other).__ne__(0)
|
|
39
35
|
|
|
40
36
|
func: Callable
|
|
41
|
-
funcs:
|
|
42
|
-
funcs =
|
|
37
|
+
funcs: tuple[Callable, ...]
|
|
38
|
+
funcs = (
|
|
43
39
|
__eq__,
|
|
44
40
|
__ge__,
|
|
45
41
|
__gt__,
|
|
46
42
|
__le__,
|
|
47
43
|
__lt__,
|
|
48
44
|
__ne__,
|
|
49
|
-
|
|
45
|
+
)
|
|
50
46
|
for func in funcs:
|
|
51
|
-
if hasattr(cls, func.__name__) and not overwrites:
|
|
52
|
-
continue
|
|
53
47
|
setattr(cls, func.__name__, func)
|
|
54
48
|
try:
|
|
55
49
|
func.__module__ = cls.__module__
|
|
@@ -62,8 +56,8 @@ def update_rich_cmp(cls: type, /, *, overwrites: Any = False) -> type:
|
|
|
62
56
|
return cls
|
|
63
57
|
|
|
64
58
|
|
|
65
|
-
@comparable
|
|
66
|
-
class
|
|
59
|
+
@comparable
|
|
60
|
+
class CmpABC(ABC):
|
|
67
61
|
__slots__ = ()
|
|
68
62
|
|
|
69
63
|
@abstractmethod
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|