A Python library for building custom document object models (DOMs) with built-in JSON schema checking
Project description
wysdom
A Python library for building custom document object models (DOMs) with built-in JSON schema checking
Example Usage
User class definition
from wysdom import UserObject, UserProperty, SchemaArray
class Address(UserObject):
first_line = UserProperty(str)
second_line = UserProperty(str)
city = UserProperty(str)
postal_code = UserProperty(int)
class Person(UserObject):
first_name = UserProperty(str)
last_name = UserProperty(str)
current_address = UserProperty(Address)
previous_addresses = UserProperty(SchemaArray(Address))
Loading from dict
person_instance = Person({
"first_name": "Marge",
"last_name": "Simpson",
"current_address": {
"first_line": "123 Fake Street",
"second_line": "",
"city": "Springfield",
"postal_code": 58008
},
"previous_addresses": [{
"first_line": "742 Evergreen Terrace",
"second_line": "",
"city": "Springfield",
"postal_code": 58008
}]
})
Reading attributes
>>> person_instance.last_name
'Simpson'
>>> person_instance.current_address.first_line
'123 Fake Street'
>>> person_instance.previous_addresses[0].first_line
'742 Evergreen Terrace'
Reading attributes
>>> person_instance.last_name
'Simpson'
>>> person_instance.current_address.first_line
'123 Fake Street'
>>> person_instance.previous_addresses[0].first_line
'742 Evergreen Terrace'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wysdom-0.0.1.tar.gz
(15.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
wysdom-0.0.1-py3-none-any.whl
(21.8 kB
view details)
File details
Details for the file wysdom-0.0.1.tar.gz.
File metadata
- Download URL: wysdom-0.0.1.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11170dcc65975cb409c56e5941f8aca245b668ce3bc3dea8394a3f717c03e652
|
|
| MD5 |
715739184df2efb9505d6359a42c35f0
|
|
| BLAKE2b-256 |
ac75d5d262894f50bdbf4981ffca153fedbf098c5dfe13296fc99e6377082c62
|
File details
Details for the file wysdom-0.0.1-py3-none-any.whl.
File metadata
- Download URL: wysdom-0.0.1-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2c8740f5d2b87a18d90e1f36d99467aad0bd3c96094b0a35b67d4f6a4a7fedd
|
|
| MD5 |
911074497aa0aaaedbcab831abc2af76
|
|
| BLAKE2b-256 |
d2af43781c5cfe19abe9e764e5b026b69754ec0f0cedd33e10bb9bf7c3145aa9
|