v440 2.0.0.dev66__tar.gz → 2.0.0.dev67__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.dev66/src/v440.egg-info → v440-2.0.0.dev67}/PKG-INFO +1 -1
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/pyproject.toml +1 -1
- v440-2.0.0.dev67/src/v440/_utils/releaseparse.py +52 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/Release.py +4 -4
- {v440-2.0.0.dev66 → v440-2.0.0.dev67/src/v440.egg-info}/PKG-INFO +1 -1
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440.egg-info/SOURCES.txt +1 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/LICENSE.txt +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/MANIFEST.in +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/README.rst +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/setup.cfg +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/__init__.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/BaseStringer.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/Cfg.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/Digest.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/ListStringer.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/Pattern.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/SlotStringer.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/__init__.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/cfg.toml +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/guarding.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/qualparse.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/_utils/segmenting.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/Base.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/Local.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/Public.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/Qual.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/Version.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/VersionError.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/core/__init__.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/tests/__init__.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/tests/test_testdata.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/tests/test_version.py +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440/tests/testdata.toml +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440.egg-info/dependency_links.txt +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440.egg-info/requires.txt +0 -0
- {v440-2.0.0.dev66 → v440-2.0.0.dev67}/src/v440.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import string
|
|
4
|
+
from typing import *
|
|
5
|
+
|
|
6
|
+
from v440._utils.Digest import Digest
|
|
7
|
+
from v440.core.VersionError import VersionError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def numeral(value: Any, /) -> int:
|
|
11
|
+
v: Any = segment(value)
|
|
12
|
+
if type(v) is int:
|
|
13
|
+
return v
|
|
14
|
+
e: str = "%r is not a valid numeral segment"
|
|
15
|
+
e %= v
|
|
16
|
+
raise VersionError(e)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def segment(value: Any, /) -> Any:
|
|
20
|
+
try:
|
|
21
|
+
return _segment(value)
|
|
22
|
+
except:
|
|
23
|
+
e: str = "%r is not a valid segment"
|
|
24
|
+
e = VersionError(e % value)
|
|
25
|
+
raise e from None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_segment: Digest = Digest("_segment")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@_segment.overload()
|
|
32
|
+
def _segment():
|
|
33
|
+
return
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@_segment.overload(int)
|
|
37
|
+
def _segment(value: int, /) -> Any:
|
|
38
|
+
if value < 0:
|
|
39
|
+
raise ValueError
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@_segment.overload(str)
|
|
44
|
+
def _segment(value: Any, /) -> int | str:
|
|
45
|
+
if value.strip(string.ascii_lowercase + string.digits):
|
|
46
|
+
raise ValueError(value)
|
|
47
|
+
if value.strip(string.digits):
|
|
48
|
+
return value
|
|
49
|
+
elif value == "":
|
|
50
|
+
return 0
|
|
51
|
+
else:
|
|
52
|
+
return int(value)
|
|
@@ -8,7 +8,7 @@ import setdoc
|
|
|
8
8
|
from keyalias import keyalias
|
|
9
9
|
from overloadable import Overloadable
|
|
10
10
|
|
|
11
|
-
from v440._utils import
|
|
11
|
+
from v440._utils import releaseparse
|
|
12
12
|
from v440._utils.ListStringer import ListStringer
|
|
13
13
|
|
|
14
14
|
__all__ = ["Release"]
|
|
@@ -40,7 +40,7 @@ def tolist(value: int, *, slicing: Any) -> list:
|
|
|
40
40
|
|
|
41
41
|
@tolist.overload(list)
|
|
42
42
|
def tolist(value: int, *, slicing: Any) -> list:
|
|
43
|
-
return list(map(
|
|
43
|
+
return list(map(releaseparse.numeral, value))
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
@tolist.overload(str)
|
|
@@ -63,7 +63,7 @@ def tolist(value: Any, *, slicing: Any) -> list:
|
|
|
63
63
|
l: list = v.split(".")
|
|
64
64
|
if "" in l:
|
|
65
65
|
raise ValueError
|
|
66
|
-
l = list(map(
|
|
66
|
+
l = list(map(releaseparse.numeral, l))
|
|
67
67
|
return l
|
|
68
68
|
|
|
69
69
|
|
|
@@ -200,7 +200,7 @@ class Release(ListStringer):
|
|
|
200
200
|
return 0
|
|
201
201
|
|
|
202
202
|
def _setitem_int(self: Self, key: int, value: Any) -> Any:
|
|
203
|
-
v: int =
|
|
203
|
+
v: int = releaseparse.numeral(value)
|
|
204
204
|
if key < len(self):
|
|
205
205
|
data = list(self.data)
|
|
206
206
|
data[key] = v
|
|
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
|