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==0.5

Usage

from regex_custom_dict.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 values of the keys that match the provided regex pattern, mapped 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.5.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.5-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: regex_custom_dict-0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 a5e367e480a994581b58e2993eabb296314a3d84af57e57cbf8c728226673917
MD5 ddff0c94ec335e249b3b632ed47e5855
BLAKE2b-256 c6e52558050495b418d4b9f511f0b5a7d0bf6b089dcf58e5c638f961087d3b65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for regex_custom_dict-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 11a8e29f34b1097d865c0c576b28c2749a823f0840514128cfdb8c83b941f382
MD5 0c2fbcd95703922031fffa22947f4140
BLAKE2b-256 538a8ca1654abd417e06983913c2c83827ea501dd80ae43a6c5a7048db3f8468

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