Skip to content

Commit

Permalink
Merge pull request #16 from certego/bug_fix
Browse files Browse the repository at this point in the history
added to_dict() to Results and updated setup.py
  • Loading branch information
ManofWax committed Feb 20, 2024
2 parents 391d519 + 2b34dfc commit 59d4709
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
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

0 comments on commit 59d4709

Please sign in to comment.