Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ yarn-error.log*
pnpm-lock.yaml
package-lock.json
uv.lock
jsons/client_id.json
credentials.json
jsons/apikey.json

# Python caches and artifacts
__pycache__/
Expand Down
10 changes: 9 additions & 1 deletion backend/python_nlp/smart_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@

import json
import logging
import os
import re
import sqlite3
from collections import Counter, defaultdict
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Set

# Project root directory
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))


@dataclass
class EmailFilter:
Expand Down Expand Up @@ -86,8 +90,12 @@ class SmartFilterManager:
of email filters, using a SQLite database for persistence.
"""

def __init__(self, db_path: str = "smart_filters.db"):
def __init__(self, db_path: str = None):
"""Initializes the SmartFilterManager."""
if db_path is None:
db_path = os.path.join(ROOT_DIR, "smart_filters.db")
elif not os.path.isabs(db_path):
db_path = os.path.join(ROOT_DIR, db_path)
self.db_path = db_path
self.logger = logging.getLogger(__name__)
self.conn = None
Expand Down
6 changes: 6 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exclude = '''
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| venv
| _build
| buck-out
| build
Expand Down
2 changes: 1 addition & 1 deletion setup_linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def create_config_files():
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| venv
| _build
| buck-out
| build
Expand Down
Loading