Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keuin/anodict
Annotated Python dict.
https://github.com/keuin/anodict
Last synced: about 1 month ago
JSON representation
Annotated Python dict.
- Host: GitHub
- URL: https://github.com/keuin/anodict
- Owner: keuin
- Created: 2021-07-10T03:07:41.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-07-10T05:44:43.000Z (over 3 years ago)
- Last Synced: 2024-11-12T09:22:48.454Z (about 2 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# anodict: annotated dict
[![Pyversions](https://img.shields.io/pypi/pyversions/anodict.svg?style=flat-square)](https://pypi.org/project/anodict/)
Convert a `dict` to an annotated object.
# Usage
## Installation
```shell
pip install anodict
```## Example
```python
import anodictclass Person:
name: str
age: intperson = anodict.dict_to_class({
"name": "bob",
"age": 23
}, Person)print("type:", type(person))
print("name:", person.name)
print("age:", person.age)
```will give:
```
type:
name: bob
age: 23
```