Skip to content

Commit

Permalink
feat: add sinks protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
woile committed Apr 2, 2024
1 parent 29a6e89 commit f4e9e03
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ficamp/classifier/google_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def query_gmaps_category(concept):
cached_category = cached.get(concept)
if not cached_category:
try:
#ams = "52.3676,4.9041"
# ams = "52.3676,4.9041"
gmaps_category = find_business_category_in_google(concept)
except GoogleException as error:
print(f"error: {error}")
Expand Down
1 change: 1 addition & 0 deletions src/ficamp/classifier/keywords.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Logic to sort transactions based on keywords.
"""

import json
import pathlib

Expand Down
17 changes: 17 additions & 0 deletions src/ficamp/sinks/protocols.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from enum import Enum
from typing import Protocol

from ficamp.datastructures import Tx


class BaseSinkException(Exception):
"""Base exception for all sink exceptions.
If your sink function is going to raise an exception, it should inherit from this class.
"""

pass


class SinkProtocol(Protocol):
def write(self, transations: list[Tx]): ...
2 changes: 1 addition & 1 deletion tests/test_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
remove_colon,
remove_comma,
remove_digits,
remove_isolated_digits,
remove_pipes,
remove_punctuation,
remove_isolated_digits,
remove_short_words,
)

Expand Down

0 comments on commit f4e9e03

Please sign in to comment.