diff --git a/src/main.py b/src/main.py index c516c073..a4970f80 100644 --- a/src/main.py +++ b/src/main.py @@ -8,10 +8,10 @@ import uvicorn from fastapi import FastAPI # Internal Packages -from search_type import asymmetric, symmetric_ledger, image_search -from utils.helpers import get_from_dict -from utils.cli import cli -from utils.config import SearchType, SearchModels, TextSearchConfig, ImageSearchConfig, SearchConfig +from src.search_type import asymmetric, symmetric_ledger, image_search +from src.utils.helpers import get_from_dict +from src.utils.cli import cli +from src.utils.config import SearchType, SearchModels, TextSearchConfig, ImageSearchConfig, SearchConfig # Application Global State diff --git a/src/processor/ledger/beancount_to_jsonl.py b/src/processor/ledger/beancount_to_jsonl.py index 829df471..0347d34b 100644 --- a/src/processor/ledger/beancount_to_jsonl.py +++ b/src/processor/ledger/beancount_to_jsonl.py @@ -8,8 +8,8 @@ import glob import gzip # Internal Packages -from processor.org_mode import orgnode -from utils.helpers import get_absolute_path, is_none_or_empty +from src.processor.org_mode import orgnode +from src.utils.helpers import get_absolute_path, is_none_or_empty # Define Functions diff --git a/src/processor/org_mode/org_to_jsonl.py b/src/processor/org_mode/org_to_jsonl.py index 9177946e..640915f8 100644 --- a/src/processor/org_mode/org_to_jsonl.py +++ b/src/processor/org_mode/org_to_jsonl.py @@ -8,8 +8,8 @@ import glob import gzip # Internal Packages -from processor.org_mode import orgnode -from utils.helpers import get_absolute_path, is_none_or_empty +from src.processor.org_mode import orgnode +from src.utils.helpers import get_absolute_path, is_none_or_empty # Define Functions diff --git a/src/search_type/asymmetric.py b/src/search_type/asymmetric.py index 3f7785a9..93e6a181 100644 --- a/src/search_type/asymmetric.py +++ b/src/search_type/asymmetric.py @@ -15,9 +15,9 @@ import torch from sentence_transformers import SentenceTransformer, CrossEncoder, util # Internal Packages -from utils.helpers import get_absolute_path, resolve_absolute_path -from processor.org_mode.org_to_jsonl import org_to_jsonl -from utils.config import TextSearchModel, TextSearchConfig +from src.utils.helpers import get_absolute_path, resolve_absolute_path +from src.processor.org_mode.org_to_jsonl import org_to_jsonl +from src.utils.config import TextSearchModel, TextSearchConfig def initialize_model(): @@ -106,7 +106,7 @@ def explicit_filter(hits, entries, required_words, blocked_words): hits_by_word_set = [(set(word.lower() for word in re.split( - ',|\.| |\]|\[\(|\)|\{|\}', + r',|\.| |\]|\[\(|\)|\{|\}', entries[hit['corpus_id']]) if word != ""), hit) diff --git a/src/search_type/image_search.py b/src/search_type/image_search.py index 2dc61b47..a1e5b701 100644 --- a/src/search_type/image_search.py +++ b/src/search_type/image_search.py @@ -10,9 +10,9 @@ from tqdm import trange import torch # Internal Packages -from utils.helpers import get_absolute_path, resolve_absolute_path -import utils.exiftool as exiftool -from utils.config import ImageSearchModel, ImageSearchConfig +from src.utils.helpers import get_absolute_path, resolve_absolute_path +import src.utils.exiftool as exiftool +from src.utils.config import ImageSearchModel, ImageSearchConfig def initialize_model(): diff --git a/src/search_type/symmetric_ledger.py b/src/search_type/symmetric_ledger.py index 41fe040d..a82b9337 100644 --- a/src/search_type/symmetric_ledger.py +++ b/src/search_type/symmetric_ledger.py @@ -13,9 +13,9 @@ import torch from sentence_transformers import SentenceTransformer, CrossEncoder, util # Internal Packages -from utils.helpers import get_absolute_path, resolve_absolute_path -from processor.ledger.beancount_to_jsonl import beancount_to_jsonl -from utils.config import TextSearchModel, TextSearchConfig +from src.utils.helpers import get_absolute_path, resolve_absolute_path +from src.processor.ledger.beancount_to_jsonl import beancount_to_jsonl +from src.utils.config import TextSearchModel, TextSearchConfig def initialize_model(): @@ -98,7 +98,7 @@ def explicit_filter(hits, entries, required_words, blocked_words): hits_by_word_set = [(set(word.lower() for word in re.split( - ',|\.| |\]|\[\(|\)|\{|\}', + r',|\.| |\]|\[\(|\)|\{|\}', entries[hit['corpus_id']]) if word != ""), hit) diff --git a/src/utils/cli.py b/src/utils/cli.py index 25e2578a..4e00d4a4 100644 --- a/src/utils/cli.py +++ b/src/utils/cli.py @@ -6,7 +6,7 @@ import pathlib import yaml # Internal Packages -from utils.helpers import is_none_or_empty, get_absolute_path, resolve_absolute_path, get_from_dict, merge_dicts +from src.utils.helpers import is_none_or_empty, get_absolute_path, resolve_absolute_path, get_from_dict, merge_dicts def cli(args=None): if is_none_or_empty(args): diff --git a/src/utils/config.py b/src/utils/config.py index a0dc9244..16328e37 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from pathlib import Path # Internal Packages -from utils.helpers import get_from_dict +from src.utils.helpers import get_from_dict class SearchType(str, Enum): diff --git a/src/tests/__init__.py b/tests/__init__.py similarity index 100% rename from src/tests/__init__.py rename to tests/__init__.py diff --git a/src/tests/data/config.yml b/tests/data/config.yml similarity index 100% rename from src/tests/data/config.yml rename to tests/data/config.yml diff --git a/src/tests/data/guineapig_grass.jpg b/tests/data/guineapig_grass.jpg similarity index 100% rename from src/tests/data/guineapig_grass.jpg rename to tests/data/guineapig_grass.jpg diff --git a/src/tests/data/horse_dog.jpg b/tests/data/horse_dog.jpg similarity index 100% rename from src/tests/data/horse_dog.jpg rename to tests/data/horse_dog.jpg diff --git a/src/tests/data/interface_emacs_readme.org b/tests/data/interface_emacs_readme.org similarity index 100% rename from src/tests/data/interface_emacs_readme.org rename to tests/data/interface_emacs_readme.org diff --git a/src/tests/data/kitten_park.jpg b/tests/data/kitten_park.jpg similarity index 100% rename from src/tests/data/kitten_park.jpg rename to tests/data/kitten_park.jpg diff --git a/src/tests/data/main_readme.org b/tests/data/main_readme.org similarity index 100% rename from src/tests/data/main_readme.org rename to tests/data/main_readme.org diff --git a/src/tests/test_cli.py b/tests/test_cli.py similarity index 98% rename from src/tests/test_cli.py rename to tests/test_cli.py index 98f6f96a..de2f9753 100644 --- a/src/tests/test_cli.py +++ b/tests/test_cli.py @@ -2,7 +2,7 @@ from pathlib import Path # Internal Packages -from utils.cli import cli +from src.utils.cli import cli # Test diff --git a/src/tests/test_helpers.py b/tests/test_helpers.py similarity index 97% rename from src/tests/test_helpers.py rename to tests/test_helpers.py index 6348d52c..d4f06e6d 100644 --- a/src/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,4 +1,4 @@ -from utils import helpers +from src.utils import helpers def test_get_from_null_dict(): # null handling diff --git a/src/tests/test_main.py b/tests/test_main.py similarity index 95% rename from src/tests/test_main.py rename to tests/test_main.py index c06b9964..aa4c4c24 100644 --- a/src/tests/test_main.py +++ b/tests/test_main.py @@ -6,10 +6,10 @@ import pytest from fastapi.testclient import TestClient # Internal Packages -from main import app, search_config, model -from search_type import asymmetric, image_search -from utils.config import SearchConfig, TextSearchConfig, ImageSearchConfig -from utils.helpers import resolve_absolute_path +from src.main import app, search_config, model +from src.search_type import asymmetric, image_search +from src.utils.config import SearchConfig, TextSearchConfig, ImageSearchConfig +from src.utils.helpers import resolve_absolute_path # Arrange