Generate Dataclass without writting them !
Project description
DTC :”Generate Dataclasses without writting them !”
Basic Usage
>>> import dtc
>>> JSON = b"""{"flooat": 12.564, "boolean": true, "integer": 12}"""
>>> my_class = dtc.from_json(JSON)
>>> my_class
Base(flooat=12.564, boolean=True, integer=12)
>>> from dataclasses import *
>>> is_dataclass(my_class)
True
>>> JSON = b"""[{"flooat": 12.4, "boolean": true, "integer": 1}, {"flooat": 12.564, "boolean": true, "integer": 12},{"flooat": 1.4, "boolean": false, "integer": 0}]"""
>>> dtc.from_json(JSON
[Base(flooat=12.4, boolean=True, integer=1), Base(flooat=12.564, boolean=True, integer=12), Base(flooat=1.4, boolean=False, integer=0)]
License : GNU General Public License v3 or later (GPLv3+)
Source: https://github.com/jgirardet/dtc
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
dtc-0.1.1.tar.gz
(3.0 kB
view hashes)
Built Distribution
dtc-0.1.1-py3-none-any.whl
(6.5 kB
view hashes)