https://github.com/keuin/anodict
Annotated Python dict.
https://github.com/keuin/anodict
Last synced: 10 months ago
JSON representation
Annotated Python dict.
- Host: GitHub
- URL: https://github.com/keuin/anodict
- Owner: keuin
- Created: 2021-07-10T03:07:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-10T05:44:43.000Z (over 4 years ago)
- Last Synced: 2024-11-12T09:22:48.454Z (about 1 year 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
[](https://pypi.org/project/anodict/)
Convert a `dict` to an annotated object.
# Usage
## Installation
```shell
pip install anodict
```
## Example
```python
import anodict
class Person:
name: str
age: int
person = 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
```