Skip to main content

Library created to map keys in dictionaries.

Project description

With this library you can map your dictionaries easily, you just need to pass it:

1- output: the dictionary you want to receive, the variables you want to map must go with {}

from DictMaper import MapDict
result = MapDict(
    output={
        "{var_1}": "Hi! {var_2}, welcome to {company_name}"
        "company name":"{company_name}"
    }
    ......
)

2- context: context is the data from which the information will be obtained:

from DictMaper import MapDict
result = MapDict(
    output={
        "{var_1}": "Hi! {var_2}, welcome to {company_name}"
        "company name":"{company_name}"
    }
    context={
        "user": {
          "name":"user name",
          "email":"test_email@..."
        }
        "company":{
         "information":{
            "name":"Company name",
            "id":"1234"
            }
        }
   }
)

3- vars: vars are the variables you want to map to your output and the value is where they are located within context:

from DictMaper import MapDict
result = MapDict(
    output={
        "{var_1}": "Hi! {var_2}, welcome to {company_name}",
        "company":"{company_name}"
    }
    context={
        "user": {
          "name":"user name",
          "email":"test_email@..."
        },
        "company":{
         "information":{
            "name":"Company name",
            "id":"1234"
            }
        }
   }
   vars={
     "var_1": "user.email",
     "var_2": "user.name",
     "company_name": "company.information.name"
   }
)

That’s all, process the data making .process() and as a result you will have:

python from DictMaper import MapDict result = MapDict(...).process() { "test_email@...": "Hi! user name, welcome to Company name", "company":"Company name" }

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

dictmaper-0.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dictmaper-0.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file dictmaper-0.0.1.tar.gz.

File metadata

  • Download URL: dictmaper-0.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.17

File hashes

Hashes for dictmaper-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7472372d1e02a45576679054734a7dfe73c81afe1f7da248df06b7e42cf1705d
MD5 4bb22a91841b0c0fc6a2869d5a338c39
BLAKE2b-256 21388f789855d58431453cba51550a160abea02e6f9ba96c55444613060a836e

See more details on using hashes here.

File details

Details for the file dictmaper-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dictmaper-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.17

File hashes

Hashes for dictmaper-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b99767b772d74843498803a49190e4f693d82749611b7422b2d758aa4484464
MD5 ebbd6b681de1361fbfed91fa646a67d0
BLAKE2b-256 c5d3959c9c9fccee54e93d9850c7c4f07585efe31abdad684fe0acc362f26c7d

See more details on using hashes here.

Supported by

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