A Wireshark-like display filter for dictionaries.
Project description
Python Dictionary Display Filter
A Wireshark-like display filter for Python dictionaries. This tool allows you to easily filter, analyze, and manipulate data in Python dictionaries. It offers a range of features including comparison operators, combining operators, membership operators, and more.
Table of Contents
Quick Start
Here's a simple example to get you started. First, install the package:
pip3 install python-dict-display-filter
Then, use it to filter a list of dictionaries:
from pydictdisplayfilter import DictDisplayFilter
actors = [
{"name": ["Laurence", "Fishburne"], "age": {"born": "1961"}, "gender": "male"},
{"name": ["Keanu", "Reeves"], "age": {"born": "1964"}, "gender": "male", "power": ["flight", "bullet-time"]},
{"name": ["Joe", "Pantoliano"], "age": {"born": "1951"}, "gender": "male"},
{"name": ["Carrie-Anne", "Moss"], "age": {"born": "1967"}, "gender": "female"}
]
ddf = DictDisplayFilter(actors)
# This will filter the list to show only male actors born between 1960 and 1965 whose names end with 'e'
filtered_actors = ddf.filter("gender == male and (age.born > 1960 and age.born < 1965) and name matches .*e$")
print(list(filtered_actors))
[{'name': ['Laurence', 'Fishburne'], 'age': {'born': '1961'}, 'gender': 'male'}]
For more details, please refer to the User Guide.
Features
Python Dictionary Display Filter supports a wide range of features, including:
- Comparison Operators:
==
,!=
,<=
,<
,>=
,>
,~=
,~
,&
- Combining Operators:
and
,or
,xor
,not
- Membership Operators:
in
- Types:
Text
,Number
,Date & Time
,Ethernet-
,IPv4-
,IPv6-Address
- Slicing:
Text
,Ethernet-
,IPv4-
,IPv6-Address
- Functions:
upper
,lower
,len
- Data Sources:
CSV
,Dictionaries
,JSON
,SQLite
For a detailed description of the individual features check out the User Guide.
Examples
For detailed examples of how the display filter can be utilized, please refer to the following:
Acknowledgements
This project wouldn't be possible without these awesome projects:
- wireshark display filter: Display filter for filtering network packages
- parameterized: Parameterized testing with any Python test framework
- pyparsing: Creating PEG-parsers made easy
- ipranger: Parsing and matching IPv4-addresses
- python-dateutil: Parsing and comparing dates
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python-dict-display-filter-0.9.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b1bf08ed9703fc0eb179db13645988c028cd64d3a95a1b80665935e8cc65df6 |
|
MD5 | 347e0a7f63f17792d612bbf275dfe3b1 |
|
BLAKE2b-256 | 0a6e40a9c38acaf8f3403e34b9b8d1a24fb28463dde5f861744f73bffcd14e26 |
Hashes for python_dict_display_filter-0.9.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8201d65c4bcd7f5e75cdf57ebd2304e08078d34109c01c87c18760bd16a7c9b2 |
|
MD5 | 680d99d2bba766d0e51f4d96cabe8626 |
|
BLAKE2b-256 | 2da940cf7a8536dde1995db2ff0cd30cf57b2dfecbd5fb4d70fc77515c554ed9 |