typedparser 0.11.2__tar.gz → 0.11.4__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.
- {typedparser-0.11.2 → typedparser-0.11.4}/PKG-INFO +2 -1
- {typedparser-0.11.2 → typedparser-0.11.4}/README.md +1 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser/__init__.py +1 -1
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser/_typedattr.py +5 -5
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser.egg-info/PKG-INFO +2 -1
- {typedparser-0.11.2 → typedparser-0.11.4}/LICENSE +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/pyproject.toml +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/requirements.txt +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/setup.cfg +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser/_typedparser.py +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser/custom_format.py +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser/funcs.py +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser/objects.py +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser.egg-info/SOURCES.txt +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser.egg-info/dependency_links.txt +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser.egg-info/requires.txt +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser.egg-info/top_level.txt +0 -0
- {typedparser-0.11.2 → typedparser-0.11.4}/src/typedparser.egg-info/zip-safe +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: typedparser
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.4
|
|
4
4
|
Summary: Extension for python argparse with typehints and typechecks.
|
|
5
5
|
Author: simon-ging
|
|
6
6
|
License: Apache-2.0
|
|
@@ -150,6 +150,7 @@ print(attrs_from_dict(CfgNested, {"sub_cfg": {"foo": 1, "bar": 2}}))
|
|
|
150
150
|
the output will be a tuple
|
|
151
151
|
* Raise errors if types cannot be matched, there are unknown fields in the input or
|
|
152
152
|
abstract annotation types are used (e.g. Sequence)
|
|
153
|
+
* Set `_allow_extra_keys = True` in the class definition to allow unknown fields in the input
|
|
153
154
|
|
|
154
155
|
### Non-strict mode
|
|
155
156
|
|
|
@@ -123,6 +123,7 @@ print(attrs_from_dict(CfgNested, {"sub_cfg": {"foo": 1, "bar": 2}}))
|
|
|
123
123
|
the output will be a tuple
|
|
124
124
|
* Raise errors if types cannot be matched, there are unknown fields in the input or
|
|
125
125
|
abstract annotation types are used (e.g. Sequence)
|
|
126
|
+
* Set `_allow_extra_keys = True` in the class definition to allow unknown fields in the input
|
|
126
127
|
|
|
127
128
|
### Non-strict mode
|
|
128
129
|
|
|
@@ -229,7 +229,7 @@ def _attrs_from_dict(
|
|
|
229
229
|
|
|
230
230
|
# handle unknown fields
|
|
231
231
|
if len(nonmatching_input) > 0 and not skip_unknowns:
|
|
232
|
-
if strict:
|
|
232
|
+
if strict and not getattr(cls, "_allow_extra_keys", False):
|
|
233
233
|
raise TypeError(
|
|
234
234
|
f"Keys in input {list(nonmatching_input.keys())} not defined "
|
|
235
235
|
f"for class {cls} with attributes {sorted(all_att_names)}"
|
|
@@ -315,7 +315,7 @@ def _parse_nested(
|
|
|
315
315
|
)
|
|
316
316
|
|
|
317
317
|
# resolve any
|
|
318
|
-
if typ
|
|
318
|
+
if typ in [Any, any]:
|
|
319
319
|
return value
|
|
320
320
|
|
|
321
321
|
# resolve unions (mostly "optional")
|
|
@@ -369,9 +369,9 @@ def _parse_nested(
|
|
|
369
369
|
dict_output = {}
|
|
370
370
|
|
|
371
371
|
for key, val in value.items():
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
parsed_key = parse_recursive(f"{name}/dict_key_type", key, dict_keytype, strict=strict)
|
|
373
|
+
parsed_value = parse_recursive(f"{name}/{key}", val, dict_valuetype, strict=strict)
|
|
374
|
+
dict_output[parsed_key] = parsed_value
|
|
375
375
|
|
|
376
376
|
return dict_output
|
|
377
377
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: typedparser
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.4
|
|
4
4
|
Summary: Extension for python argparse with typehints and typechecks.
|
|
5
5
|
Author: simon-ging
|
|
6
6
|
License: Apache-2.0
|
|
@@ -150,6 +150,7 @@ print(attrs_from_dict(CfgNested, {"sub_cfg": {"foo": 1, "bar": 2}}))
|
|
|
150
150
|
the output will be a tuple
|
|
151
151
|
* Raise errors if types cannot be matched, there are unknown fields in the input or
|
|
152
152
|
abstract annotation types are used (e.g. Sequence)
|
|
153
|
+
* Set `_allow_extra_keys = True` in the class definition to allow unknown fields in the input
|
|
153
154
|
|
|
154
155
|
### Non-strict mode
|
|
155
156
|
|
|
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
|