Skip to content

Commit

Permalink
#9 Rebranding
Browse files Browse the repository at this point in the history
  • Loading branch information
bytebutcher committed Jul 7, 2023
1 parent de39123 commit b45b340
Show file tree
Hide file tree
Showing 34 changed files with 166 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Workflow for Codecov python-dict-display-filter
name: Workflow for Codecov pydfql
on: [push, pull_request]
jobs:
run:
Expand Down
82 changes: 44 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,71 @@
<p align="center">
<img src="https://github.com/bytebutcher/python-dict-display-filter/raw/main/images/python_dict_display_filter_logo.png" alt="python_dict_display_filter Logo"/>
<img src="https://github.com/bytebutcher/pydfql/raw/main/images/pydfql_logo.png" alt="pydfql Logo"/>
</p>
<h1 align="center" style="margin-top: 0px;">Python Dictionary Display Filter</h1>
<h1 align="center" style="margin-top: 0px;">Python Display Filter Query Language</h1>
<div align="center">

![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)
![PyPI](https://img.shields.io/pypi/v/python-dict-display-filter)
![GitHub](https://img.shields.io/github/license/bytebutcher/python-dict-display-filter)
![Build Status](https://img.shields.io/travis/com/bytebutcher/python-dict-display-filter)
![Coverage](https://img.shields.io/codecov/c/github/bytebutcher/python-dict-display-filter)
![PyPI](https://img.shields.io/pypi/v/pydfql)
![GitHub](https://img.shields.io/github/license/bytebutcher/pydfql)
![Build Status](https://img.shields.io/travis/com/bytebutcher/pydfql)
![Coverage](https://img.shields.io/codecov/c/github/bytebutcher/pydfql)
</div>
<br>

A Wireshark-like display filter for Python dictionaries and various other data
sources, including objects, lists, and SQL databases.
A Wireshark-like display filter various data formats, including Python dictionaries, lists, objects, and SQL databases.

## Table of Contents
1. [Quick Start](#quick-start)
2. [Features](#features)
3. [Examples](#examples)
4. [Acknowledgements](#acknowledgements)

1.1 [Installation](#installation)

1.2 [Initialization](#initialization)

1.3 [Filtering Data](#filtering-data)

2. [Examples](#examples)
3. [Acknowledgements](#acknowledgements)

## Quick Start

To quickly get started with the python-dictionary-display-filter, follow the steps below:
To quickly get started follow the steps below:

### Installation
First, install the package using pip:

```commandline
pip3 install python-dict-display-filter
pip3 install pydfql
```

### Initialization
Next, import the necessary module and initialize the ```DictDisplayFilter``` with a list of dictionaries:
Next, import the necessary module and initialize the appropriate display filter with some data.
In the example below we are initializing the ```ObjectDisplayFilter``` with a list of objects:
```python
from pydictdisplayfilter import DictDisplayFilter
from pydfql import ObjectDisplayFilter

class Actor:
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender

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"}
Actor(["Laurence", "Fishburne"], {"born": "1961"}, "male"),
Actor(["Keanu", "Reeves"], {"born": "1964"}, "male"),
Actor(["Joe", "Pantoliano"], {"born": "1951"}, "male"),
Actor(["Carrie-Anne", "Moss"], {"born": "1967"}, "female")
]

ddf = DictDisplayFilter(actors)
df = ObjectDisplayFilter(actors)
```

### Filtering Data
Once the ```DictDisplayFilter``` is initialized, you can start filtering the data using the
<a href="https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md#4-query-language">display filter query language</a>.
Once the display filter is initialized, you can start filtering the data using the
<a href="https://github.com/bytebutcher/pydfql/blob/main/docs/USER_GUIDE.md#4-query-language">display filter query language</a>.
For example, let's filter the actors whose birth year is after 1960:
```python
filter_query = "age.born > 1960"
filtered_data = ddf.filter(filter_query)
filtered_data = df.filter(filter_query)
print(list(filtered_data))
[
{"name": ["Laurence", "Fishburne"], "age": {"born": "1961"}, "gender": "male"},
Expand All @@ -67,7 +79,7 @@ For example, let's filter male actors born between 1960 and 1964 whose names end

```python
filter_query = "gender == male and (age.born > 1960 and age.born < 1965) and name matches .*e$"
filtered_data = ddf.filter(filter_query)
filtered_data = df.filter(filter_query)
print(list(filtered_data))
```

Expand All @@ -76,32 +88,26 @@ This will output the filtered data:
[{'name': ['Laurence', 'Fishburne'], 'age': {'born': '1961'}, 'gender': 'male'}]
```

For more details and advanced usage, please refer to the
<a href="https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md">User Guide</a>.

## Features

Python Dictionary Display Filter supports a wide range of features, including:
Overall, PyDFQL supports a wide range of features, including:
* **Data Types**: ```Dictionaries```, ```Lists```, ```Objects```, ```SQL```
* **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```, ```Objects```, ```SQLite```

For a detailed description of the individual features check out the
<a href="https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md">User Guide</a>.
<a href="https://github.com/bytebutcher/pydfql/blob/main/docs/USER_GUIDE.md">User Guide</a>.

## Examples

For detailed examples of how the display filter can be utilized, please refer to the following sections of the
<a href="https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md">User Guide</a>:
For detailed examples of how the display filter can be utilized, please refer to the following:

* [CSV Display Filter](https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md#51-csv-display-filter)
* [JSON Display Filter](https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md#52-json-display-filter)
* [SQLite Display Filter](https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md#53-sqlite-display-filter)
* [Nmap Display Filter](https://github.com/bytebutcher/python-dict-display-filter/blob/main/docs/USER_GUIDE.md#54-nmap-display-filter)
* [CSV Display Filter](https://github.com/bytebutcher/pydfql/blob/main/docs/USER_GUIDE.md#51-csv-display-filter)
* [JSON Display Filter](https://github.com/bytebutcher/pydfql/blob/main/docs/USER_GUIDE.md#52-json-display-filter)
* [SQLite Display Filter](https://github.com/bytebutcher/pydfql/blob/main/docs/USER_GUIDE.md#53-sqlite-display-filter)
* [Nmap Display Filter](https://github.com/bytebutcher/pydfql/blob/main/docs/USER_GUIDE.md#54-nmap-display-filter)

## Acknowledgements

Expand Down
8 changes: 4 additions & 4 deletions docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img src="https://github.com/bytebutcher/python-dict-display-filter/raw/main/images/python_dict_display_filter_logo.png" alt="python_dict_display_filter Logo"/>
<img src="https://github.com/bytebutcher/pydfql/raw/main/images/pydfql_logo.png" alt="pydfql Logo"/>
</p>
<h1 align="center" style="margin-top: 0px;">Python Dictionary Display Filter</br>Developer Guide</h1>
<h1 align="center" style="margin-top: 0px;">Python Display Filter Query Language</br>Developer Guide</h1>
<br>

## Customizing Display Filters
Expand All @@ -19,7 +19,7 @@ parameters:

## Exceptions

The ```python-dict-display-filter``` defines some custom exceptions which may be thrown during runtime:
```pydfql``` defines some custom exceptions which may be thrown during runtime:

| Exception | Description |
|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -29,7 +29,7 @@ The ```python-dict-display-filter``` defines some custom exceptions which may be

## Helpers

The ```python-dict-display-filter``` defines a set of helpers which may be used in standalone applications:
```pydfql``` defines a set of helpers which may be used in standalone applications:

| Helper Class | Description |
|------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
Expand Down
84 changes: 45 additions & 39 deletions docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img src="https://github.com/bytebutcher/python-dict-display-filter/raw/main/images/python_dict_display_filter_logo.png" alt="python_dict_display_filter Logo"/>
<img src="https://github.com/bytebutcher/pydfql/raw/main/images/pydfql_logo.png" alt="pydfql Logo"/>
</p>
<h1 align="center" style="margin-top: 0px;">Python Dictionary Display Filter</br>User Guide</h1>
<h1 align="center" style="margin-top: 0px;">Python Display Filter Query Language</br>User Guide</h1>
<br>

## Table of Contents
Expand Down Expand Up @@ -50,46 +50,47 @@

## 1. Introduction

The Python Dictionary Display Filter library allows filtering data using a custom
The Python Display Filter Query Language allows filtering data using a Wireshark-like
query language. It provides a flexible and efficient way to extract specific information from various data
sources, including dictionaries, objects, lists, and SQL databases.
formats, including dictionaries, objects, lists, and SQL databases.

In this user guide, we will explore the installation process, an overview of how to work with various data sources,
a detailed explanation of the query language, and practical examples to demonstrate real-world usage.
In this user guide, we will explore the installation process, provide an overview of how to work with various data
formats, give a detailed explanation of the query language, and provide practical examples to demonstrate real-world
usage.

By the end of this guide, you will have a comprehensive understanding of the
Python Dictionary Display Filter and be equipped to effectively filter and extract the data you need
Python Display Filter Query Language and be equipped to effectively filter and extract the data you need
from diverse sources.

## 2. Installation

To install the Python Dictionary Display Filter, you can use the pip package manager.
To install ```pydfql``, you can use the pip package manager.
Open your terminal or command prompt and run the following command:
```commandline
pip3 install python-dict-display-filter
pip3 install pydfql
```

Now that you have installed the python-dictionary-display-filter application,
Now that you have installed ```pydfql```,
let's move on to the next section and explore how to quickly get started with it.

## 3. Usage

The Python Dictionary Display Filter library provides support for filtering data from various sources.
While the name may suggest that it primarily works with dictionaries, it actually supports other kinds of data sources
as well. This section will provide an overview of how the Display Filter can be used for different data sources.
The ```pydfql``` library provides support for filtering data from various sources.
This section will provide an overview of how ```pydfql``` can be used for different data sources.

### 3.1 DictDisplayFilter
The ```DictDisplayFilter``` allows to filter a list of dictionaries.

**Example:**

```python
from pydictdisplayfilter import DictDisplayFilter
from pydfql 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"}
{"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"}
]

filter_query = "age.born > 1960 and age.born < 1965"
Expand All @@ -101,20 +102,23 @@ print(list(filtered_data))
The ```ObjectDisplayFilter``` enables filtering a list of objects.

**Example:**

```python
from pydictdisplayfilter import ObjectDisplayFilter
from pydfql import ObjectDisplayFilter


class Actor:
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender


actors = [
Actor(["Laurence", "Fishburne"], {"born": "1961"}, "male"),
Actor(["Keanu", "Reeves"], {"born": "1964"}, "male"),
Actor(["Joe", "Pantoliano"], {"born": "1951"}, "male"),
Actor(["Carrie-Anne", "Moss"], {"born": "1967"}, "female")
Actor(["Laurence", "Fishburne"], {"born": "1961"}, "male"),
Actor(["Keanu", "Reeves"], {"born": "1964"}, "male"),
Actor(["Joe", "Pantoliano"], {"born": "1951"}, "male"),
Actor(["Carrie-Anne", "Moss"], {"born": "1967"}, "female")
]

filter_query = "age.born > 1960"
Expand All @@ -127,14 +131,15 @@ print(list(filtered_data))
The ```ListDisplayFilter``` allows filtering a list of lists.

**Example:**

```python
from pydictdisplayfilter import ListDisplayFilter
from pydfql import ListDisplayFilter

data = [
["Morpheus", "Laurence Fishburne", 38, "male", False],
["Neo", "Keanu Reeves", 35, "male", False],
["Cipher", "Joe Pantoliano", 48, "male", True],
["Trinity", "Carrie-Anne Moss", 32, "female", False]
["Morpheus", "Laurence Fishburne", 38, "male", False],
["Neo", "Keanu Reeves", 35, "male", False],
["Cipher", "Joe Pantoliano", 48, "male", True],
["Trinity", "Carrie-Anne Moss", 32, "female", False]
]

filter_query = "age < 40"
Expand All @@ -148,8 +153,9 @@ print(filtered_data)
The ```SQLDisplayFilter``` allows filtering a SQL database table.

**Example:**

```python
from pydictdisplayfilter import SQLDisplayFilter
from pydfql import SQLDisplayFilter
import sqlite3

database_file = './data/sqlite_example.sqlite'
Expand All @@ -163,7 +169,7 @@ print(filtered_data)

## 4. Query Language

The query language in the python-dict-display-filter library provides a wide range of operations, comparisons, and
The query language provides a wide range of operations, comparisons, and
logical operators to help retrieving the desired subset of data.
This section introduces the query language and its components, including fields, comparisons, field types,
combining expressions, slice operator, membership operator, and functions.
Expand Down Expand Up @@ -401,7 +407,7 @@ The display filter language has a number of functions to convert fields:
## 5. Examples

In this section, we will walk through various examples to demonstrate the practical usage of the
python-dictionary-display-filter.
```pydfql```.

### 5.1 CSV Display Filter

Expand All @@ -428,7 +434,7 @@ Neo | 35 | male | False
1 row in set (0.01 secs)
```

See <a href="https://github.com/bytebutcher/python-dict-display-filter/raw/main/examples/csv_display_filter.py">examples/csv_display_filter.py</a> for implementation details.
See <a href="https://github.com/bytebutcher/pydfql/raw/main/examples/csv_display_filter.py">examples/csv_display_filter.py</a> for implementation details.


### 5.2 JSON Display Filter
Expand All @@ -453,7 +459,7 @@ age.born
1 row in set (0.01 secs)
```

See <a href="https://github.com/bytebutcher/python-dict-display-filter/raw/main/examples/json_display_filter.py">examples/json_display_filter.py</a> for implementation details.
See <a href="https://github.com/bytebutcher/pydfql/raw/main/examples/json_display_filter.py">examples/json_display_filter.py</a> for implementation details.

### 5.3 Nmap Display Filter

Expand Down Expand Up @@ -495,7 +501,7 @@ host | port | protocol | status | service
6 rows in set (0.01 secs)
```

See <a href="https://github.com/bytebutcher/python-dict-display-filter/raw/main/examples/nmap_display_filter.py">examples/nmap_display_filter.py</a> for implementation details.
See <a href="https://github.com/bytebutcher/pydfql/raw/main/examples/nmap_display_filter.py">examples/nmap_display_filter.py</a> for implementation details.

### 5.4 SQLite Display Filter

Expand Down Expand Up @@ -531,7 +537,7 @@ Neo | Keanu Reeves | 35 | male | 0
1 row in set (0.01 secs)
```

See <a href="https://github.com/bytebutcher/python-dict-display-filter/raw/main/examples/sqlite_display_filter.py">examples/sqlite_display_filter.py</a> for implementation details.
See <a href="https://github.com/bytebutcher/pydfql/raw/main/examples/sqlite_display_filter.py">examples/sqlite_display_filter.py</a> for implementation details.


## 6. Acknowledgements
Expand Down
4 changes: 2 additions & 2 deletions examples/csv_display_filter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vim: ts=8:sts=8:sw=8:noexpandtab
#
# This file is part of python-dict-display-filter.
# This file is part of pydfql.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -21,7 +21,7 @@
import sys
import traceback

from pydictdisplayfilter.helpers import DictDisplayFilterShell
from pydfql.helpers import DictDisplayFilterShell


def read_csv_file(csv_file):
Expand Down
Loading

0 comments on commit b45b340

Please sign in to comment.