cmp3 0.0.0.dev1__py3-none-any.whl → 0.1.0.dev0__py3-none-any.whl

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/__init__.py CHANGED
@@ -1,5 +1,2 @@
1
1
  from cmp3.core import *
2
2
  from cmp3.tests import *
3
-
4
- if __name__ == "__main__":
5
- main()
cmp3/core/__init__.py CHANGED
@@ -1,8 +1,56 @@
1
+ from functools import partial
1
2
  from typing import *
2
3
 
3
- __all__ = ["main"]
4
+ import setdoc
4
5
 
6
+ __all__ = ["Comparable", "comparable"]
5
7
 
6
- def main(args: Optional[Iterable] = None) -> None:
7
- "This function prints 'Hello World!'."
8
- print("Hello World!")
8
+
9
+ def comparable(*, overwrite: Any = False) -> type:
10
+ return partial(update, overwrite=overwrite)
11
+
12
+
13
+ def update(cls: type, /, *, overwrite: Any = False) -> type:
14
+ @setdoc.basic
15
+ def __eq__(self: Self, other: Any) -> bool:
16
+ return self.__cmp__(other) == 0
17
+
18
+ @setdoc.basic
19
+ def __ge__(self: Self, other: Any) -> bool:
20
+ return self.__cmp__(other) >= 0
21
+
22
+ @setdoc.basic
23
+ def __gt__(self: Self, other: Any) -> bool:
24
+ return self.__cmp__(other) > 0
25
+
26
+ @setdoc.basic
27
+ def __le__(self: Self, other: Any) -> bool:
28
+ return self.__cmp__(other) <= 0
29
+
30
+ @setdoc.basic
31
+ def __lt__(self: Self, other: Any) -> bool:
32
+ return self.__cmp__(other) < 0
33
+
34
+ @setdoc.basic
35
+ def __ne__(self: Self, other: Any) -> bool:
36
+ return self.__cmp__(other) != 0
37
+
38
+ func: Callable
39
+ funcs: list[Callable]
40
+ funcs = [
41
+ __eq__,
42
+ __ge__,
43
+ __gt__,
44
+ __le__,
45
+ __lt__,
46
+ __ne__,
47
+ ]
48
+ for func in funcs:
49
+ if overwrite or not hasattr(cls, func.__name__):
50
+ setattr(cls, func.__name__, func)
51
+ return cls
52
+
53
+
54
+ @comparable()
55
+ class Comparable:
56
+ __slots__ = ()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmp3
3
- Version: 0.0.0.dev1
3
+ Version: 0.1.0.dev0
4
4
  Summary: This project updates the concept of __cmp__ for python3.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -28,7 +28,7 @@ Project-URL: Download, https://pypi.org/project/cmp3/#files
28
28
  Project-URL: Index, https://pypi.org/project/cmp3/
29
29
  Project-URL: Source, https://github.com/johannes-programming/cmp3/
30
30
  Project-URL: Website, https://cmp3.johannes-programming.online/
31
- Classifier: Development Status :: 2 - Pre-Alpha
31
+ Classifier: Development Status :: 3 - Alpha
32
32
  Classifier: License :: OSI Approved :: MIT License
33
33
  Classifier: Natural Language :: English
34
34
  Classifier: Operating System :: OS Independent
@@ -39,6 +39,7 @@ Classifier: Typing :: Typed
39
39
  Requires-Python: >=3.11
40
40
  Description-Content-Type: text/x-rst
41
41
  License-File: LICENSE.txt
42
+ Requires-Dist: setdoc<2,>=1.2.6
42
43
  Dynamic: license-file
43
44
 
44
45
  ====
@@ -0,0 +1,9 @@
1
+ cmp3/__init__.py,sha256=hxvwX8wZhft-DkMAoU3xz65RMZib8nPQQiAbxba27iQ,49
2
+ cmp3/core/__init__.py,sha256=aY7ruot8E7kZ9FJsmyF2YqeFhtveyz62rDJlaV0rMQ0,1265
3
+ cmp3/tests/__init__.py,sha256=5HDIgWBNxEoojOZBRHiCjGK-RX_fpSxXZ2bM7KEFgWs,383
4
+ cmp3/tests/test_1984.py,sha256=_ami0cAP8vU0C8RpQhP1tLWnLFGTaeHlOG5O60RVKv8,222
5
+ cmp3-0.1.0.dev0.dist-info/licenses/LICENSE.txt,sha256=Jb9jm2E2hEO2LqnWwHeHt4cneyCbnZ1SBte0bgb9qoY,1074
6
+ cmp3-0.1.0.dev0.dist-info/METADATA,sha256=6oahi4Z86YZCynYV4hZDVU0vPtY8aYjtXs9gKjj272U,2305
7
+ cmp3-0.1.0.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ cmp3-0.1.0.dev0.dist-info/top_level.txt,sha256=FzJWsf0Xj_eeRJuFle30ZFjVZs8ahy7oLhYdWx8YkgA,5
9
+ cmp3-0.1.0.dev0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- cmp3/__init__.py,sha256=zkxm2qU9kA37RhIrKHPIZUnJlo-I7V4uVKyy8mNFbsY,88
2
- cmp3/core/__init__.py,sha256=Tr3CwIPY695IbF4DrKHrDes1AKd_iJgddUP46jxKHSw,163
3
- cmp3/tests/__init__.py,sha256=5HDIgWBNxEoojOZBRHiCjGK-RX_fpSxXZ2bM7KEFgWs,383
4
- cmp3/tests/test_1984.py,sha256=_ami0cAP8vU0C8RpQhP1tLWnLFGTaeHlOG5O60RVKv8,222
5
- cmp3-0.0.0.dev1.dist-info/licenses/LICENSE.txt,sha256=Jb9jm2E2hEO2LqnWwHeHt4cneyCbnZ1SBte0bgb9qoY,1074
6
- cmp3-0.0.0.dev1.dist-info/METADATA,sha256=rjtleRsnBp-i8xNcRDCO9CsrumvPDh8DNMeNPa79VCY,2277
7
- cmp3-0.0.0.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- cmp3-0.0.0.dev1.dist-info/top_level.txt,sha256=FzJWsf0Xj_eeRJuFle30ZFjVZs8ahy7oLhYdWx8YkgA,5
9
- cmp3-0.0.0.dev1.dist-info/RECORD,,