aplos-nca-saas-sdk 0.0.23__py3-none-any.whl → 0.0.24__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aplos_nca_saas_sdk/utilities/environment_services.py +33 -3
- aplos_nca_saas_sdk/utilities/file_utility.py +2 -26
- aplos_nca_saas_sdk/version.py +1 -1
- {aplos_nca_saas_sdk-0.0.23.dist-info → aplos_nca_saas_sdk-0.0.24.dist-info}/METADATA +1 -1
- {aplos_nca_saas_sdk-0.0.23.dist-info → aplos_nca_saas_sdk-0.0.24.dist-info}/RECORD +7 -7
- {aplos_nca_saas_sdk-0.0.23.dist-info → aplos_nca_saas_sdk-0.0.24.dist-info}/WHEEL +0 -0
- {aplos_nca_saas_sdk-0.0.23.dist-info → aplos_nca_saas_sdk-0.0.24.dist-info}/licenses/LICENSE +0 -0
@@ -9,7 +9,7 @@ import json
|
|
9
9
|
from typing import Dict, List, Any
|
10
10
|
from pathlib import Path
|
11
11
|
from dotenv import load_dotenv
|
12
|
-
|
12
|
+
|
13
13
|
|
14
14
|
class EnvironmentServices:
|
15
15
|
"""Environment Services"""
|
@@ -26,9 +26,9 @@ class EnvironmentServices:
|
|
26
26
|
|
27
27
|
if not starting_path:
|
28
28
|
starting_path = __file__
|
29
|
-
fu: FileUtility = FileUtility()
|
30
29
|
|
31
|
-
|
30
|
+
|
31
|
+
environment_file: str | None = self.find_file(
|
32
32
|
starting_path=starting_path,
|
33
33
|
file_name=file_name,
|
34
34
|
raise_error_if_not_found=raise_error_if_not_found,
|
@@ -87,3 +87,33 @@ class EnvironmentServices:
|
|
87
87
|
)
|
88
88
|
|
89
89
|
return None
|
90
|
+
|
91
|
+
def find_file(
|
92
|
+
self, starting_path: str, file_name: str, raise_error_if_not_found: bool = True
|
93
|
+
) -> str | None:
|
94
|
+
"""Searches the project directory structure for a file"""
|
95
|
+
|
96
|
+
starting_path = starting_path or __file__
|
97
|
+
parents = len(starting_path.split(os.sep)) -1
|
98
|
+
paths: List[str] = []
|
99
|
+
for parent in range(parents):
|
100
|
+
try:
|
101
|
+
path = Path(starting_path).parents[parent].absolute()
|
102
|
+
|
103
|
+
tmp = os.path.join(path, file_name)
|
104
|
+
paths.append(tmp)
|
105
|
+
if os.path.exists(tmp):
|
106
|
+
return tmp
|
107
|
+
except Exception as e:
|
108
|
+
print(f"Error {str(e)}")
|
109
|
+
print(f"Failed to find the file: {file_name}.")
|
110
|
+
print(f'Searched: {"\n".join(paths)}.')
|
111
|
+
|
112
|
+
|
113
|
+
if raise_error_if_not_found:
|
114
|
+
searched_paths = "\n".join(paths)
|
115
|
+
raise RuntimeError(
|
116
|
+
f"Failed to locate environment file: {file_name} in: \n {searched_paths}"
|
117
|
+
)
|
118
|
+
|
119
|
+
return None
|
@@ -5,8 +5,6 @@ Property of Aplos Analytics, Utah, USA
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import os
|
8
|
-
from pathlib import Path
|
9
|
-
from typing import List
|
10
8
|
|
11
9
|
from aplos_nca_saas_sdk.utilities.environment_services import EnvironmentServices
|
12
10
|
|
@@ -39,27 +37,5 @@ class FileUtility:
|
|
39
37
|
) -> str | None:
|
40
38
|
"""Searches the project directory structure for a file"""
|
41
39
|
|
42
|
-
|
43
|
-
|
44
|
-
paths: List[str] = []
|
45
|
-
for parent in range(parents):
|
46
|
-
try:
|
47
|
-
path = Path(starting_path).parents[parent].absolute()
|
48
|
-
|
49
|
-
tmp = os.path.join(path, file_name)
|
50
|
-
paths.append(tmp)
|
51
|
-
if os.path.exists(tmp):
|
52
|
-
return tmp
|
53
|
-
except Exception as e:
|
54
|
-
print(f"Error {str(e)}")
|
55
|
-
print(f"Failed to find the file: {file_name}.")
|
56
|
-
print(f'Searched: {"\n".join(path)}.')
|
57
|
-
|
58
|
-
|
59
|
-
if raise_error_if_not_found:
|
60
|
-
searched_paths = "\n".join(paths)
|
61
|
-
raise RuntimeError(
|
62
|
-
f"Failed to locate environment file: {file_name} in: \n {searched_paths}"
|
63
|
-
)
|
64
|
-
|
65
|
-
return None
|
40
|
+
es: EnvironmentServices = EnvironmentServices()
|
41
|
+
return es.find_file(starting_path, file_name, raise_error_if_not_found)
|
aplos_nca_saas_sdk/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
aplos_nca_saas_sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
aplos_nca_saas_sdk/run_analysis_execution.py,sha256=H425VMCtxIX1vlWac0Wex2CJXVzQQwgv5AGNCpaVqN4,4446
|
3
|
-
aplos_nca_saas_sdk/version.py,sha256=
|
3
|
+
aplos_nca_saas_sdk/version.py,sha256=VXhxq2KBBxSTjGA5lIw5x1NtuFQBxEFFmPDvlV3AQn0,172
|
4
4
|
aplos_nca_saas_sdk/integration_testing/example_main.py,sha256=9SXu8s7B4MLe53WDkr0GuMu8h4oyfmltYOH1XT_fqC4,2500
|
5
5
|
aplos_nca_saas_sdk/integration_testing/integration_test_base.py,sha256=ci3oOfz_McdDKGSrqOHF7F_vrvgTWo7HzxydNdPSHLs,2787
|
6
6
|
aplos_nca_saas_sdk/integration_testing/integration_test_configurations.py,sha256=GRDHSy0ZiAJtZQvL7uPlYG2oYVo9nWlP7hNZbNnrz7U,1900
|
@@ -42,11 +42,11 @@ aplos_nca_saas_sdk/sample_files/analysis_files/single_ev/config.json,sha256=lLnR
|
|
42
42
|
aplos_nca_saas_sdk/sample_files/analysis_files/single_ev/input.csv,sha256=qFSAlgLOmERsabMmp1X6PAZa-8yFthZlHacM_f7_AOY,6528
|
43
43
|
aplos_nca_saas_sdk/sample_files/analysis_files/single_ev/meta_data.json,sha256=p1KYOAe5Cl3rjtfF1t96oRG-QtFJJCo9otReRPNtvIk,447
|
44
44
|
aplos_nca_saas_sdk/utilities/commandline_args.py,sha256=iia2g0sdPfg637GV8PuddRNUAtg46GdmlDx4OJ0iS-s,10242
|
45
|
-
aplos_nca_saas_sdk/utilities/environment_services.py,sha256=
|
45
|
+
aplos_nca_saas_sdk/utilities/environment_services.py,sha256=dCdUSL1GAzvCVLpkgRLnG3Z-h5wAi27SldeQHvH007o,3746
|
46
46
|
aplos_nca_saas_sdk/utilities/environment_vars.py,sha256=aXheFXg6FVMaSYLe2LmoWRF5Ks9vwxDazO4XYb4vLjc,1132
|
47
|
-
aplos_nca_saas_sdk/utilities/file_utility.py,sha256=
|
47
|
+
aplos_nca_saas_sdk/utilities/file_utility.py,sha256=J4cN0zizcA-oZnALu1ICiImi_KcIzN1yQ0Bj0lfpeX4,1364
|
48
48
|
aplos_nca_saas_sdk/utilities/http_utility.py,sha256=DQ-ClLOmNoyPn5vhrSh4q-2wi4ViP_gplJD9asEKDM8,464
|
49
|
-
aplos_nca_saas_sdk-0.0.
|
50
|
-
aplos_nca_saas_sdk-0.0.
|
51
|
-
aplos_nca_saas_sdk-0.0.
|
52
|
-
aplos_nca_saas_sdk-0.0.
|
49
|
+
aplos_nca_saas_sdk-0.0.24.dist-info/METADATA,sha256=rrw6LHlnlYnRLrgB81u1nJX-QYsdcZT_BzJVv9rnBo0,3792
|
50
|
+
aplos_nca_saas_sdk-0.0.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
51
|
+
aplos_nca_saas_sdk-0.0.24.dist-info/licenses/LICENSE,sha256=JQMpBrnqu_m2tISmyh6_dTgb8-m3HNnA51fuOh2TzkE,1076
|
52
|
+
aplos_nca_saas_sdk-0.0.24.dist-info/RECORD,,
|
File without changes
|
{aplos_nca_saas_sdk-0.0.23.dist-info → aplos_nca_saas_sdk-0.0.24.dist-info}/licenses/LICENSE
RENAMED
File without changes
|