Skip to main content

Generate Dataclass without writting them !

Project description

https://travis-ci.org/jgirardet/dtc.svg?branch=master https://ci.appveyor.com/api/projects/status/ffd44ndqx713yuhd/branch/master?svg=true

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)]

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

dtc-0.1.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

dtc-0.1.1-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page