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.0.1.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for pyruicore-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed6fd192d0062b509e04e05ad2a873baca71876cbbba58488e3c549c60ab9f2a |
|
MD5 | d748e7777fa11a69025749166a8a8bee |
|
BLAKE2b-256 | 103660a9964193803d13ad38c6da8b521a3207cbae02a69b6b935965619dd0f7 |