Skip to main content

No project description provided

Project description

RegexCustomDict

RegexCustomDict is a Python class that extends the built-in dict class, allowing you to access dictionary keys using regular expressions.

Features

  • Access dictionary keys using regex patterns.
  • Flatten nested dictionaries into a single level for easy access.

Installation

bash or windows

pip install regex_custom_dict

Usage

from regex_custom_dict import RegexCustomDict

# Create an instance of RegexCustomDict
my_dict = RegexCustomDict(x={'sde': {'6': 4}}, y=4, xx={'sde': 2, 'sq': 3}, xxx=6.8)

#Alternate - you can even convert a normal_dict into a regex_custom_dict
my_dict = RegexCustomDict(**normal_dict)

# Access keys using regex pattern
result = my_dict['x+']
# The output will be a dictionary containing keys that match the provided regex pattern with predefined keys.

#To flatten the output.
result = my_dict['x+'].flatten_dict()

#you can also use multiple hierarchies(keys)
my_dict['x+']['s+']

It will flatten out the values and give as a list if your pattern matches multiple keys.

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

regex_custom_dict-0.4.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

regex_custom_dict-0.4-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file regex_custom_dict-0.4.tar.gz.

File metadata

  • Download URL: regex_custom_dict-0.4.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for regex_custom_dict-0.4.tar.gz
Algorithm Hash digest
SHA256 a6cb77651dcbe80ba08ef7eb3e6d8c0a2e8d2afdcc42b83209009ffe7355a6c6
MD5 1acb5303e6d9917c6c37356870492272
BLAKE2b-256 253ceb9840f58be0cbbc64ff679ea919f4353c5948b30310a00cbe91c8c116f5

See more details on using hashes here.

File details

Details for the file regex_custom_dict-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for regex_custom_dict-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4f5a9fdbee794b3f7252ca87643283310cde64ad4f4aa5e2cfdef52e1c398931
MD5 ed9f888e4983771e2fb44b1880ed5d0f
BLAKE2b-256 31591ea452ba86ebc7b82a7f59a15910fe154a5dc638b849a4f6324d1d93ff66

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