aplos-nca-saas-sdk 0.0.22__py3-none-any.whl → 0.0.23__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():
@@ -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
+ from aplos_nca_saas_sdk.utilities.file_utility import FileUtility
13
13
 
14
14
  class EnvironmentServices:
15
15
  """Environment Services"""
@@ -26,8 +26,9 @@ class EnvironmentServices:
26
26
 
27
27
  if not starting_path:
28
28
  starting_path = __file__
29
-
30
- environment_file: str | None = self.find_file(
29
+ fu: FileUtility = FileUtility()
30
+
31
+ environment_file: str | None = fu.find_file(
31
32
  starting_path=starting_path,
32
33
  file_name=file_name,
33
34
  raise_error_if_not_found=raise_error_if_not_found,
@@ -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,
@@ -5,7 +5,8 @@ Property of Aplos Analytics, Utah, USA
5
5
  """
6
6
 
7
7
  import os
8
-
8
+ from pathlib import Path
9
+ from typing import List
9
10
 
10
11
  from aplos_nca_saas_sdk.utilities.environment_services import EnvironmentServices
11
12
 
@@ -31,3 +32,34 @@ class FileUtility:
31
32
  # get the correct os path separator
32
33
  file_path = os.path.normpath(file_path)
33
34
  return file_path
35
+
36
+
37
+ def find_file(
38
+ self, starting_path: str, file_name: str, raise_error_if_not_found: bool = True
39
+ ) -> str | None:
40
+ """Searches the project directory structure for a file"""
41
+
42
+ starting_path = starting_path or __file__
43
+ parents = len(starting_path.split(os.sep)) -1
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
@@ -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.23'
@@ -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.23
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=RAudmyVpGHPDshgqTIVsiJxYPFdyHRiuQlL4vWx4v6c,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=Hq7GzkWIPOYdoUTtI3LSpjdfVoebS4y5W4XmGCXo41I,2750
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=vYtXM5juEOe5A1w9dQd4G96kwVgkSOqwPCbHMM9vrdU,2163
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.23.dist-info/METADATA,sha256=9UCpmWWDtr0VJnERN_RWby5neCrCyMZBIKZg7FunzA8,3792
50
+ aplos_nca_saas_sdk-0.0.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
+ aplos_nca_saas_sdk-0.0.23.dist-info/licenses/LICENSE,sha256=JQMpBrnqu_m2tISmyh6_dTgb8-m3HNnA51fuOh2TzkE,1076
52
+ aplos_nca_saas_sdk-0.0.23.dist-info/RECORD,,