dragon-ml-toolbox 10.11.1__py3-none-any.whl → 10.11.2__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.

Potentially problematic release.


This version of dragon-ml-toolbox might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 10.11.1
3
+ Version: 10.11.2
4
4
  Summary: A collection of tools for data science and machine learning projects.
5
5
  Author-email: Karl Loza <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
- dragon_ml_toolbox-10.11.1.dist-info/licenses/LICENSE,sha256=2uUFNy7D0TLgHim1K5s3DIJ4q_KvxEXVilnU20cWliY,1066
2
- dragon_ml_toolbox-10.11.1.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=lY4_rJPnLnMu7YBQaY-_iz1JRDcLdQzNCyeLAF1glJY,1837
1
+ dragon_ml_toolbox-10.11.2.dist-info/licenses/LICENSE,sha256=2uUFNy7D0TLgHim1K5s3DIJ4q_KvxEXVilnU20cWliY,1066
2
+ dragon_ml_toolbox-10.11.2.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=lY4_rJPnLnMu7YBQaY-_iz1JRDcLdQzNCyeLAF1glJY,1837
3
3
  ml_tools/ETL_cleaning.py,sha256=lSP5q6-ukGhJBPV8dlsqJvPXAzj4du_0J-SbtEd0Pjg,19292
4
4
  ml_tools/ETL_engineering.py,sha256=a6KCWH6kRatZtjaFEF_o917ApPMK5_vRD-BjfCDAl-E,49400
5
5
  ml_tools/GUI_tools.py,sha256=kEQWg-bog3pB5tI22gMGKWaCGHnz9TB2Lvvfhf5F2CI,45412
@@ -28,9 +28,9 @@ ml_tools/ensemble_learning.py,sha256=3s0kH4i_naj0IVl_T4knst-Hwg4TScWjEdsXX5KAi7I
28
28
  ml_tools/handle_excel.py,sha256=He4UT15sCGhaG-JKfs7uYVAubxWjrqgJ6U7OhMR2fuE,14005
29
29
  ml_tools/keys.py,sha256=FDpbS3Jb0pjrVvvp2_8nZi919mbob_-xwuy5OOtKM_A,1848
30
30
  ml_tools/optimization_tools.py,sha256=P3I6lIpvZ8Xf2kX5FvvBKBmrK2pB6idBpkTzfUJxTeE,5073
31
- ml_tools/path_manager.py,sha256=CCZSlHpUiuaHsMAYcmMGZ9GvbHNbbrTqYFicgWz6pRs,17883
31
+ ml_tools/path_manager.py,sha256=ke0MYOhYheRPX599GUbrvRsYHn2JKUmMDldS5LP6LQA,18431
32
32
  ml_tools/utilities.py,sha256=uheMUjQJ1zI69gASsE-mCq4KlRPVGgrgqson02rGNYM,30755
33
- dragon_ml_toolbox-10.11.1.dist-info/METADATA,sha256=x3e66l1-dXkoE6ldWAH77epdEMnqj6YAvSVKYDVFhHU,6969
34
- dragon_ml_toolbox-10.11.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- dragon_ml_toolbox-10.11.1.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
36
- dragon_ml_toolbox-10.11.1.dist-info/RECORD,,
33
+ dragon_ml_toolbox-10.11.2.dist-info/METADATA,sha256=bBK3PyfNJ-e6nvmGlyHg3HvDLSnmDsKHbo7KwovMWck,6969
34
+ dragon_ml_toolbox-10.11.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ dragon_ml_toolbox-10.11.2.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
36
+ dragon_ml_toolbox-10.11.2.dist-info/RECORD,,
ml_tools/path_manager.py CHANGED
@@ -248,26 +248,33 @@ class PathManager:
248
248
  _LOGGER.error(f"'{type(self).__name__}' object has no attribute or path key '{sanitized_name}'")
249
249
  raise AttributeError()
250
250
 
251
- def __setattr__(self, name: str, value: Union[str, Path]):
251
+ def __setattr__(self, name: str, value: Union[str, Path, bool, dict, str, int, tuple]):
252
252
  """Allows attribute-style setting of paths, e.g., PM.data = 'path/to/data'."""
253
- # Check for internal attributes
253
+ # Check for internal attributes, which are set directly on the object.
254
254
  if name.startswith('_'):
255
- if hasattr(self, '_initialized') and self._initialized:
256
- self._check_underscore_key(name)
257
- return
258
- else:
259
- # During initialization, allow private attributes to be set.
260
- super().__setattr__(name, value)
255
+ # This check prevents setting new private attributes after __init__ is done.
256
+ is_initialized = self.__dict__.get('_initialized', False)
257
+ if is_initialized:
258
+ _LOGGER.error(f"Cannot set private attribute '{name}' after initialization.")
259
+ raise AttributeError()
260
+ super().__setattr__(name, value)
261
261
  return
262
262
 
263
- # Block overwriting of existing methods/attributes
263
+ # Sanitize the key for the public path.
264
264
  sanitized_name = self._sanitize_key(name)
265
265
  self._check_underscore_key(sanitized_name)
266
- if hasattr(self, sanitized_name):
266
+
267
+ # Prevent overwriting existing methods (e.g., PM.status = 'foo').
268
+ # This check looks at the class, not the instance therefore won't trigger __getattr__.
269
+ if hasattr(self.__class__, sanitized_name):
267
270
  _LOGGER.error(f"Cannot overwrite existing attribute or method '{sanitized_name}' ({name}).")
268
271
  raise AttributeError()
272
+
273
+ if not isinstance(value, (str, Path)):
274
+ _LOGGER.error(f"Cannot assign type '{type(value).__name__}' to a path. Must be str or Path.")
275
+ raise TypeError
269
276
 
270
- # If all checks pass, treat it as a public path.
277
+ # If all checks pass, treat it as a public path and store it in the _paths dictionary.
271
278
  self._paths[sanitized_name] = Path(value)
272
279
 
273
280