lockss-pybasic 0.3.0.dev5__py3-none-any.whl → 0.3.0.dev6__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.
- lockss/pybasic/__init__.py +1 -1
- lockss/pybasic/nodeutil.py +11 -11
- {lockss_pybasic-0.3.0.dev5.dist-info → lockss_pybasic-0.3.0.dev6.dist-info}/METADATA +8 -2
- lockss_pybasic-0.3.0.dev6.dist-info/RECORD +10 -0
- lockss_pybasic-0.3.0.dev5.dist-info/RECORD +0 -10
- {lockss_pybasic-0.3.0.dev5.dist-info → lockss_pybasic-0.3.0.dev6.dist-info}/WHEEL +0 -0
- {lockss_pybasic-0.3.0.dev5.dist-info → lockss_pybasic-0.3.0.dev6.dist-info}/licenses/LICENSE +0 -0
lockss/pybasic/__init__.py
CHANGED
lockss/pybasic/nodeutil.py
CHANGED
|
@@ -128,17 +128,17 @@ class NodeSpec2(BaseNodeSpec):
|
|
|
128
128
|
description="The node's SOAP Compatibility Service REST API Port")
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
_RE_COMPACT_NODE_SPEC: Pattern[str] = re.compile(r'((?P<protocol>https?)://)?(?P<host>[^:]+)(:(?P<repository>\d+|(?=:))(:(?P<configuration>\d+|(?=:))(:(?P<poller>\d+|(?=:))(:(?P<crawler>\d+|(?=:))(:(?P<metadata>\d+|(?=:))(:(?P<soap>\d+))?)?)?)?)?)?')
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
#: A type for LOCKSS node specification strings.
|
|
135
|
-
|
|
135
|
+
CompactNodeSpec = str
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
def
|
|
139
|
-
mat: Optional[Match[str]] =
|
|
138
|
+
def _parse_compact_node_spec(compact_node_spec: CompactNodeSpec) -> dict[str, str]:
|
|
139
|
+
mat: Optional[Match[str]] = _RE_COMPACT_NODE_SPEC.fullmatch(compact_node_spec)
|
|
140
140
|
if mat is None:
|
|
141
|
-
raise ValueError(f'Invalid node specification
|
|
141
|
+
raise ValueError(f'Invalid compact node specification: {compact_node_spec}')
|
|
142
142
|
d = dict(host=mat.group('host'))
|
|
143
143
|
if prot := mat.group('protocol'):
|
|
144
144
|
d['protocol'] = prot
|
|
@@ -153,7 +153,7 @@ def _parse_node_spec_string(node_spec_string: NodeSpecStr) -> dict[str, str]:
|
|
|
153
153
|
d['type'] = NodeTypeEnum.V1.value
|
|
154
154
|
d['ui'] = repo_or_ui
|
|
155
155
|
else:
|
|
156
|
-
raise ValueError(f'Invalid repository/UI port in node specification
|
|
156
|
+
raise ValueError(f'Invalid repository/UI port in compact node specification: {repo_or_ui}')
|
|
157
157
|
else:
|
|
158
158
|
# Assume V2
|
|
159
159
|
d['type'] = NodeTypeEnum.V2.value
|
|
@@ -163,17 +163,17 @@ def _parse_node_spec_string(node_spec_string: NodeSpecStr) -> dict[str, str]:
|
|
|
163
163
|
return d
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
def
|
|
167
|
-
if isinstance(value,
|
|
168
|
-
return
|
|
166
|
+
def _maybe_deserialize_compact_node_spec(value: Any) -> Any:
|
|
167
|
+
if isinstance(value, CompactNodeSpec) and not value.startswith('{'):
|
|
168
|
+
return _parse_compact_node_spec(value)
|
|
169
169
|
return value
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
#: A type for LOCKSS node specifications, that also accepts a compact LOCKSS
|
|
173
|
-
#: node specification
|
|
173
|
+
#: node specification.
|
|
174
174
|
NodeSpec = Annotated[
|
|
175
175
|
Annotated[Union[NodeSpec1, NodeSpec2], Field(discriminator='type')],
|
|
176
|
-
BeforeValidator(
|
|
176
|
+
BeforeValidator(_maybe_deserialize_compact_node_spec)
|
|
177
177
|
]
|
|
178
178
|
|
|
179
179
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lockss-pybasic
|
|
3
|
-
Version: 0.3.0.
|
|
3
|
+
Version: 0.3.0.dev6
|
|
4
4
|
Summary: Basic Python utilities
|
|
5
5
|
License: BSD-3-Clause
|
|
6
6
|
License-File: LICENSE
|
|
@@ -26,7 +26,7 @@ Description-Content-Type: text/x-rst
|
|
|
26
26
|
lockss-pybasic
|
|
27
27
|
==============
|
|
28
28
|
|
|
29
|
-
.. |RELEASE| replace:: 0.3.0-
|
|
29
|
+
.. |RELEASE| replace:: 0.3.0-dev6
|
|
30
30
|
.. |RELEASE_DATE| replace:: NOT YET RELEASED
|
|
31
31
|
|
|
32
32
|
**Latest release:** |RELEASE| (|RELEASE_DATE|)
|
|
@@ -68,3 +68,9 @@ Release Notes
|
|
|
68
68
|
|
|
69
69
|
See `<CHANGELOG.rst>`_.
|
|
70
70
|
|
|
71
|
+
----------
|
|
72
|
+
Unit Tests
|
|
73
|
+
----------
|
|
74
|
+
|
|
75
|
+
Run ``python -m unittest discover tests`` at the root of the project tree (where there is a directory called ``tests``).
|
|
76
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
lockss/pybasic/__init__.py,sha256=CadXEjtP9aw_ojXq1X15LcxIM8jsPDp71g-wailK6vM,1678
|
|
2
|
+
lockss/pybasic/auidutil.py,sha256=Q4vjjGfymiXVwPu35RyyLZBnViv8mDJKCjOyJb-sbS8,13921
|
|
3
|
+
lockss/pybasic/cliutil.py,sha256=-o5YIh5JPDxwyZ61U9iZshsmzYwOHW-HHFa2ndFO__g,8130
|
|
4
|
+
lockss/pybasic/errorutil.py,sha256=4EaO0a1yIG1DbWltASeT15bg1bGg5kOYspsW0iJdVLc,1951
|
|
5
|
+
lockss/pybasic/fileutil.py,sha256=P_XW_UX6hVvP45vRV8fduclbGmoFflW83a6ZfFE-8Hc,2966
|
|
6
|
+
lockss/pybasic/nodeutil.py,sha256=DquB0bVdgfZHCTfu2xMZpEQ-oVzBc9ArHRiAKBOozmI,7931
|
|
7
|
+
lockss_pybasic-0.3.0.dev6.dist-info/METADATA,sha256=UjX2kivXGti545A930Ce9BDVZILZjkCRtN4Dsf-53aw,2494
|
|
8
|
+
lockss_pybasic-0.3.0.dev6.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
9
|
+
lockss_pybasic-0.3.0.dev6.dist-info/licenses/LICENSE,sha256=EOxPunNz3XP6AjgbPFolu-d9BS_AF9TtKn1WXgeYPsE,1506
|
|
10
|
+
lockss_pybasic-0.3.0.dev6.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
lockss/pybasic/__init__.py,sha256=XiPgHX6Sah_mC2zIQLn_vTG1Celb8_sl1tZoDNm7RYw,1678
|
|
2
|
-
lockss/pybasic/auidutil.py,sha256=Q4vjjGfymiXVwPu35RyyLZBnViv8mDJKCjOyJb-sbS8,13921
|
|
3
|
-
lockss/pybasic/cliutil.py,sha256=-o5YIh5JPDxwyZ61U9iZshsmzYwOHW-HHFa2ndFO__g,8130
|
|
4
|
-
lockss/pybasic/errorutil.py,sha256=4EaO0a1yIG1DbWltASeT15bg1bGg5kOYspsW0iJdVLc,1951
|
|
5
|
-
lockss/pybasic/fileutil.py,sha256=P_XW_UX6hVvP45vRV8fduclbGmoFflW83a6ZfFE-8Hc,2966
|
|
6
|
-
lockss/pybasic/nodeutil.py,sha256=5ocngBCDbeMM7aqGCM10VC314p7VZD0DUMzHrpt3e4s,7911
|
|
7
|
-
lockss_pybasic-0.3.0.dev5.dist-info/METADATA,sha256=jYuOR61q0mUYeB1I_8Uc00K_ac5oW4uavN8gXOVak7I,2338
|
|
8
|
-
lockss_pybasic-0.3.0.dev5.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
9
|
-
lockss_pybasic-0.3.0.dev5.dist-info/licenses/LICENSE,sha256=EOxPunNz3XP6AjgbPFolu-d9BS_AF9TtKn1WXgeYPsE,1506
|
|
10
|
-
lockss_pybasic-0.3.0.dev5.dist-info/RECORD,,
|
|
File without changes
|
{lockss_pybasic-0.3.0.dev5.dist-info → lockss_pybasic-0.3.0.dev6.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|