Base class with serialization helpers for user-defined Python objects
Project description
serializable
Base class with serialization methods for user-defined Python objects
Usage
Classes which inherit from Serializable are given default implementations of to_json, from_json, __reduce__ (for pickling), and other serialization helpers.
Your derived class must:
provide a user-defined to_dict() method which returns a dictionary.
The keys of the dictionary returned by to_dict() must match the arguments to the __init__ of your class.
Limitations
Serializable objects must inherit from Serializable, be tuples or namedtuples, be serializble primitive types such as dict, list, int, float, or str.
The serialized representation of objects relies on reserved keywords (such as "__name__", and "__class__"), so dictionaries are expect to not contain any keys which begin with two underscores.
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
File details
Details for the file serializable-0.0.6.tar.gz
.
File metadata
- Download URL: serializable-0.0.6.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20d2f748f92d835829db112eacb820814e3155f3069610d300fcbf806ea456ee |
|
MD5 | 5207af1e5b9b2cc08a7d48a1283e9212 |
|
BLAKE2b-256 | 07ba805728f36d81e9de92954e470b1bab7e80985421b98413850c1d2b1e4181 |