Skip to main content

A set of common tools.

Project description

Gadget

A wide variety of tools in the software development.

1 Gadget Abstract List

1.1 dict2class

Convert a parameter from "dict" type to simple User-defined class type.

Such as:

# Import required packages
from gadget import Dict2Class
import datetime

# Defines a dictionary
test_dict = {
    'now': datetime.datetime.now(),
    'num': 77,
    'txt': 'Hello!',
    'dct': {
        't_num': 667,
        't_txt': 'hello!'
    },
    'lst': [1, 2, 3, 'abc'],
    'set': {1, 3, 3, 4, 'abc'},
    'tpl': (1, 2, 3, 5, 'abc')
}

# Converts to user-defined class here
ud_class = Dict2Class().convert(test_dict)

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

gadgetpie-0.0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

gadgetpie-0.0.1-py3-none-any.whl (4.8 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