junifer 0.0.6.dev213__py3-none-any.whl → 0.0.6.dev219__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.
junifer/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.0.6.dev213'
16
- __version_tuple__ = version_tuple = (0, 0, 6, 'dev213')
15
+ __version__ = version = '0.0.6.dev219'
16
+ __version_tuple__ = version_tuple = (0, 0, 6, 'dev219')
@@ -102,3 +102,45 @@ def test_workdir_manager_get_and_delete_tempdir(tmp_path: Path) -> None:
102
102
  workdir_mgr._cleanup()
103
103
  # Should remove temporary directory
104
104
  assert workdir_mgr.root_tempdir is None
105
+
106
+ def test_workdir_manager_no_cleanup(tmp_path: Path) -> None:
107
+ """Test WorkDirManager correctly bypasses cleanup.
108
+
109
+ Parameters
110
+ ----------
111
+ tmp_path : pathlib.Path
112
+ The path to the test directory.
113
+
114
+ """
115
+ workdir_mgr = WorkDirManager(cleanup=False)
116
+ workdir_mgr.workdir = tmp_path
117
+ # Check no root temporary directory
118
+ assert workdir_mgr.root_tempdir is None
119
+
120
+ tempdir = workdir_mgr.get_tempdir()
121
+ assert tempdir.exists()
122
+ # Should create a temporary directory
123
+ assert workdir_mgr.root_tempdir is not None
124
+
125
+ workdir_mgr.delete_tempdir(tempdir)
126
+ workdir_mgr._cleanup()
127
+
128
+ # Should remove temporary directory
129
+ assert workdir_mgr.root_tempdir is None
130
+ # But the temporary directory should still exist
131
+ assert tempdir.exists()
132
+
133
+ # Now the same but for the element directory
134
+
135
+ # Check no element directory
136
+ assert workdir_mgr.elementdir is None
137
+
138
+ tempdir = workdir_mgr.get_element_tempdir()
139
+ # Should create a temporary directory
140
+ assert workdir_mgr.elementdir is not None
141
+
142
+ workdir_mgr.cleanup_elementdir()
143
+ # Should remove temporary directory
144
+ assert workdir_mgr.elementdir is None
145
+ # But the temporary directory should still exist
146
+ assert tempdir.exists()
@@ -39,15 +39,20 @@ class WorkDirManager(metaclass=Singleton):
39
39
  The path to the element directory.
40
40
  root_tempdir : pathlib.Path or None
41
41
  The path to the root temporary directory.
42
+ cleanup : bool, optional
43
+ If False, the directories are not cleaned up after the object is
44
+ destroyed. This is useful for debugging purposes (default True).
42
45
 
43
46
  """
44
47
 
45
- def __init__(self, workdir: Optional[Union[str, Path]] = None) -> None:
48
+ def __init__(
49
+ self, workdir: Optional[Union[str, Path]] = None, cleanup=True
50
+ ) -> None:
46
51
  """Initialize the class."""
47
52
  self._workdir = Path(workdir) if isinstance(workdir, str) else workdir
48
53
  self._elementdir = None
49
54
  self._root_tempdir = None
50
-
55
+ self._cleanup_dirs = cleanup
51
56
  self._set_default_workdir()
52
57
 
53
58
  def _set_default_workdir(self) -> None:
@@ -72,6 +77,9 @@ class WorkDirManager(metaclass=Singleton):
72
77
 
73
78
  def _cleanup(self) -> None:
74
79
  """Clean up the element and temporary directories."""
80
+ if self._cleanup_dirs is False:
81
+ self._root_tempdir = None
82
+ return
75
83
  # Remove element directory
76
84
  self.cleanup_elementdir()
77
85
  # Remove root temporary directory
@@ -171,6 +179,8 @@ class WorkDirManager(metaclass=Singleton):
171
179
  The temporary directory path to be deleted.
172
180
 
173
181
  """
182
+ if self._cleanup_dirs is False:
183
+ return
174
184
  logger.debug(f"Deleting element temporary directory at {tempdir}")
175
185
  shutil.rmtree(tempdir, ignore_errors=True)
176
186
 
@@ -182,6 +192,9 @@ class WorkDirManager(metaclass=Singleton):
182
192
  can lead to required intermediate files not being found.
183
193
 
184
194
  """
195
+ if self._cleanup_dirs is False:
196
+ self._elementdir = None
197
+ return
185
198
  if self._elementdir is not None:
186
199
  logger.debug(
187
200
  "Deleting element directory at "
@@ -244,5 +257,7 @@ class WorkDirManager(metaclass=Singleton):
244
257
  The temporary directory path to be deleted.
245
258
 
246
259
  """
260
+ if self._cleanup_dirs is False:
261
+ return
247
262
  logger.debug(f"Deleting temporary directory at {tempdir}")
248
263
  shutil.rmtree(tempdir, ignore_errors=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: junifer
3
- Version: 0.0.6.dev213
3
+ Version: 0.0.6.dev219
4
4
  Summary: JUelich NeuroImaging FEature extractoR
5
5
  Author-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
6
6
  Maintainer-email: Fede Raimondo <f.raimondo@fz-juelich.de>, Synchon Mandal <s.mandal@fz-juelich.de>
@@ -1,6 +1,6 @@
1
1
  junifer/__init__.py,sha256=2McgH1yNue6Z1V26-uN_mfMjbTcx4CLhym-DMBl5xA4,266
2
2
  junifer/__init__.pyi,sha256=uPLuY27S7AY4kFzJX0ncCpzHnWJdztveMJpY3Di-wwQ,482
3
- junifer/_version.py,sha256=nRJALFK9-lDXqnO0OwqlFkus-jiFoEB-CLCKIbrjuRU,428
3
+ junifer/_version.py,sha256=CjqUG_Y4LDEZ8B4jqZpARBHOYed_438kYzl-7CnGiQU,428
4
4
  junifer/conftest.py,sha256=PWYkkRDU8ly2lYwv7VBKMHje4et6HX7Yey3Md_I2KbA,613
5
5
  junifer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  junifer/stats.py,sha256=BjQb2lfTGDP9l4UuQYmJFcJJNRfbJDGlNvC06SJaDDE,6237
@@ -268,12 +268,12 @@ junifer/pipeline/pipeline_step_mixin.py,sha256=wakimkG8GC0PWkFHMHIfgzM2yak41xLrz
268
268
  junifer/pipeline/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
269
269
  junifer/pipeline/update_meta_mixin.py,sha256=A_gYCPqdPlM0Xpum9TjJowb41O7ntxQg6y4YOgYeyy4,1564
270
270
  junifer/pipeline/utils.py,sha256=CAp0P7rZST7bsJ9lSlkvZgIJebHW2cIm8VXTuu1A6tE,10291
271
- junifer/pipeline/workdir_manager.py,sha256=zLzNZBCqqZeF10eS5nUMdg_EoORJhxGqmAS1fbnPexI,8067
271
+ junifer/pipeline/workdir_manager.py,sha256=T7-sZY_Gj0SM7p9N1ATjUFK2T-6CYIMQeYwHpBz96Gs,8616
272
272
  junifer/pipeline/tests/test_marker_collection.py,sha256=edBHfmwMTXG_q0ZagApbAbkFNoegi3hVEQiNcBtZOKc,6959
273
273
  junifer/pipeline/tests/test_pipeline_component_registry.py,sha256=ww_akEhtvE1_fsWbX5Yd5w_G2Ki6w_5MInfihwwRYFk,5800
274
274
  junifer/pipeline/tests/test_pipeline_step_mixin.py,sha256=_ykZzyNzREXy-r_yv1gY_jquLZzVBl8qwYrVORCKY_k,7807
275
275
  junifer/pipeline/tests/test_update_meta_mixin.py,sha256=UeWwpUi-Q5WVd36Fgfn_utXplSVXMSjLcdO2mR2xLTk,1355
276
- junifer/pipeline/tests/test_workdir_manager.py,sha256=E1WY4C-GDsx2c49sePqr1WR_Y3nZ1kiRn4Veu506uTs,2801
276
+ junifer/pipeline/tests/test_workdir_manager.py,sha256=N7_5cTnmv0eSQCT9UWOmFFVT-BIrNWq8GFmaqa-BtRI,4050
277
277
  junifer/preprocess/__init__.py,sha256=91D43p254il88g-7sSN64M7HsCvwytYoiTS_GLEr37Y,342
278
278
  junifer/preprocess/__init__.pyi,sha256=EApXtuEZohQZnIeP6k882Y2H5IRiGmhJbVGdN7VCWFc,254
279
279
  junifer/preprocess/base.py,sha256=v6azVA3RwDe3HriYlcaISOX1A6gYgFUKNzQeIDLx92Q,6681
@@ -336,10 +336,10 @@ junifer/utils/singleton.py,sha256=3mEZT4GJ7lMkH8H7ZPgy0DBe6CNTqg9CRVJFDAy3h60,12
336
336
  junifer/utils/tests/test_fs.py,sha256=WQS7cKlKEZ742CIuiOYYpueeAhY9PqlastfDVpVVtvE,923
337
337
  junifer/utils/tests/test_helpers.py,sha256=k5qqfxK8dFyuewTJyR1Qn6-nFaYNuVr0ysc18bfPjyU,929
338
338
  junifer/utils/tests/test_logging.py,sha256=duO4ou365hxwa_kwihFtKPLaL6LC5XHiyhOijrrngbA,8009
339
- junifer-0.0.6.dev213.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
340
- junifer-0.0.6.dev213.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
341
- junifer-0.0.6.dev213.dist-info/METADATA,sha256=jKOB-sd7U5Q6Fxxg2-hBKsX5R7LsBRbAT_1lg9jwiXM,8448
342
- junifer-0.0.6.dev213.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
343
- junifer-0.0.6.dev213.dist-info/entry_points.txt,sha256=6O8ru0BP-SP7YMUZiizFNoaZ2HvJpadO2G7nKk4PwjI,48
344
- junifer-0.0.6.dev213.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
345
- junifer-0.0.6.dev213.dist-info/RECORD,,
339
+ junifer-0.0.6.dev219.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
340
+ junifer-0.0.6.dev219.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
341
+ junifer-0.0.6.dev219.dist-info/METADATA,sha256=NmVabUMfIEWcEJ8nOtLA7HTzwuZYBhoIZPA1Z44ycdw,8448
342
+ junifer-0.0.6.dev219.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
343
+ junifer-0.0.6.dev219.dist-info/entry_points.txt,sha256=6O8ru0BP-SP7YMUZiizFNoaZ2HvJpadO2G7nKk4PwjI,48
344
+ junifer-0.0.6.dev219.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
345
+ junifer-0.0.6.dev219.dist-info/RECORD,,