v440 2.0.0.dev12__tar.gz → 2.0.0.dev13__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.dev12/src/v440.egg-info → v440-2.0.0.dev13}/PKG-INFO +1 -1
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/pyproject.toml +1 -1
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/SimpleQualifierParser.py +36 -30
- {v440-2.0.0.dev12 → v440-2.0.0.dev13/src/v440.egg-info}/PKG-INFO +1 -1
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/LICENSE.txt +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/MANIFEST.in +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/README.rst +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/setup.cfg +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/__init__.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/Digest.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/Pattern.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/VList.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/WList.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/__init__.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/_utils/utils.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Base.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Local.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Pre.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Public.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Qualification.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Release.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/Version.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/VersionError.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/core/__init__.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/tests/__init__.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/tests/test_testdata.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/tests/test_version.py +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440/tests/testdata.toml +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440.egg-info/SOURCES.txt +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440.egg-info/dependency_links.txt +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440.egg-info/requires.txt +0 -0
- {v440-2.0.0.dev12 → v440-2.0.0.dev13}/src/v440.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import dataclasses
|
|
4
3
|
from typing import *
|
|
5
4
|
|
|
6
5
|
from v440._utils import utils
|
|
@@ -10,11 +9,8 @@ from v440._utils.Pattern import Pattern
|
|
|
10
9
|
__all__ = ["SimpleQualifierParser"]
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
@dataclasses.dataclass(frozen=True)
|
|
14
12
|
class SimpleQualifierParser:
|
|
15
|
-
|
|
16
|
-
keysforstr: tuple = ()
|
|
17
|
-
allow_len_1: bool = False
|
|
13
|
+
__slots__ = ("_keysforlist", "_keysforstr", "_allow_len_1")
|
|
18
14
|
|
|
19
15
|
__call__ = Digest("__call__")
|
|
20
16
|
|
|
@@ -31,7 +27,7 @@ class SimpleQualifierParser:
|
|
|
31
27
|
@__call__.overload(list)
|
|
32
28
|
def __call__(self: Self, value: list) -> Any:
|
|
33
29
|
v: list = list(map(utils.segment, value))
|
|
34
|
-
n = self.nbylist(v)
|
|
30
|
+
n: Any = self.nbylist(v)
|
|
35
31
|
if isinstance(n, str):
|
|
36
32
|
raise TypeError
|
|
37
33
|
return n
|
|
@@ -50,41 +46,51 @@ class SimpleQualifierParser:
|
|
|
50
46
|
else:
|
|
51
47
|
return int(n)
|
|
52
48
|
|
|
53
|
-
def
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
def __init__(
|
|
50
|
+
self: Self,
|
|
51
|
+
keysforlist: Iterable = (),
|
|
52
|
+
keysforstr: Iterable = (),
|
|
53
|
+
allow_len_1: Any = False,
|
|
54
|
+
) -> None:
|
|
55
|
+
self._keysforlist = tuple(map(str, keysforlist))
|
|
56
|
+
self._keysforstr = tuple(map(self.optstr, keysforstr))
|
|
57
|
+
self._allow_len_1 = bool(allow_len_1)
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def allow_len_1(self: Self) -> tuple:
|
|
61
|
+
return self._allow_len_1
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def keysforlist(self: Self) -> tuple:
|
|
65
|
+
return self._keysforlist
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def keysforstr(self: Self) -> tuple:
|
|
69
|
+
return self._keysforstr
|
|
67
70
|
|
|
68
71
|
def nbylist(self: Self, value: Any, /) -> Any:
|
|
69
72
|
if len(value) == 2:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
raise ValueError
|
|
73
|
-
return n
|
|
73
|
+
if value[0] in self.keysforlist:
|
|
74
|
+
return value[1]
|
|
74
75
|
if len(value) == 1:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
raise ValueError
|
|
78
|
-
return n
|
|
76
|
+
if self.allow_len_1:
|
|
77
|
+
return value[0]
|
|
79
78
|
raise ValueError
|
|
80
79
|
|
|
80
|
+
@classmethod
|
|
81
|
+
def optstr(cls: type, value: Any) -> Optional[str]:
|
|
82
|
+
if value is None:
|
|
83
|
+
return
|
|
84
|
+
else:
|
|
85
|
+
return str(value)
|
|
86
|
+
|
|
81
87
|
|
|
82
|
-
POST = SimpleQualifierParser(
|
|
88
|
+
POST: SimpleQualifierParser = SimpleQualifierParser(
|
|
83
89
|
keysforlist=("post", "rev", "r", ""),
|
|
84
90
|
keysforstr=(None, "post", "rev", "r"),
|
|
85
91
|
allow_len_1=True,
|
|
86
92
|
)
|
|
87
|
-
DEV = SimpleQualifierParser(
|
|
93
|
+
DEV: SimpleQualifierParser = SimpleQualifierParser(
|
|
88
94
|
keysforlist=("dev",),
|
|
89
95
|
keysforstr=(None, "dev"),
|
|
90
96
|
)
|
|
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
|