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.6.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.6-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: regex_custom_dict-0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 8556ff1aed6618e89c62185d9c23170064ec5c287fa73ffb726a9247622be21a
MD5 9038b085b426585b46b62812dfeccea2
BLAKE2b-256 81f7c519168fa31c15126ec77e45fef827bafbf8e0e0d69d5e7940a169ae65f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for regex_custom_dict-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 023312e7693b0d03fe1fcc94a01014111366c06be004655cd11a4e49f041e2ee
MD5 f8503289fa0988ce4fecee38e6d4a6ca
BLAKE2b-256 214d09532419fb389f24c1ba7e4bde70460455ab2703fd599611b4b3fd0824ff

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