aplos-nca-saas-sdk 0.0.22__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.
@@ -13,7 +13,7 @@ from typing import List
13
13
  from dotenv import load_dotenv
14
14
 
15
15
  from aplos_nca_saas_sdk.utilities.environment_vars import EnvironmentVars
16
-
16
+ from aplos_nca_saas_sdk.utilities.file_utility import FileUtility
17
17
  # load the environment (.env) file if any
18
18
  # this may or may not be the desired results
19
19
  load_dotenv(override=True)
@@ -254,29 +254,7 @@ class CommandlineArgs:
254
254
 
255
255
  return user_input
256
256
 
257
- def find_file(
258
- self, starting_path: str, file_name: str, raise_error_if_not_found: bool = True
259
- ) -> str | None:
260
- """Searches the project directory structor for a file"""
261
-
262
- starting_path = starting_path or __file__
263
- parents = len(starting_path.split(os.sep)) -1
264
- paths: List[str] = []
265
- for parent in range(parents):
266
- path = Path(starting_path).parents[parent].absolute()
267
-
268
- tmp = os.path.join(path, file_name)
269
- paths.append(tmp)
270
- if os.path.exists(tmp):
271
- return tmp
272
-
273
- if raise_error_if_not_found:
274
- searched_paths = "\n".join(paths)
275
- raise RuntimeError(
276
- f"Failed to locate environment file: {file_name} in: \n {searched_paths}"
277
- )
278
-
279
- return None
257
+
280
258
 
281
259
  def check_for_environment_config(self):
282
260
  """Attempts to load an environment file"""
@@ -287,7 +265,8 @@ class CommandlineArgs:
287
265
 
288
266
  if not env_file_path.exists():
289
267
  # Try to find the file
290
- file = self.find_file(__file__, env_file_path.name)
268
+ fu: FileUtility = FileUtility()
269
+ file = fu.find_file(__file__, env_file_path.name)
291
270
  file_path = Path(str(file))
292
271
 
293
272
  if not file_path.exists():
@@ -26,7 +26,8 @@ class EnvironmentServices:
26
26
 
27
27
  if not starting_path:
28
28
  starting_path = __file__
29
-
29
+
30
+
30
31
  environment_file: str | None = self.find_file(
31
32
  starting_path=starting_path,
32
33
  file_name=file_name,
@@ -57,29 +58,7 @@ class EnvironmentServices:
57
58
 
58
59
  return event
59
60
 
60
- def find_file(
61
- self, starting_path: str, file_name: str, raise_error_if_not_found: bool = True
62
- ) -> str | None:
63
- """Searches the project directory structure for a file"""
64
-
65
- starting_path = starting_path or __file__
66
- parents = len(starting_path.split(os.sep)) -1
67
- paths: List[str] = []
68
- for parent in range(parents):
69
- path = Path(starting_path).parents[parent].absolute()
70
-
71
- tmp = os.path.join(path, file_name)
72
- paths.append(tmp)
73
- if os.path.exists(tmp):
74
- return tmp
75
-
76
- if raise_error_if_not_found:
77
- searched_paths = "\n".join(paths)
78
- raise RuntimeError(
79
- f"Failed to locate environment file: {file_name} in: \n {searched_paths}"
80
- )
81
-
82
- return None
61
+
83
62
 
84
63
  def find_module_path(
85
64
  self,
@@ -108,3 +87,33 @@ class EnvironmentServices:
108
87
  )
109
88
 
110
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
@@ -6,7 +6,6 @@ Property of Aplos Analytics, Utah, USA
6
6
 
7
7
  import os
8
8
 
9
-
10
9
  from aplos_nca_saas_sdk.utilities.environment_services import EnvironmentServices
11
10
 
12
11
 
@@ -31,3 +30,12 @@ class FileUtility:
31
30
  # get the correct os path separator
32
31
  file_path = os.path.normpath(file_path)
33
32
  return file_path
33
+
34
+
35
+ def find_file(
36
+ self, starting_path: str, file_name: str, raise_error_if_not_found: bool = True
37
+ ) -> str | None:
38
+ """Searches the project directory structure for a file"""
39
+
40
+ es: EnvironmentServices = EnvironmentServices()
41
+ return es.find_file(starting_path, file_name, raise_error_if_not_found)
@@ -1,4 +1,4 @@
1
1
  # Aplos NCA SaaS SDK Version File
2
2
  # This is automatically generated during the build process.
3
3
  # DO NOT UPDATE IT DIRECTLY. IT WILL BE OVERWRITTEN.
4
- __version__ = '0.0.22'
4
+ __version__ = '0.0.24'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aplos_nca_saas_sdk
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: Aplos NCA SaaS SDK
5
5
  Project-URL: Homepage, https://aplosanalytics.com/
6
6
  Project-URL: Documentation, https://docs.aplosanalytics.com/
@@ -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=gOKyPzMwi8E4tXQBz77NiqUoiJj1L1M3ybEtodYU4Bg,172
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
@@ -41,12 +41,12 @@ aplos_nca_saas_sdk/nca_resources/nca_validations.py,sha256=b9i-kXH52tXezgzOCwi9D
41
41
  aplos_nca_saas_sdk/sample_files/analysis_files/single_ev/config.json,sha256=lLnRV0jwzaSn32D8NlOekOF5oGFfUwugUlvlwoKz540,986
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
- aplos_nca_saas_sdk/utilities/commandline_args.py,sha256=zQSxUF_N1c8w61fw9_e1pb2vZd5C6B0wqCdHnlkSQu4,10954
45
- aplos_nca_saas_sdk/utilities/environment_services.py,sha256=b4FGtdZshidrutE8K3RmVRazBRZ_Z84XQAhw1hsaYNo,3458
44
+ aplos_nca_saas_sdk/utilities/commandline_args.py,sha256=iia2g0sdPfg637GV8PuddRNUAtg46GdmlDx4OJ0iS-s,10242
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=EUvQ65aXN6OdILniuiDQ2rPRA9sFmvUoAehifEjRgUY,1025
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.22.dist-info/METADATA,sha256=aRoTCWp4-UOQQZPgISA9aMzLzMyWBo70Y0phyXqXMts,3792
50
- aplos_nca_saas_sdk-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
- aplos_nca_saas_sdk-0.0.22.dist-info/licenses/LICENSE,sha256=JQMpBrnqu_m2tISmyh6_dTgb8-m3HNnA51fuOh2TzkE,1076
52
- aplos_nca_saas_sdk-0.0.22.dist-info/RECORD,,
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,,