From 90c9c7479db98d5db245ec3a5901a2b9899e184c Mon Sep 17 00:00:00 2001 From: jonny <32085184+jonnyjohnson1@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:19:12 -0500 Subject: [PATCH] fixed get_root_directory funct --- _conv_cache/cache__shAfFEN2sdSn.pkl | Bin 0 -> 781 bytes pyproject.toml | 3 -- .../basic_analytics/token_classifiers.py | 2 +- topos/utilities/utils.py | 32 +++++++----------- 4 files changed, 14 insertions(+), 23 deletions(-) create mode 100644 _conv_cache/cache__shAfFEN2sdSn.pkl diff --git a/_conv_cache/cache__shAfFEN2sdSn.pkl b/_conv_cache/cache__shAfFEN2sdSn.pkl new file mode 100644 index 0000000000000000000000000000000000000000..e8425f4a800ffbf0d40db65f35eb47e31f7c1bb5 GIT binary patch literal 781 zcmb7CL2DC16qYvaHl@9IEF$A6o{FXvg`#Pi#58JCsH9Xu;$-(FJ9Ktt-8b8I4}o61 z4PG4YMgM?!@*?;n`~hB+f{5TB(6`$v)r)jaJMVq(ecyiH9F|^AOkOC?*x5M@>%%*( zZWV(E%8lJsJGUcx@nF5#gXUVjsFV^d!P!!ZkT_d5A_6o#ik+PaxPknB_Va~n%zDS( z%>2S-?|sERb6d`OG=hATZy9N=sUTEe3I#-9=La02&lQ&$3Zx3!vah2Elp(^g3oqun z%8?HG681p4$AzpZ$p>_?6Px#(okCwH;M%osKi?eD&)JgVxvadIauN-R>LYDD84efh zWVh9G;iY!%_;r1iCI~eRk?vP-{DF81Qj>65z`lO^a9F@nOf7p<-?)BrX|r|hVbn2O zjqU8I+1^<0bxnA8XE0oE779;|^BN&HYucQ(;T7u`h5!+=OsADSU?z(pV4UsiBw&Un zSfBw_#jsFIYN(81489l&pGClxP$MQ3Aq6sDlT`<1k=+MFO}4A_J`+P~LIR8cs3RaG zjetbRDTybgwNmU7wPt}pKSg9ZVQ>&j^76`GQHQg?LtUP(zC8`~JQ*&XBg60SJ|2

*nTkYDH&X1FD{>gBKUQ(I}jlyIF@bm5GPiS?@Da8~Qe*tZUCQtwX literal 0 HcmV?d00001 diff --git a/pyproject.toml b/pyproject.toml index bac1edf..309dfe7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ emoji = "0.6.0" pyyaml = "6.0.1" python-dotenv = "1.0.0" openai = "1.30.4" -<<<<<<< Updated upstream neo4j = "^5.20.0" nltk = "^3.8.1" scikit-learn = "^1.5.0" @@ -39,9 +38,7 @@ pyjwt = "^2.8.0" python-multipart = "^0.0.9" pytest-asyncio = "^0.23.7" textblob = "^0.18.0.post0" -======= tk = "0.1.0" ->>>>>>> Stashed changes [tool.poetry.group.dev.dependencies] pytest = "^7.4.3" diff --git a/topos/services/basic_analytics/token_classifiers.py b/topos/services/basic_analytics/token_classifiers.py index bb33c8e..d67889a 100644 --- a/topos/services/basic_analytics/token_classifiers.py +++ b/topos/services/basic_analytics/token_classifiers.py @@ -7,7 +7,7 @@ from topos.utilities.utils import get_root_directory # Assuming the config.yaml is in ./topos/ relative to setup.py directory -config_path = os.path.join(get_root_directory(), 'topos', 'config.yaml') +config_path = os.path.join(get_root_directory(), 'config.yaml') with open(config_path, 'r') as file: settings = yaml.safe_load(file) diff --git a/topos/utilities/utils.py b/topos/utilities/utils.py index d4e9805..3928b99 100644 --- a/topos/utilities/utils.py +++ b/topos/utilities/utils.py @@ -3,25 +3,19 @@ import os def get_root_directory(): - def find_setup_py_upwards(start_path): - current_path = start_path - while True: - if 'setup.py' in os.listdir(current_path): - return current_path - parent_path = os.path.abspath(os.path.join(current_path, os.pardir)) - if parent_path == current_path: # Reached the root directory - return None - current_path = parent_path - - # Starting from the current directory - current_directory = os.path.abspath('.') - setup_py_dir = find_setup_py_upwards(current_directory) - - if setup_py_dir is None: - raise FileNotFoundError("setup.py not found in the directory tree.") - - return setup_py_dir - + # Get the current file's directory + current_file_directory = os.path.dirname(os.path.abspath(__file__)) + + # Find the first occurrence of "monster" from the right + monster_index = current_file_directory.rfind("topos") + + if monster_index != -1: + # Get the path up to the first "monster" directory + base_monster_directory = current_file_directory[:monster_index + len("topos")] + return base_monster_directory + else: + raise ValueError("The 'topos' directory was not found in the path.") + def parse_json(data): import json return json.loads(data)