load python dict data to python class
Project description
pyruicore
- This package is used to load python dict data to python class.
Usage
- pip install pyruicore -i https://pypi.org/simple
from pyruicore import BaseModel, Field
class Department(BaseModel):
name: str
address: str
class User(BaseModel):
age: int = Field(default_factory=lambda: 1)
departs: List[Department]
user = User(
departs=[
{"name": "de1", "address": "address1"},
Department(name="2", address="address2"),
]
)
user_dict = user.dict()
"""
user_dict = {
"age": 1,
"departs": [
{"name": "de1", "address": "address1"},
{"name": "2", "address": "address2"},
]
}
"""
Maintainers
Contributing
PRs are accepted, this is first workout version, may have many bugs, so welcome to point out bugs and fix it.
License
MIT © 2020 ruicore
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyruicore-0.1.2.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for pyruicore-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29cb7798db16d3ee84724373ee51115a484af189067c59978d2b13b715baf5d1 |
|
MD5 | da83767d208d021bd816721324c0e83e |
|
BLAKE2b-256 | a1ea0dc32ff4933e1c905171e6cc49dd285421e0f78e4564677dc0cb0af410a2 |