A Wireshark-like display filter for dictionaries.
Project description
Python Dictionary Display Filter
Wireshark-like display filter for python dictionaries.
Setup
pip3 install python-dict-display-filter
Usage
The basics and the syntax of the display filter are described in the User Guide.
If you want to see some advanced examples of how python-dict-display-filter
can be put to use checkout the
Examples.
If you want to use python-dict-display-filter
in your own application and customize it to your needs
check out the
Developer Guide.
Features
The following overview shows all the supported features of the display filter:
- 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
For a detailed description of the individual features check out the User Guide.
Examples
Initialize DictDisplayFilter
with 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", "bulle-time"]},
{"name": ["Joe", "Pantoliano"], "age": {"born": "1951"}, "gender": "male"},
{"name": ["Carrie-Anne", "Moss"], "age": {"born": "1967"}, "gender": "female"}
]
> ddf = DictDisplayFilter(actors)
Show only actors with some kind of super-power:
> ddf.filter("power")
Show only actors which were born before 1965:
> ddf.filter("age.born < 1965")
Show only female actors:
> ddf.filter("gender == female")
Show all male actors which are born between 1960 and 1965:
> ddf.filter("gender == male and (age.born > 1960 and age.born < 1965)")
Show all actors which name contain the character 'e':
> ddf.filter("name contains e")
Show all actors which name matches a regular expression:
> ddf.filter("name matches .*e$")
Inspired by
Powered by
- 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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede4ea285f59cd6f20c5853e3b39f6f598e26dc6e03a8ba35207dbd6f90bb45e |
|
MD5 | 159ebc07ef600998e31ac9d09d51aeac |
|
BLAKE2b-256 | 602ff1197b16119bc393e1d9b357a2084db192352603f821b79ae9e4cd8b5ce0 |
Hashes for python_dict_display_filter-0.9.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8152884078dcbf3cf797f72e86fc3625788ac2c356c0ec280506f6599a7686b |
|
MD5 | 57680ca1bf6817095751ec6b6c1b5e07 |
|
BLAKE2b-256 | 9c7d549b7e05aeeb1d8ca5be09a844b8dff7c29d1e2d7d701787f0e471cc5faf |