typedparser 0.11.1__tar.gz → 0.11.2__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.1 → typedparser-0.11.2}/PKG-INFO +1 -1
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser/__init__.py +1 -1
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser/_typedattr.py +12 -6
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser.egg-info/PKG-INFO +1 -1
- {typedparser-0.11.1 → typedparser-0.11.2}/LICENSE +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/README.md +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/pyproject.toml +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/requirements.txt +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/setup.cfg +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser/_typedparser.py +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser/custom_format.py +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser/funcs.py +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser/objects.py +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser.egg-info/SOURCES.txt +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser.egg-info/dependency_links.txt +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser.egg-info/requires.txt +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser.egg-info/top_level.txt +0 -0
- {typedparser-0.11.1 → typedparser-0.11.2}/src/typedparser.egg-info/zip-safe +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import attrs
|
|
2
1
|
import collections
|
|
3
|
-
from attr import has, AttrsInstance
|
|
4
|
-
from attrs import define, fields_dict, fields, Attribute
|
|
5
2
|
from functools import partial
|
|
6
3
|
from inspect import isclass
|
|
7
4
|
from pathlib import Path
|
|
@@ -21,6 +18,10 @@ from typing import (
|
|
|
21
18
|
Callable,
|
|
22
19
|
)
|
|
23
20
|
|
|
21
|
+
import attrs
|
|
22
|
+
from attr import has, AttrsInstance
|
|
23
|
+
from attrs import define, fields_dict, fields, Attribute
|
|
24
|
+
|
|
24
25
|
from .objects import check_object_equality, RecursorInterface, StrictRecursor, AttrsClass
|
|
25
26
|
|
|
26
27
|
try:
|
|
@@ -319,14 +320,19 @@ def _parse_nested(
|
|
|
319
320
|
|
|
320
321
|
# resolve unions (mostly "optional")
|
|
321
322
|
if origin == Union or (UnionType is not None and isinstance(typ, UnionType)):
|
|
323
|
+
collected_errors = []
|
|
322
324
|
for new_typ in args:
|
|
323
325
|
try:
|
|
324
326
|
# force strict parsing and catch errors to try all different types
|
|
325
327
|
return parse_recursive(name, value, new_typ, strict=True)
|
|
326
|
-
except TypeError:
|
|
327
|
-
|
|
328
|
+
except TypeError as e:
|
|
329
|
+
collected_errors.append(f"{e}")
|
|
328
330
|
# if we get here, none of the types worked
|
|
329
|
-
|
|
331
|
+
collected_error_str = "\n".join(collected_errors)
|
|
332
|
+
return maybe_raise_typeerror(
|
|
333
|
+
f"No type in Union matches. Errors per type:\n{collected_error_str}\n"
|
|
334
|
+
f"Final error: {err_msg}"
|
|
335
|
+
)
|
|
330
336
|
|
|
331
337
|
final_list_type = None
|
|
332
338
|
|
|
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
|