Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added to_dict() to Results and updated setup.py #16

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2.2.x
### 2.2.0
#### Features
* Added *to_dict()* method to Results class
#### Changes
* Updated *setup.py*

## 2.1.x
### 2.1.0
#### Features
Expand Down
3 changes: 3 additions & 0 deletions routingfilter/filters/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ class Results:
def __init__(self, rules, output):
self.rules = rules
self.output = output

def to_dict(self):
return {"output": self.output, "rules_uid": self.rules}
4 changes: 2 additions & 2 deletions routingfilter/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_stats(self, delete: bool = False) -> dict:
stats = {"streams": self.streams.get_stats(delete), "customer": self.customer.get_stats(delete)}
return stats

def match(self, event: dict, type_: str = "streams", tag_field_name: str = "tags") -> List[Results] | List[None]:
def match(self, event: dict, type_: str = "streams", tag_field_name: str = "tags") -> List[Results]:
"""
Process a single event message and call the right stream match method.

Expand All @@ -51,7 +51,7 @@ def match(self, event: dict, type_: str = "streams", tag_field_name: str = "tags
:param tag_field_name: the event field to search into
:type tag_field_name: str
:return: A list of dictionaries containing the matched rules and the outputs
:rtype: List[dict]
:rtype: List[Results]
"""
# create routing_history if not exists
if "certego" not in event.keys():
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from setuptools import setup
from setuptools import find_packages, setup

with open("README.md", "r") as readme_file:
long_description = readme_file.read()

setup(
name="routingfilter",
version="2.1.0",
packages=["routingfilter"],
version="2.2.0",
packages=find_packages(include=["routingfilter", "routingfilter.*"]),
include_package_data=True,
install_requires=["IPy~=1.1", "macaddress~=2.0.2"],
url="https://github.com/certego/RoutingFilter",
Expand Down
Loading