dragon-ml-toolbox 19.8.2__py3-none-any.whl → 19.9.0__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.
- {dragon_ml_toolbox-19.8.2.dist-info → dragon_ml_toolbox-19.9.0.dist-info}/METADATA +1 -1
- {dragon_ml_toolbox-19.8.2.dist-info → dragon_ml_toolbox-19.9.0.dist-info}/RECORD +7 -7
- ml_tools/_core/_path_manager.py +55 -13
- {dragon_ml_toolbox-19.8.2.dist-info → dragon_ml_toolbox-19.9.0.dist-info}/WHEEL +0 -0
- {dragon_ml_toolbox-19.8.2.dist-info → dragon_ml_toolbox-19.9.0.dist-info}/licenses/LICENSE +0 -0
- {dragon_ml_toolbox-19.8.2.dist-info → dragon_ml_toolbox-19.9.0.dist-info}/licenses/LICENSE-THIRD-PARTY.md +0 -0
- {dragon_ml_toolbox-19.8.2.dist-info → dragon_ml_toolbox-19.9.0.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
dragon_ml_toolbox-19.
|
|
2
|
-
dragon_ml_toolbox-19.
|
|
1
|
+
dragon_ml_toolbox-19.9.0.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
|
|
2
|
+
dragon_ml_toolbox-19.9.0.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=XBLtvGjvBf-q93a5iylHj94Lm78UzInC-3Cii01jc6I,3127
|
|
3
3
|
ml_tools/ETL_cleaning.py,sha256=cKXyRFaaFs_beAGDnQM54xnML671kq-yJEGjHafW-20,351
|
|
4
4
|
ml_tools/ETL_engineering.py,sha256=cwh1FhtNdUHllUDvho-x3SIVj4KwG_rFQR6VYzWUg0U,898
|
|
5
5
|
ml_tools/GUI_tools.py,sha256=O89rG8WQv6GY1DiphQjIsPzXFCQID6te7q_Sgt1iTkQ,294
|
|
@@ -99,13 +99,13 @@ ml_tools/_core/_math_utilities.py,sha256=IlXAiZgTcLtus03jJOBOyF9ZCQDf8qLGjrCHu9M
|
|
|
99
99
|
ml_tools/_core/_models_advanced_base.py,sha256=ceW0V_CcfOnSFqHlxUhVU8-5mtQq4tFyo8TX-xVexrY,4982
|
|
100
100
|
ml_tools/_core/_models_advanced_helpers.py,sha256=yrAVgYdBsNYD6Vy-pYL5__wI9Z7inOvNUngMgyuypjo,38973
|
|
101
101
|
ml_tools/_core/_optimization_tools.py,sha256=2LkntNRc19uGur9u0yI-KnNX56tc63sxaRNj6W440Og,20077
|
|
102
|
-
ml_tools/_core/_path_manager.py,sha256=
|
|
102
|
+
ml_tools/_core/_path_manager.py,sha256=z4zqYqppKhgOj3ArfkKo4tieO8oNaHWUoshCQRNbd1w,20284
|
|
103
103
|
ml_tools/_core/_plot_fonts.py,sha256=CjYXW2gZ9AUaGkyX8_WOXXNYs6d1PTK-nEJBrv_Zb2o,2287
|
|
104
104
|
ml_tools/_core/_schema.py,sha256=TM5WVVMoKOvr_Bc2z34sU_gzKlM465PRKTgdZaEOkGY,14076
|
|
105
105
|
ml_tools/_core/_script_info.py,sha256=21r83LV3RubsNZ_RTEUON6RbDf7Mh4_udweNcvdF_Fk,212
|
|
106
106
|
ml_tools/_core/_serde.py,sha256=tsI4EO2Y7jrBMmbQ1pinDsPOrOg-SaPuB-Dt40q0taE,5609
|
|
107
107
|
ml_tools/_core/_utilities.py,sha256=iA8fLWdhsIx4ut2Dp8M_OyU0Y3PPLgGdIklyl17x6xk,22560
|
|
108
|
-
dragon_ml_toolbox-19.
|
|
109
|
-
dragon_ml_toolbox-19.
|
|
110
|
-
dragon_ml_toolbox-19.
|
|
111
|
-
dragon_ml_toolbox-19.
|
|
108
|
+
dragon_ml_toolbox-19.9.0.dist-info/METADATA,sha256=_EtgLq25qcjnIMmFvPVOfa-xWTp176hHC_VbxFLdWno,8774
|
|
109
|
+
dragon_ml_toolbox-19.9.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
110
|
+
dragon_ml_toolbox-19.9.0.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
|
|
111
|
+
dragon_ml_toolbox-19.9.0.dist-info/RECORD,,
|
ml_tools/_core/_path_manager.py
CHANGED
|
@@ -35,7 +35,8 @@ class DragonPathManager:
|
|
|
35
35
|
def __init__(
|
|
36
36
|
self,
|
|
37
37
|
anchor_file: str,
|
|
38
|
-
base_directories: Optional[List[str]] = None
|
|
38
|
+
base_directories: Optional[List[str]] = None,
|
|
39
|
+
strict_to_root: bool = True
|
|
39
40
|
):
|
|
40
41
|
"""
|
|
41
42
|
Sets up the core paths for a project by anchoring to a specific file.
|
|
@@ -53,14 +54,16 @@ class DragonPathManager:
|
|
|
53
54
|
where each string is the name
|
|
54
55
|
of a subdirectory to register
|
|
55
56
|
relative to the package root.
|
|
57
|
+
strict_to_root (bool): If True, checks that all registered paths are defined within the package ROOT.
|
|
56
58
|
"""
|
|
57
59
|
resolved_anchor_path = Path(anchor_file).resolve()
|
|
58
60
|
self._package_name = resolved_anchor_path.parent.name
|
|
59
61
|
self._is_bundled, bundle_root = self._get_bundle_root()
|
|
60
62
|
self._paths: Dict[str, Path] = {}
|
|
63
|
+
self._strict_to_root = strict_to_root
|
|
61
64
|
|
|
62
65
|
if self._is_bundled:
|
|
63
|
-
# In a PyInstaller bundle, the package is inside the temp _MEIPASS dir
|
|
66
|
+
# In a PyInstaller/Nuitka bundle, the package is inside the temp _MEIPASS dir
|
|
64
67
|
package_root = Path(bundle_root) / self._package_name # type: ignore
|
|
65
68
|
else:
|
|
66
69
|
# In dev mode, the package root is the directory containing the anchor file.
|
|
@@ -182,17 +185,44 @@ class DragonPathManager:
|
|
|
182
185
|
"""
|
|
183
186
|
Checks the status of all registered paths on the filesystem and prints a formatted report.
|
|
184
187
|
"""
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
# 1. Gather Data and determine max widths
|
|
189
|
+
rows = []
|
|
190
|
+
max_key_len = len("Key") # Start with header width
|
|
191
|
+
|
|
192
|
+
# Sort by key for readability
|
|
193
|
+
for key, path in sorted(self.items()):
|
|
187
194
|
if path.is_dir():
|
|
188
|
-
|
|
195
|
+
stat_msg = "📁 Directory"
|
|
189
196
|
elif path.is_file():
|
|
190
|
-
|
|
197
|
+
stat_msg = "📄 File"
|
|
198
|
+
elif not path.exists():
|
|
199
|
+
stat_msg = "❌ Not Found"
|
|
191
200
|
else:
|
|
192
|
-
|
|
201
|
+
stat_msg = "❓ Unknown"
|
|
202
|
+
|
|
203
|
+
rows.append((key, stat_msg, str(path)))
|
|
204
|
+
max_key_len = max(max_key_len, len(key))
|
|
193
205
|
|
|
194
|
-
|
|
195
|
-
|
|
206
|
+
# 2. Print Header
|
|
207
|
+
mode_icon = "📦" if self._is_bundled else "🛠️"
|
|
208
|
+
mode_text = "Bundled Mode" if self._is_bundled else "Development Mode"
|
|
209
|
+
|
|
210
|
+
print(f"\n{'-'*80}")
|
|
211
|
+
print(f" 🐉 DragonPathManager Status Report")
|
|
212
|
+
print(f" Context: {mode_icon} {mode_text}")
|
|
213
|
+
print(f" Root: {self.ROOT}")
|
|
214
|
+
print(f"{'-'*80}")
|
|
215
|
+
|
|
216
|
+
# 3. Print Table Header
|
|
217
|
+
# {variable:<width} aligns text to the left within the padding
|
|
218
|
+
print(f" {'Key':<{max_key_len}} | {'Status':<12} | Path")
|
|
219
|
+
print(f" {'-'*max_key_len} | {'-'*12} | {'-'*40}")
|
|
220
|
+
|
|
221
|
+
# 4. Print Rows
|
|
222
|
+
for key, stat, p_str in rows:
|
|
223
|
+
print(f" {key:<{max_key_len}} | {stat:<12} | {p_str}")
|
|
224
|
+
|
|
225
|
+
print(f"{'-'*80}\n")
|
|
196
226
|
|
|
197
227
|
def __repr__(self) -> str:
|
|
198
228
|
"""Provides a string representation of the stored paths."""
|
|
@@ -276,10 +306,22 @@ class DragonPathManager:
|
|
|
276
306
|
|
|
277
307
|
if not isinstance(value, (str, Path)):
|
|
278
308
|
_LOGGER.error(f"Cannot assign type '{type(value).__name__}' to a path. Must be str or Path.")
|
|
279
|
-
raise TypeError
|
|
280
|
-
|
|
281
|
-
#
|
|
282
|
-
|
|
309
|
+
raise TypeError()
|
|
310
|
+
|
|
311
|
+
# Resolve the new path
|
|
312
|
+
new_path = Path(value).expanduser().absolute()
|
|
313
|
+
|
|
314
|
+
# --- STRICT CHECK ---
|
|
315
|
+
# Only check if strict mode is on
|
|
316
|
+
if self.__dict__.get("_strict_to_root", False) and sanitized_name != "ROOT":
|
|
317
|
+
root_path = self._paths.get("ROOT")
|
|
318
|
+
# Ensure ROOT exists and the new path is inside it
|
|
319
|
+
if root_path and not new_path.is_relative_to(root_path):
|
|
320
|
+
_LOGGER.error(f"Strict Mode Violation: '{name}' ({new_path}) is outside ROOT ({root_path})")
|
|
321
|
+
raise ValueError()
|
|
322
|
+
|
|
323
|
+
# Store absolute Path.
|
|
324
|
+
self._paths[sanitized_name] = new_path
|
|
283
325
|
|
|
284
326
|
|
|
285
327
|
def make_fullpath(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|