cmp3 0.5.1__tar.gz → 0.6.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmp3
3
- Version: 0.5.1
3
+ Version: 0.6.1
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)
@@ -26,7 +26,7 @@ keywords = []
26
26
  name = "cmp3"
27
27
  readme = "README.rst"
28
28
  requires-python = ">=3.11"
29
- version = "0.5.1"
29
+ version = "0.6.1"
30
30
 
31
31
  [project.license]
32
32
  file = "LICENSE.txt"
@@ -3,7 +3,22 @@ from typing import *
3
3
 
4
4
  import setdoc
5
5
 
6
- __all__ = ["CmpABC", "cmpDeco"]
6
+ __all__ = ["CmpABC", "cmp", "cmpDeco"]
7
+
8
+
9
+ def cmp(x: Any, y: Any, /, *, mode: str = "portingguide") -> int:
10
+ "This function returns a value that compares to 0 as x compares to y."
11
+ if mode == "portingguide":
12
+ return (x > y) - (x < y)
13
+ if mode == "poset":
14
+ if (x <= y) and (y <= x):
15
+ return 0
16
+ if (x <= y) and (not y <= x):
17
+ return -1
18
+ if (not x <= y) and (y <= x):
19
+ return 1
20
+ return float("nan")
21
+ raise ValueError
7
22
 
8
23
 
9
24
  def cmpDeco(cls: type, /) -> type:
@@ -50,7 +65,7 @@ def cmpDeco(cls: type, /) -> type:
50
65
  except AttributeError:
51
66
  pass
52
67
  try:
53
- func.__qualname__ = cls.__qualname__
68
+ func.__qualname__ = f"{cls.__qualname__}.{func.__name__}"
54
69
  except AttributeError:
55
70
  pass
56
71
  return cls
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmp3
3
- Version: 0.5.1
3
+ Version: 0.6.1
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)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes