v440 2.0.0.dev181__tar.gz → 2.0.0.dev182__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.
- {v440-2.0.0.dev181/src/v440.egg-info → v440-2.0.0.dev182}/PKG-INFO +1 -1
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/pyproject.toml +1 -1
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/BaseStringer.py +3 -3
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/Release.py +15 -10
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/tests/test_testdata.py +2 -2
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/tests/test_version.py +4 -2
- {v440-2.0.0.dev181 → v440-2.0.0.dev182/src/v440.egg-info}/PKG-INFO +1 -1
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/LICENSE.txt +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/MANIFEST.in +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/README.rst +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/setup.cfg +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/__init__.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/Cfg.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/ListStringer.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/Pattern.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/SlotStringer.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/__init__.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/cfg.toml +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/guarding.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/releaseparse/__init__.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/releaseparse/deleting.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/releaseparse/getting.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/releaseparse/ranging.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/_utils/releaseparse/setting.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/Base.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/Local.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/Public.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/Qual.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/Version.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/VersionError.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/core/__init__.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/tests/__init__.py +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440/tests/testdata.toml +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440.egg-info/SOURCES.txt +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440.egg-info/dependency_links.txt +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440.egg-info/requires.txt +0 -0
- {v440-2.0.0.dev181 → v440-2.0.0.dev182}/src/v440.egg-info/top_level.txt +0 -0
|
@@ -29,9 +29,9 @@ class BaseStringer(metaclass=ABCMeta):
|
|
|
29
29
|
try:
|
|
30
30
|
return self._format(str(format_spec))
|
|
31
31
|
except Exception:
|
|
32
|
-
msg: str = "
|
|
33
|
-
msg %= type(self).__name__
|
|
34
|
-
raise TypeError(msg)
|
|
32
|
+
msg: str = "Invalid format specifier %r for object of type %r"
|
|
33
|
+
msg %= (format_spec, type(self).__name__)
|
|
34
|
+
raise TypeError(msg) from None
|
|
35
35
|
|
|
36
36
|
@setdoc.basic
|
|
37
37
|
def __ge__(self: Self, other: Any) -> bool:
|
|
@@ -89,18 +89,23 @@ class Release(ListStringer):
|
|
|
89
89
|
return v
|
|
90
90
|
|
|
91
91
|
def _format(self: Self, format_spec: str) -> str:
|
|
92
|
-
i:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
else:
|
|
96
|
-
i = None
|
|
97
|
-
l: list = self[:i]
|
|
98
|
-
if len(l) == 0:
|
|
99
|
-
l += [0]
|
|
100
|
-
l = list(map(str, l))
|
|
101
|
-
ans: str = ".".join(l)
|
|
92
|
+
i: int = self._format_r(format_spec)
|
|
93
|
+
i = max(i, 1, len(self))
|
|
94
|
+
ans: str = ".".join(map(str, self[:i]))
|
|
102
95
|
return ans
|
|
103
96
|
|
|
97
|
+
@classmethod
|
|
98
|
+
def _format_r(cls: type, format_spec: str) -> Optional[int]:
|
|
99
|
+
if format_spec == "":
|
|
100
|
+
return 0
|
|
101
|
+
if not format_spec.startswith("0"):
|
|
102
|
+
raise ValueError
|
|
103
|
+
if not format_spec.endswith("r"):
|
|
104
|
+
raise ValueError
|
|
105
|
+
if set(format_spec[:-1]) <= set("0123456789"):
|
|
106
|
+
return int(format_spec[:-1])
|
|
107
|
+
raise ValueError
|
|
108
|
+
|
|
104
109
|
def _init_setup(self: Self) -> None:
|
|
105
110
|
self._data = ()
|
|
106
111
|
|
|
@@ -264,8 +264,8 @@ class TestPackagingA(unittest.TestCase):
|
|
|
264
264
|
def go(self: Self, text: str) -> None:
|
|
265
265
|
a: packaging.version.Version = packaging.version.Version(text)
|
|
266
266
|
b: str = str(a)
|
|
267
|
-
f:
|
|
268
|
-
g: str = format(Version(text),
|
|
267
|
+
f: str = "0%sr" % len(a.release)
|
|
268
|
+
g: str = format(Version(text), f)
|
|
269
269
|
self.assertEqual(b, g)
|
|
270
270
|
|
|
271
271
|
|
|
@@ -93,7 +93,7 @@ class TestExample(unittest.TestCase):
|
|
|
93
93
|
def test_example_1(self: Self) -> None:
|
|
94
94
|
v: Version = Version("v1.0.0")
|
|
95
95
|
self.assertEqual(str(v), "1") # Initial version
|
|
96
|
-
self.assertEqual(format(v, "
|
|
96
|
+
self.assertEqual(format(v, "03r"), "1.0.0") # Initial version formatted
|
|
97
97
|
|
|
98
98
|
def test_example_2(self: Self) -> None:
|
|
99
99
|
v: Version = Version("2.5.3")
|
|
@@ -192,7 +192,9 @@ class TestExample(unittest.TestCase):
|
|
|
192
192
|
v.public.qual.post = 1
|
|
193
193
|
v.local.string = "local.7.dev"
|
|
194
194
|
self.assertEqual(str(v), "1.2.3.post1+local.7.dev") # Post-release version
|
|
195
|
-
self.assertEqual(
|
|
195
|
+
self.assertEqual(
|
|
196
|
+
format(v, "02r"), "1.2.3.post1+local.7.dev"
|
|
197
|
+
) # Formatted version
|
|
196
198
|
v.public.qual.post = 2
|
|
197
199
|
self.assertEqual(str(v), "1.2.3.post2+local.7.dev") # Modified version
|
|
198
200
|
v.public.qual.post = None
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|