data-manipulation-utilities 0.2.8.dev733__py3-none-any.whl → 0.2.8.dev736__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: data-manipulation-utilities
3
- Version: 0.2.8.dev733
3
+ Version: 0.2.8.dev736
4
4
  Summary: Project storing utilities needed to reduce boilerplate code when analyzing data
5
5
  Requires-Python: >=3.10,<3.13
6
6
  Classifier: Programming Language :: Python :: 3
@@ -39,7 +39,7 @@ dmu/stats/zfit_plotter.py,sha256=gbN5KxhJcP4ItCi98c-fj5_UtvVWL_NA9jkTHiRjvnE,238
39
39
  dmu/testing/utilities.py,sha256=WYlz7Ve5lQjuWhhNL4gWe6_qcByBLV762Lhrc6A0P9E,7421
40
40
  dmu/text/transformer.py,sha256=4lrGknbAWRm0-rxbvgzOO-eR1-9bkYk61boJUEV3cQ0,6100
41
41
  dmu/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- dmu/workflow/cache.py,sha256=CtkGwxuF4UJlD55SmUJcRgWYLsbZOyUvYLI8oTVzk_g,8768
42
+ dmu/workflow/cache.py,sha256=so9BZt03vxNGHKcDPYpzz4T-CsLPUMmj_3EO3HXpLIc,8947
43
43
  dmu_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  dmu_data/ml/tests/diagnostics_from_file.yaml,sha256=quvXOPkRducnBsctyape_Rn5_aqMEpPo6nO_UweMORo,404
45
45
  dmu_data/ml/tests/diagnostics_from_model.yaml,sha256=rtCQlmGS9ld2xoQJEE35nA07yfRMklEfQEW0w3gRv2A,261
@@ -77,7 +77,7 @@ dmu_data/text/transform.txt,sha256=EX760da6Vkf-_EPxnQlC5hGSkfFhJCCGCD19NU-1Qto,4
77
77
  dmu_data/text/transform_set.toml,sha256=Jeh7BTz82idqvbOQJtl9-ur56mZkzDn5WtvmIb48LoE,150
78
78
  dmu_data/text/transform_set.txt,sha256=1KivMoP9LxPn9955QrRmOzjEqduEjhTetQ9MXykO5LY,46
79
79
  dmu_data/text/transform_trf.txt,sha256=zxBRTgcSmX7RdqfmWF88W1YqbyNHa4Ccruf1MmnYv2A,74
80
- data_manipulation_utilities-0.2.8.dev733.dist-info/METADATA,sha256=v5qmztFZBzoriqplP_EvZ5nhowvDKXS7dchJQ6QNgHQ,51716
81
- data_manipulation_utilities-0.2.8.dev733.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
82
- data_manipulation_utilities-0.2.8.dev733.dist-info/entry_points.txt,sha256=M0C8_u9B_xSmyfemdPwdIBh9QuPIkjhEpG060Y5_Pjw,321
83
- data_manipulation_utilities-0.2.8.dev733.dist-info/RECORD,,
80
+ data_manipulation_utilities-0.2.8.dev736.dist-info/METADATA,sha256=TmvJPwuZT1s9sA0IVrkUpNhQaTjzj9rFEm-cTan915U,51716
81
+ data_manipulation_utilities-0.2.8.dev736.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
82
+ data_manipulation_utilities-0.2.8.dev736.dist-info/entry_points.txt,sha256=M0C8_u9B_xSmyfemdPwdIBh9QuPIkjhEpG060Y5_Pjw,321
83
+ data_manipulation_utilities-0.2.8.dev736.dist-info/RECORD,,
dmu/workflow/cache.py CHANGED
@@ -63,19 +63,6 @@ class Cache:
63
63
  self._cache_dir = self._get_dir(kind='cache')
64
64
  self._hash_dir : str
65
65
  # ---------------------------
66
- @classmethod
67
- def set_cache_root(cls, root : str) -> None:
68
- '''
69
- Sets the path to the directory WRT which the _out_path_
70
- will be placed
71
- '''
72
- if cls._cache_root is not None:
73
- raise ValueError(f'Trying to set {root}, but already found {cls._cache_root}')
74
-
75
- os.makedirs(root, exist_ok=True)
76
-
77
- cls._cache_root = root
78
- # ---------------------------
79
66
  def _get_code_hash(self) -> str:
80
67
  '''
81
68
  If `MyTool` inherits from `Cache`. `mytool.py` git commit hash
@@ -242,9 +229,8 @@ class Cache:
242
229
 
243
230
  return True
244
231
  # ---------------------------
245
- @contextmanager
246
- @staticmethod
247
- def turn_off_cache(val : list[str]|None):
232
+ @classmethod
233
+ def turn_off_cache(cls, val):
248
234
  '''
249
235
  Parameters
250
236
  ------------------
@@ -256,11 +242,30 @@ class Cache:
256
242
  log.error('This manager expects: list[str]|None')
257
243
  raise ValueError(f'Invalid value: {val}')
258
244
 
259
- old_val = Cache._l_skip_class
245
+ old_val = cls._l_skip_class
246
+ @contextmanager
247
+ def _context():
248
+ cls._l_skip_class = val
249
+ try:
250
+ yield
251
+ finally:
252
+ cls._l_skip_class = old_val
260
253
 
261
- Cache._l_skip_class = val
262
- try:
263
- yield
264
- finally:
265
- Cache._l_skip_class = old_val
254
+ return _context()
255
+ # ---------------------------
256
+ @classmethod
257
+ def set_cache_root(cls, root : str) -> None:
258
+ '''
259
+ Sets the path to the directory WRT which the _out_path_
260
+ will be placed.
261
+
262
+ This is meant to be called once per execution and has a lock
263
+ that will raise an exception if called twice
264
+ '''
265
+ if cls._cache_root is not None:
266
+ raise ValueError(f'Trying to set {root}, but already found {cls._cache_root}')
267
+
268
+ os.makedirs(root, exist_ok=True)
269
+
270
+ cls._cache_root = root
266
271
  # ---------------------------