Skip to main content

Pretty dict generating plugin for potc.

Project description

potc_dict

PyPI PyPI - Python Version

Code Test Package Release codecov

GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

A simple demo of potc plugin, which can make the dict prettier.

Installation

You can simply install it with pip command line from the official PyPI site.

pip install potc-dict

Or install this plugin by source code

git clone https://github.com/potc-dev/potc-dict.git
cd potc-dict
pip install .

Effect show

We prepare a python script named test_data.py, like this

import math

b = {
    'a': {'a': 3, 'b': None, 'c': math.e},
    'b': (3, 4, 'dfg'),
    'x0': {'a': 3, '02': 4, None: 2},
}

Before the installation mentioned above, we try to export the b in test_data.py by the following CLI command

potc export -v 'test_data.b'

We can get this dumped source code.

import math

__all__ = ['b']
b = {
    'a': {
        'a': 3,
        'b': None,
        'c': math.e
    },
    'b': (3, 4, 'dfg'),
    'x0': {
        'a': 3,
        '02': 4,
        None: 2
    }
}

BUT, after the installation, we try the CLI command which is exactly the same again, we get the new code

import math
from builtins import dict

__all__ = ['b']
b = dict(a=dict(a=3, b=None, c=math.e),
         b=(3, 4, 'dfg'),
         x0={
             'a': 3,
             '02': 4,
             None: 2
         })

That is all of this demo. When you need to build your own plugin, maybe this demo can help you :smile:.

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

potc-dict-0.0.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

potc_dict-0.0.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file potc-dict-0.0.3.tar.gz.

File metadata

  • Download URL: potc-dict-0.0.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for potc-dict-0.0.3.tar.gz
Algorithm Hash digest
SHA256 93ed9e626777d52083b00578f6bc4e364f7c1f26641e60043f5fa2819f6eae72
MD5 451247f3be2a872cded3e988c705dede
BLAKE2b-256 df040d95370342afdd8dbe779d1ca986383054c052095966e2bec186ed66d158

See more details on using hashes here.

File details

Details for the file potc_dict-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: potc_dict-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for potc_dict-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7263f780d102fef52a147f453dcbb458bdb4d14b001ed8a3c79491fca2345b7f
MD5 154664700b45073bdeea96c3ae92fdc6
BLAKE2b-256 3657c23f7f797dfd788b1f3dfa0fcf70fbcc95c9bcf2ab8ea0784d9375cebc7b

See more details on using hashes here.

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