typedparser 0.7.2__tar.gz → 0.9.1__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.7.2 → typedparser-0.9.1}/LICENSE +1 -1
- {typedparser-0.7.2 → typedparser-0.9.1}/PKG-INFO +8 -8
- {typedparser-0.7.2 → typedparser-0.9.1}/README.md +5 -5
- {typedparser-0.7.2 → typedparser-0.9.1}/pyproject.toml +2 -2
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser/__init__.py +2 -2
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser/_typedattr.py +11 -5
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser.egg-info/PKG-INFO +8 -8
- {typedparser-0.7.2 → typedparser-0.9.1}/requirements.txt +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/setup.cfg +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser/_typedparser.py +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser/custom_format.py +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser/funcs.py +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser/objects.py +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser.egg-info/SOURCES.txt +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser.egg-info/dependency_links.txt +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser.egg-info/requires.txt +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser.egg-info/top_level.txt +0 -0
- {typedparser-0.7.2 → typedparser-0.9.1}/src/typedparser.egg-info/zip-safe +0 -0
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2023
|
|
189
|
+
Copyright 2023 simonging
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: typedparser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: Extension for python argparse with typehints and typechecks.
|
|
5
|
-
Author:
|
|
5
|
+
Author: simonging
|
|
6
6
|
License: Apache-2.0
|
|
7
|
-
Project-URL: Project-URL, https://github.com/
|
|
7
|
+
Project-URL: Project-URL, https://github.com/simonging/typedparser
|
|
8
8
|
Keywords: attrs,typing,dict,attr
|
|
9
9
|
Platform: any
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -25,13 +25,13 @@ Requires-Dist: numpy
|
|
|
25
25
|
# typedparser
|
|
26
26
|
|
|
27
27
|
<p align="center">
|
|
28
|
-
<a href="https://github.com/
|
|
29
|
-
<img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/
|
|
28
|
+
<a href="https://github.com/simonging/typedparser/actions/workflows/build-py37.yml">
|
|
29
|
+
<img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simonging/typedparser/build-py37.yml?branch=main&label=build%203.7" />
|
|
30
30
|
</a>
|
|
31
|
-
<a href="https://github.com/
|
|
32
|
-
<img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/
|
|
31
|
+
<a href="https://github.com/simonging/typedparser/actions/workflows/build-py310.yml">
|
|
32
|
+
<img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simonging/typedparser/build-py310.yml?branch=main&label=build%203.10" />
|
|
33
33
|
</a>
|
|
34
|
-
<img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/
|
|
34
|
+
<img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simonging/typedparser/main/docs/coverage.svg" />
|
|
35
35
|
<a href="https://pypi.org/project/typedparser/">
|
|
36
36
|
<img alt="version" title="version" src="https://img.shields.io/pypi/v/typedparser?color=success" />
|
|
37
37
|
</a>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# typedparser
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://github.com/
|
|
5
|
-
<img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/
|
|
4
|
+
<a href="https://github.com/simonging/typedparser/actions/workflows/build-py37.yml">
|
|
5
|
+
<img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simonging/typedparser/build-py37.yml?branch=main&label=build%203.7" />
|
|
6
6
|
</a>
|
|
7
|
-
<a href="https://github.com/
|
|
8
|
-
<img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/
|
|
7
|
+
<a href="https://github.com/simonging/typedparser/actions/workflows/build-py310.yml">
|
|
8
|
+
<img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simonging/typedparser/build-py310.yml?branch=main&label=build%203.10" />
|
|
9
9
|
</a>
|
|
10
|
-
<img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/
|
|
10
|
+
<img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simonging/typedparser/main/docs/coverage.svg" />
|
|
11
11
|
<a href="https://pypi.org/project/typedparser/">
|
|
12
12
|
<img alt="version" title="version" src="https://img.shields.io/pypi/v/typedparser?color=success" />
|
|
13
13
|
</a>
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
name = "typedparser"
|
|
7
7
|
description = "Extension for python argparse with typehints and typechecks."
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
authors = [{ "name" = "
|
|
9
|
+
authors = [{ "name" = "simonging" }]
|
|
10
10
|
requires-python = ">=3.7"
|
|
11
11
|
license = { text = "Apache-2.0" }
|
|
12
12
|
keywords = ["attrs", "typing", "dict", "attr"]
|
|
@@ -24,7 +24,7 @@ classifiers = [
|
|
|
24
24
|
dynamic = ["version", "dependencies"]
|
|
25
25
|
|
|
26
26
|
[project.urls]
|
|
27
|
-
Project-URL = "https://github.com/
|
|
27
|
+
Project-URL = "https://github.com/simonging/typedparser"
|
|
28
28
|
|
|
29
29
|
[tool.setuptools]
|
|
30
30
|
zip-safe = true
|
|
@@ -13,6 +13,6 @@ __all__ = [
|
|
|
13
13
|
"VerboseQuietArgs",
|
|
14
14
|
"CustomArgparseFmt",
|
|
15
15
|
"get_attr_names",
|
|
16
|
-
"define", # deprecated, use from
|
|
16
|
+
"define", # deprecated, use `from attr import define` directly instead
|
|
17
17
|
]
|
|
18
|
-
__version__ = "0.
|
|
18
|
+
__version__ = "0.9.1"
|
|
@@ -15,6 +15,7 @@ from typing import (
|
|
|
15
15
|
List,
|
|
16
16
|
Optional,
|
|
17
17
|
get_type_hints,
|
|
18
|
+
Callable,
|
|
18
19
|
)
|
|
19
20
|
|
|
20
21
|
import attrs
|
|
@@ -32,10 +33,13 @@ except ImportError:
|
|
|
32
33
|
|
|
33
34
|
# default conversions allow to convert instead of raising errors in case of matching types
|
|
34
35
|
# e.g. create Path given str, or create float given int
|
|
35
|
-
|
|
36
|
+
# syntax: ((source_type1, source_type2, ...), target_type, conversion_function)
|
|
37
|
+
# if conversion_function is none, use target_type as conversion function
|
|
38
|
+
conversion_type = List[Tuple[Tuple[Type, ...], Type, Optional[Callable]]]
|
|
36
39
|
default_conversions: conversion_type = [
|
|
37
|
-
((str,), Path),
|
|
38
|
-
((int,), float),
|
|
40
|
+
((str,), Path, None),
|
|
41
|
+
((int,), float, None),
|
|
42
|
+
((Path,), str, Path.as_posix),
|
|
39
43
|
]
|
|
40
44
|
|
|
41
45
|
|
|
@@ -384,11 +388,13 @@ def _parse_nested(
|
|
|
384
388
|
return maybe_raise_typeerorr(f"{err_msg}. Abstract collections are not supported.")
|
|
385
389
|
|
|
386
390
|
# add explicit conversions
|
|
387
|
-
for convert_source, convert_target in conversions:
|
|
391
|
+
for convert_source, convert_target, convert_callable in conversions:
|
|
388
392
|
if not isclass(typ):
|
|
389
393
|
continue
|
|
390
394
|
if issubclass(typ, convert_target) and isinstance(value, convert_source):
|
|
391
|
-
|
|
395
|
+
if convert_callable is None:
|
|
396
|
+
convert_callable = convert_target
|
|
397
|
+
return convert_callable(value)
|
|
392
398
|
|
|
393
399
|
if strict:
|
|
394
400
|
add_info = ""
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: typedparser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: Extension for python argparse with typehints and typechecks.
|
|
5
|
-
Author:
|
|
5
|
+
Author: simonging
|
|
6
6
|
License: Apache-2.0
|
|
7
|
-
Project-URL: Project-URL, https://github.com/
|
|
7
|
+
Project-URL: Project-URL, https://github.com/simonging/typedparser
|
|
8
8
|
Keywords: attrs,typing,dict,attr
|
|
9
9
|
Platform: any
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -25,13 +25,13 @@ Requires-Dist: numpy
|
|
|
25
25
|
# typedparser
|
|
26
26
|
|
|
27
27
|
<p align="center">
|
|
28
|
-
<a href="https://github.com/
|
|
29
|
-
<img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/
|
|
28
|
+
<a href="https://github.com/simonging/typedparser/actions/workflows/build-py37.yml">
|
|
29
|
+
<img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simonging/typedparser/build-py37.yml?branch=main&label=build%203.7" />
|
|
30
30
|
</a>
|
|
31
|
-
<a href="https://github.com/
|
|
32
|
-
<img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/
|
|
31
|
+
<a href="https://github.com/simonging/typedparser/actions/workflows/build-py310.yml">
|
|
32
|
+
<img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simonging/typedparser/build-py310.yml?branch=main&label=build%203.10" />
|
|
33
33
|
</a>
|
|
34
|
-
<img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/
|
|
34
|
+
<img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simonging/typedparser/main/docs/coverage.svg" />
|
|
35
35
|
<a href="https://pypi.org/project/typedparser/">
|
|
36
36
|
<img alt="version" title="version" src="https://img.shields.io/pypi/v/typedparser?color=success" />
|
|
37
37
|
</a>
|
|
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
|