【文件属性】:
文件名称:typedjson-python:具有类型提示的Python的JSON解码(PEP 484)
文件大小:23KB
文件格式:ZIP
更新时间:2021-05-20 11:22:31
python json validation type-hints Python
typedjson
用于带类型提示的Python的JSON解码(PEP 484)。
要求和限制
Python> = 3.7
Mypy <= 0.770
使用非泛型或参数化的类来解码JSON。
使用类型提示而不使用前向引用。
特征
支持以下解码类型:
基本类型,例如str , int , float , bool和None 。
Union和Optional 。
同质和异质Tuple和List 。
可变长度Tuple 。
非通用和参数化的数据类。
支持json.load和json.loads类的API。
例子
from typing import Optional
import typedjson
from dataclasses import dataclass
@ dataclass ( frozen = True )
class NameJson :
fir
【文件预览】:
typedjson-python-master
----.travis.yml(2KB)
----poetry.lock(25KB)
----pyproject.toml(741B)
----tests()
--------test_annotation.py(2KB)
--------test_dumping.py(3KB)
--------test_decoding.py(8KB)
--------test_loading.py(643B)
----LICENSE(1KB)
----mypy.ini(378B)
----typedjson()
--------loading.py(719B)
--------py.typed(0B)
--------decoding.py(6KB)
--------__init__.py(491B)
--------annotation.py(2KB)
--------dumping.py(1KB)
----CONTRIBUTING.md(303B)
----.gitignore(1KB)
----CHANGELOG.md(1KB)
----README.md(2KB)
----fixtures()
--------cat_jiji.json(75B)