Library for easy converting between plain JSON-like data and compound structure of user defined class instances.
Project description
Library for easy bi-direction converting between plain JSON-like data (numbers, strings, lists and dicts) and compound user-defined classes.
Trivial example:
>>> from steward import * >>> class Comp(Component): ... a = Field() ... b = Field(default=1) ... >>> v = Comp(a=0) >>> dct = v.as_plain() >>> dct {'a': 0, 'b': 1} >>> v2 = Comp.from_plain(dct) >>> v2.a 0 >>> v2.b 1 >>> v2.a = 7 >>> v2.as_plain() {'a': 7, 'b': 1}
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
steward-0.0.4.tar.gz
(3.9 kB
view details)
File details
Details for the file steward-0.0.4.tar.gz
.
File metadata
- Download URL: steward-0.0.4.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e1e61cd297f68fec40104532e2b78b9a4d76a540dffe9938ae763b369da3429 |
|
MD5 | 9352c8c66be470e9e5fe51ab9a4f49a6 |
|
BLAKE2b-256 | 0471b2150f5a47efa7217bfb5e1804863ba39e3530befcc8dcd9203f43890805 |