PySerials 0.0.0.dev53__tar.gz → 0.0.0.dev55__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.
Files changed (24) hide show
  1. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/PKG-INFO +4 -4
  2. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/pyproject.toml +4 -4
  3. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/PySerials.egg-info/PKG-INFO +4 -4
  4. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/PySerials.egg-info/requires.txt +3 -3
  5. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/nested_dict.py +2 -0
  6. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/update.py +8 -0
  7. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/write.py +7 -2
  8. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/README.md +0 -0
  9. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/setup.cfg +0 -0
  10. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/PySerials.egg-info/SOURCES.txt +0 -0
  11. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/PySerials.egg-info/dependency_links.txt +0 -0
  12. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/PySerials.egg-info/not-zip-safe +0 -0
  13. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/PySerials.egg-info/top_level.txt +0 -0
  14. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/__init__.py +0 -0
  15. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/compare.py +0 -0
  16. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/exception/__init__.py +0 -0
  17. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/exception/_base.py +0 -0
  18. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/exception/read.py +0 -0
  19. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/exception/update.py +0 -0
  20. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/exception/validate.py +0 -0
  21. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/format.py +0 -0
  22. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/property_dict.py +0 -0
  23. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/read.py +0 -0
  24. {pyserials-0.0.0.dev53 → pyserials-0.0.0.dev55}/src/pyserials/validate.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySerials
3
- Version: 0.0.0.dev53
3
+ Version: 0.0.0.dev55
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: jsonschema<5,>=4.21.0
6
6
  Requires-Dist: referencing>=0.35.1
7
7
  Requires-Dist: jsonpath-ng<2,>=1.6.1
8
- Requires-Dist: ruamel.yaml<0.18,>=0.17.32
8
+ Requires-Dist: ruamel.yaml>=0.18
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.dev50
12
- Requires-Dist: ExceptionMan==0.0.0.dev50
11
+ Requires-Dist: MDit==0.0.0.dev52
12
+ Requires-Dist: ExceptionMan==0.0.0.dev52
13
13
  Requires-Dist: ProtocolMan==0.0.0.dev2
@@ -17,17 +17,17 @@ namespaces = true
17
17
  # ----------------------------------------- Project Metadata -------------------------------------
18
18
  #
19
19
  [project]
20
- version = "0.0.0.dev53"
20
+ version = "0.0.0.dev55"
21
21
  name = "PySerials"
22
22
  dependencies = [
23
23
  "jsonschema >= 4.21.0, < 5",
24
24
  "referencing >= 0.35.1",
25
25
  "jsonpath-ng >= 1.6.1, < 2",
26
- "ruamel.yaml >= 0.17.32, < 0.18", # https://yaml.readthedocs.io/en/stable/
26
+ "ruamel.yaml >= 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.dev50",
30
- "ExceptionMan == 0.0.0.dev50",
29
+ "MDit == 0.0.0.dev52",
30
+ "ExceptionMan == 0.0.0.dev52",
31
31
  "ProtocolMan == 0.0.0.dev2",
32
32
  ]
33
33
  requires-python = ">=3.10"
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySerials
3
- Version: 0.0.0.dev53
3
+ Version: 0.0.0.dev55
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: jsonschema<5,>=4.21.0
6
6
  Requires-Dist: referencing>=0.35.1
7
7
  Requires-Dist: jsonpath-ng<2,>=1.6.1
8
- Requires-Dist: ruamel.yaml<0.18,>=0.17.32
8
+ Requires-Dist: ruamel.yaml>=0.18
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.dev50
12
- Requires-Dist: ExceptionMan==0.0.0.dev50
11
+ Requires-Dist: MDit==0.0.0.dev52
12
+ Requires-Dist: ExceptionMan==0.0.0.dev52
13
13
  Requires-Dist: ProtocolMan==0.0.0.dev2
@@ -1,9 +1,9 @@
1
1
  jsonschema<5,>=4.21.0
2
2
  referencing>=0.35.1
3
3
  jsonpath-ng<2,>=1.6.1
4
- ruamel.yaml<0.18,>=0.17.32
4
+ ruamel.yaml>=0.18
5
5
  ruamel.yaml.string<1,>=0.1.1
6
6
  tomlkit<0.12,>=0.11.8
7
- MDit==0.0.0.dev50
8
- ExceptionMan==0.0.0.dev50
7
+ MDit==0.0.0.dev52
8
+ ExceptionMan==0.0.0.dev52
9
9
  ProtocolMan==0.0.0.dev2
@@ -33,6 +33,7 @@ class NestedDict:
33
33
  stringer: Callable[[str], str] = str,
34
34
  unpack_string_joiner: str = ", ",
35
35
  relative_template_keys: list[str] | None = None,
36
+ relative_key_key: str | None = None,
36
37
  implicit_root: bool = True,
37
38
  getter_function_name: str = "get",
38
39
  ):
@@ -58,6 +59,7 @@ class NestedDict:
58
59
  stringer=stringer,
59
60
  unpack_string_joiner=unpack_string_joiner,
60
61
  relative_template_keys=relative_template_keys,
62
+ relative_key_key=relative_key_key,
61
63
  implicit_root=implicit_root,
62
64
  getter_function_name=getter_function_name,
63
65
  )
@@ -126,6 +126,7 @@ class TemplateFiller:
126
126
  stringer: Callable[[str], str] = str,
127
127
  unpack_string_joiner: str = ", ",
128
128
  relative_template_keys: list[str] | None = None,
129
+ relative_key_key: str | None = None,
129
130
  implicit_root: bool = True,
130
131
  getter_function_name: str = "get",
131
132
  ):
@@ -148,6 +149,7 @@ class TemplateFiller:
148
149
  self._unpack_string_joiner = unpack_string_joiner
149
150
  self._add_prefix = implicit_root
150
151
  self._template_keys = relative_template_keys or []
152
+ self._relative_key_key = relative_key_key
151
153
  self._getter_function_name = getter_function_name
152
154
 
153
155
  self._pattern_value: dict[int, _RegexPattern] = {}
@@ -237,6 +239,12 @@ class TemplateFiller:
237
239
  ),
238
240
  )
239
241
  root_path_expr = root_path_expr.left
242
+ # Handle relative-key key
243
+ if self._relative_key_key and path == self._relative_key_key:
244
+ output = root_path_expr.right
245
+ if from_code:
246
+ return output, True
247
+ return output
240
248
  path_expr = self._concat_json_paths(root_path_expr, path_expr)
241
249
  cached_result = self._visited_paths.get(path_expr)
242
250
  if cached_result:
@@ -1,10 +1,14 @@
1
- from typing import Literal as _Literal
1
+ from __future__ import annotations as _annotations
2
+ from typing import Literal as _Literal, TYPE_CHECKING as _TYPE_CHECKING
2
3
  from pathlib import Path as _Path
3
4
  import json as _json
4
5
  import ruamel.yaml as _yaml
5
6
  from ruamel.yaml import scalarstring as _yaml_scalar_string
6
7
  import tomlkit as _tomlkit
7
8
 
9
+ if _TYPE_CHECKING:
10
+ from typing import Callable, Any
11
+
8
12
 
9
13
  def to_string(
10
14
  data: dict | list | str | int | float | bool | _yaml.CommentedMap | _yaml.CommentedSeq,
@@ -47,8 +51,9 @@ def to_json_string(
47
51
  data: dict | list | str | int | float | bool | _yaml.CommentedMap | _yaml.CommentedSeq,
48
52
  sort_keys: bool = False,
49
53
  indent: int | None = None,
54
+ default: Callable[[Any], Any] | None = None,
50
55
  ) -> str:
51
- return _json.dumps(data, indent=indent, sort_keys=sort_keys)
56
+ return _json.dumps(data, indent=indent, sort_keys=sort_keys, default=default)
52
57
 
53
58
 
54
59
  def to_yaml_file(