typedparser 0.13.1__tar.gz → 0.16.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typedparser
3
- Version: 0.13.1
3
+ Version: 0.16.2
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -49,6 +49,12 @@ Requires-Dist: numpy; extra == "full"
49
49
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312.yml">
50
50
  <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=python%203.12" />
51
51
  </a>
52
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py37-full.yml">
53
+ <img alt="build 3.7 full status" title="build 3.7 full status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37-full.yml?branch=main&label=python%203.7%20full" />
54
+ </a>
55
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312-full.yml">
56
+ <img alt="build 3.12 full status" title="build 3.12 full status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312-full.yml?branch=main&label=python%203.12%20full" />
57
+ </a>
52
58
  <img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simon-ging/typedparser/main/docs/coverage.svg" />
53
59
  <a href="https://pypi.org/project/typedparser/">
54
60
  <img alt="version" title="version" src="https://img.shields.io/pypi/v/typedparser?color=success" />
@@ -19,6 +19,12 @@
19
19
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312.yml">
20
20
  <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=python%203.12" />
21
21
  </a>
22
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py37-full.yml">
23
+ <img alt="build 3.7 full status" title="build 3.7 full status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37-full.yml?branch=main&label=python%203.7%20full" />
24
+ </a>
25
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312-full.yml">
26
+ <img alt="build 3.12 full status" title="build 3.12 full status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312-full.yml?branch=main&label=python%203.12%20full" />
27
+ </a>
22
28
  <img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simon-ging/typedparser/main/docs/coverage.svg" />
23
29
  <a href="https://pypi.org/project/typedparser/">
24
30
  <img alt="version" title="version" src="https://img.shields.io/pypi/v/typedparser?color=success" />
@@ -14,4 +14,4 @@ __all__ = [
14
14
  "get_attr_names",
15
15
  ]
16
16
 
17
- __version__ = "0.13.1"
17
+ __version__ = "0.16.2"
@@ -145,6 +145,12 @@ def _attrs_from_dict(
145
145
  ):
146
146
  if current_position is None:
147
147
  current_position = []
148
+ if isinstance(input_dict_or_attrs, str):
149
+ raise TypeError(
150
+ f"Expected a dictionary or attrs instance, got type '{type(input_dict_or_attrs)}' "
151
+ f"value '{input_dict_or_attrs}' at position '{'.'.join(current_position)}' (root "
152
+ f"if empty).\n\nError context: {more_error_info}."
153
+ )
148
154
  _print_fn(f"Parsing {cls} from {input_dict_or_attrs}")
149
155
  input_cls = type(input_dict_or_attrs)
150
156
  if has(input_cls):
@@ -2,7 +2,7 @@ import argparse
2
2
  from typing import Any, Dict
3
3
 
4
4
  from attr import AttrsInstance
5
- from attrs import has, fields_dict
5
+ from attrs import has, fields_dict, asdict
6
6
 
7
7
  from ._typedattr import attrs_from_dict
8
8
  from .objects import get_attr_names
@@ -120,8 +120,8 @@ def parse_typed_args(
120
120
  f"Arguments received from argparse {args_desc} "
121
121
  f"are missing from argument definition '{typed_args_class.__name__}'. "
122
122
  f"This probably means there is a mismatch between the call to add_argument() "
123
- f"and the attribute name."
124
- # f" Available keys in '{typed_args_class.__name__}': {fields_keys}."
123
+ f"and the attribute name. "
124
+ f"Available keys in '{typed_args_class.__name__}': {fields_keys}."
125
125
  )
126
126
  if strict:
127
127
  raise KeyError(missing_err)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typedparser
3
- Version: 0.13.1
3
+ Version: 0.16.2
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -49,6 +49,12 @@ Requires-Dist: numpy; extra == "full"
49
49
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312.yml">
50
50
  <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=python%203.12" />
51
51
  </a>
52
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py37-full.yml">
53
+ <img alt="build 3.7 full status" title="build 3.7 full status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37-full.yml?branch=main&label=python%203.7%20full" />
54
+ </a>
55
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312-full.yml">
56
+ <img alt="build 3.12 full status" title="build 3.12 full status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312-full.yml?branch=main&label=python%203.12%20full" />
57
+ </a>
52
58
  <img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simon-ging/typedparser/main/docs/coverage.svg" />
53
59
  <a href="https://pypi.org/project/typedparser/">
54
60
  <img alt="version" title="version" src="https://img.shields.io/pypi/v/typedparser?color=success" />
File without changes
File without changes