PySerials 0.0.0.dev26__tar.gz → 0.0.0.dev27__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.
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/PKG-INFO +3 -3
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/pyproject.toml +3 -3
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/PySerials.egg-info/PKG-INFO +3 -3
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/PySerials.egg-info/requires.txt +2 -2
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/nested_dict.py +19 -1
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/update.py +10 -4
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/README.md +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/setup.cfg +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/PySerials.egg-info/SOURCES.txt +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/PySerials.egg-info/dependency_links.txt +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/PySerials.egg-info/not-zip-safe +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/PySerials.egg-info/top_level.txt +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/__init__.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/compare.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/exception/__init__.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/exception/_base.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/exception/read.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/exception/update.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/exception/validate.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/format.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/read.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/validate.py +0 -0
- {pyserials-0.0.0.dev26 → pyserials-0.0.0.dev27}/src/pyserials/write.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PySerials
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev27
|
|
4
4
|
Requires-Python: >=3.10
|
|
5
5
|
Requires-Dist: jsonschema<5,>=4.21.0
|
|
6
6
|
Requires-Dist: referencing>=0.35.1
|
|
@@ -8,6 +8,6 @@ Requires-Dist: jsonpath-ng<2,>=1.6.1
|
|
|
8
8
|
Requires-Dist: ruamel.yaml<0.18,>=0.17.32
|
|
9
9
|
Requires-Dist: ruamel.yaml.string<1,>=0.1.1
|
|
10
10
|
Requires-Dist: tomlkit<0.12,>=0.11.8
|
|
11
|
-
Requires-Dist: MDit==0.0.0.
|
|
12
|
-
Requires-Dist: ExceptionMan==0.0.0.
|
|
11
|
+
Requires-Dist: MDit==0.0.0.dev24
|
|
12
|
+
Requires-Dist: ExceptionMan==0.0.0.dev24
|
|
13
13
|
Requires-Dist: ProtocolMan==0.0.0.dev2
|
|
@@ -17,7 +17,7 @@ namespaces = true
|
|
|
17
17
|
# ----------------------------------------- Project Metadata -------------------------------------
|
|
18
18
|
#
|
|
19
19
|
[project]
|
|
20
|
-
version = "0.0.0.
|
|
20
|
+
version = "0.0.0.dev27"
|
|
21
21
|
name = "PySerials"
|
|
22
22
|
dependencies = [
|
|
23
23
|
"jsonschema >= 4.21.0, < 5",
|
|
@@ -26,8 +26,8 @@ dependencies = [
|
|
|
26
26
|
"ruamel.yaml >= 0.17.32, < 0.18", # https://yaml.readthedocs.io/en/stable/
|
|
27
27
|
"ruamel.yaml.string >= 0.1.1, < 1",
|
|
28
28
|
"tomlkit >= 0.11.8, < 0.12", # https://tomlkit.readthedocs.io/en/stable/,
|
|
29
|
-
"MDit == 0.0.0.
|
|
30
|
-
"ExceptionMan == 0.0.0.
|
|
29
|
+
"MDit == 0.0.0.dev24",
|
|
30
|
+
"ExceptionMan == 0.0.0.dev24",
|
|
31
31
|
"ProtocolMan == 0.0.0.dev2",
|
|
32
32
|
]
|
|
33
33
|
requires-python = ">=3.10"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PySerials
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev27
|
|
4
4
|
Requires-Python: >=3.10
|
|
5
5
|
Requires-Dist: jsonschema<5,>=4.21.0
|
|
6
6
|
Requires-Dist: referencing>=0.35.1
|
|
@@ -8,6 +8,6 @@ Requires-Dist: jsonpath-ng<2,>=1.6.1
|
|
|
8
8
|
Requires-Dist: ruamel.yaml<0.18,>=0.17.32
|
|
9
9
|
Requires-Dist: ruamel.yaml.string<1,>=0.1.1
|
|
10
10
|
Requires-Dist: tomlkit<0.12,>=0.11.8
|
|
11
|
-
Requires-Dist: MDit==0.0.0.
|
|
12
|
-
Requires-Dist: ExceptionMan==0.0.0.
|
|
11
|
+
Requires-Dist: MDit==0.0.0.dev24
|
|
12
|
+
Requires-Dist: ExceptionMan==0.0.0.dev24
|
|
13
13
|
Requires-Dist: ProtocolMan==0.0.0.dev2
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations as _annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING as _TYPE_CHECKING
|
|
4
|
+
|
|
1
5
|
import pyserials as _ps
|
|
2
6
|
|
|
7
|
+
if _TYPE_CHECKING:
|
|
8
|
+
from typing import Callable
|
|
9
|
+
|
|
3
10
|
|
|
4
11
|
class NestedDict:
|
|
5
12
|
|
|
@@ -8,14 +15,22 @@ class NestedDict:
|
|
|
8
15
|
data: dict | None = None,
|
|
9
16
|
template_marker_start: str = "${{",
|
|
10
17
|
template_marker_end: str = "}}",
|
|
18
|
+
template_marker_unpack_start: str = "*{{",
|
|
19
|
+
template_marker_unpack_end: str = "}}",
|
|
11
20
|
template_implicit_root: bool = True,
|
|
21
|
+
template_stringer: Callable[[str], str] = None,
|
|
22
|
+
template_ignore_key_regex: str | None = None,
|
|
12
23
|
):
|
|
13
24
|
self._data = data or {}
|
|
14
25
|
self._templater = _ps.update.TemplateFiller(
|
|
15
26
|
marker_start=template_marker_start,
|
|
16
27
|
marker_end=template_marker_end,
|
|
28
|
+
marker_unpack_start=template_marker_unpack_start,
|
|
29
|
+
marker_unpack_end=template_marker_unpack_end,
|
|
17
30
|
implicit_root=template_implicit_root,
|
|
31
|
+
stringer=template_stringer,
|
|
18
32
|
)
|
|
33
|
+
self._ignore_key_regex = template_ignore_key_regex
|
|
19
34
|
return
|
|
20
35
|
|
|
21
36
|
def fill(
|
|
@@ -30,7 +45,9 @@ class NestedDict:
|
|
|
30
45
|
value = self.__getitem__(path)
|
|
31
46
|
if not value:
|
|
32
47
|
return
|
|
33
|
-
filled_value = self.fill_data(
|
|
48
|
+
filled_value = self.fill_data(
|
|
49
|
+
data=value, current_path=path, always_list=always_list, recursive=recursive,
|
|
50
|
+
)
|
|
34
51
|
if not path:
|
|
35
52
|
self._data = filled_value
|
|
36
53
|
else:
|
|
@@ -50,6 +67,7 @@ class NestedDict:
|
|
|
50
67
|
current_path=current_path,
|
|
51
68
|
always_list=always_list,
|
|
52
69
|
recursive=recursive,
|
|
70
|
+
ignore_key_regex=self._ignore_key_regex,
|
|
53
71
|
)
|
|
54
72
|
|
|
55
73
|
def __call__(self):
|
|
@@ -93,8 +93,8 @@ class TemplateFiller:
|
|
|
93
93
|
self,
|
|
94
94
|
marker_start: str = "${{",
|
|
95
95
|
marker_end: str = "}}",
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
marker_unpack_start: str = "*{{",
|
|
97
|
+
marker_unpack_end: str = "}}",
|
|
98
98
|
implicit_root: bool = True,
|
|
99
99
|
stringer: Callable[[str], str] = str,
|
|
100
100
|
):
|
|
@@ -107,7 +107,7 @@ class TemplateFiller:
|
|
|
107
107
|
self._marker_start = marker_start
|
|
108
108
|
self._marker_end = marker_end
|
|
109
109
|
self._pattern_template = make_regex(marker_start, marker_end)
|
|
110
|
-
self._pattern_template_unpack = make_regex(
|
|
110
|
+
self._pattern_template_unpack = make_regex(marker_unpack_start, marker_unpack_end)
|
|
111
111
|
self._add_prefix = implicit_root
|
|
112
112
|
self._stringer = stringer
|
|
113
113
|
self._data = None
|
|
@@ -115,6 +115,7 @@ class TemplateFiller:
|
|
|
115
115
|
self._recursive = None
|
|
116
116
|
self._path = None
|
|
117
117
|
self._raise_no_match = None
|
|
118
|
+
self._ignore_key_regex = None
|
|
118
119
|
return
|
|
119
120
|
|
|
120
121
|
def fill(
|
|
@@ -125,11 +126,13 @@ class TemplateFiller:
|
|
|
125
126
|
always_list: bool = True,
|
|
126
127
|
recursive: bool = True,
|
|
127
128
|
raise_no_match: bool = True,
|
|
129
|
+
ignore_key_regex: str | None = None,
|
|
128
130
|
):
|
|
129
131
|
self._data = templated_data
|
|
130
132
|
self._source = source_data
|
|
131
133
|
self._recursive = recursive
|
|
132
134
|
self._raise_no_match = raise_no_match
|
|
135
|
+
self._ignore_key_regex = ignore_key_regex
|
|
133
136
|
return self._recursive_subst(
|
|
134
137
|
templ=self._data,
|
|
135
138
|
current_path=(f"$.{current_path}" if self._add_prefix else current_path) if current_path else "$",
|
|
@@ -232,7 +235,7 @@ class TemplateFiller:
|
|
|
232
235
|
elem_filled = self._recursive_subst(
|
|
233
236
|
elem, f"{current_path}[{idx}]", always_list
|
|
234
237
|
)
|
|
235
|
-
if self._pattern_template_unpack.fullmatch(elem):
|
|
238
|
+
if isinstance(elem, str) and self._pattern_template_unpack.fullmatch(elem):
|
|
236
239
|
out.extend(elem_filled)
|
|
237
240
|
else:
|
|
238
241
|
out.append(elem_filled)
|
|
@@ -241,6 +244,9 @@ class TemplateFiller:
|
|
|
241
244
|
new_dict = {}
|
|
242
245
|
for key, val in templ.items():
|
|
243
246
|
key_filled = self._recursive_subst(key, current_path, always_list=False)
|
|
247
|
+
if self._ignore_key_regex and _re.match(self._ignore_key_regex, key_filled):
|
|
248
|
+
new_dict[key_filled] = val
|
|
249
|
+
continue
|
|
244
250
|
new_dict[key_filled] = self._recursive_subst(
|
|
245
251
|
val, f"{current_path}.'{key_filled}'", always_list=always_list
|
|
246
252
|
)
|
|
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
|