junifer 0.0.6.dev248__py3-none-any.whl → 0.0.6.dev252__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 +2 -2
- junifer/api/decorators.py +1 -2
- junifer/api/functions.py +18 -18
- junifer/api/queue_context/gnu_parallel_local_adapter.py +4 -4
- junifer/api/queue_context/htcondor_adapter.py +4 -4
- junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +3 -3
- junifer/api/queue_context/tests/test_htcondor_adapter.py +3 -3
- junifer/api/tests/test_functions.py +32 -32
- junifer/cli/cli.py +3 -3
- junifer/cli/parser.py +4 -4
- junifer/cli/tests/test_cli.py +5 -5
- junifer/cli/utils.py +5 -6
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +2 -2
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -2
- junifer/configs/juseless/datagrabbers/ucla.py +4 -4
- junifer/data/_dispatch.py +11 -14
- junifer/data/coordinates/_ants_coordinates_warper.py +3 -3
- junifer/data/coordinates/_coordinates.py +6 -6
- junifer/data/coordinates/_fsl_coordinates_warper.py +3 -3
- junifer/data/masks/_ants_mask_warper.py +3 -3
- junifer/data/masks/_fsl_mask_warper.py +3 -3
- junifer/data/masks/_masks.py +6 -9
- junifer/data/masks/tests/test_masks.py +4 -4
- junifer/data/parcellations/_ants_parcellation_warper.py +3 -3
- junifer/data/parcellations/_fsl_parcellation_warper.py +3 -3
- junifer/data/parcellations/_parcellations.py +19 -19
- junifer/data/parcellations/tests/test_parcellations.py +1 -2
- junifer/data/pipeline_data_registry_base.py +3 -2
- junifer/data/template_spaces.py +3 -3
- junifer/data/tests/test_data_utils.py +1 -2
- junifer/data/utils.py +4 -3
- junifer/datagrabber/aomic/id1000.py +2 -2
- junifer/datagrabber/aomic/piop1.py +5 -5
- junifer/datagrabber/aomic/piop2.py +5 -5
- junifer/datagrabber/aomic/tests/test_id1000.py +3 -3
- junifer/datagrabber/aomic/tests/test_piop1.py +4 -4
- junifer/datagrabber/aomic/tests/test_piop2.py +4 -4
- junifer/datagrabber/base.py +12 -11
- junifer/datagrabber/datalad_base.py +3 -3
- junifer/datagrabber/dmcc13_benchmark.py +8 -8
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -3
- junifer/datagrabber/hcp1200/hcp1200.py +8 -8
- junifer/datagrabber/hcp1200/tests/test_hcp1200.py +2 -1
- junifer/datagrabber/multiple.py +7 -7
- junifer/datagrabber/pattern.py +10 -10
- junifer/datagrabber/pattern_validation_mixin.py +10 -10
- junifer/datagrabber/tests/test_datalad_base.py +7 -8
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +2 -2
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +6 -6
- junifer/datareader/default.py +6 -6
- junifer/external/nilearn/junifer_connectivity_measure.py +2 -2
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +4 -4
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +15 -15
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +2 -3
- junifer/markers/base.py +8 -8
- junifer/markers/brainprint.py +7 -9
- junifer/markers/complexity/complexity_base.py +6 -8
- junifer/markers/complexity/hurst_exponent.py +5 -5
- junifer/markers/complexity/multiscale_entropy_auc.py +5 -5
- junifer/markers/complexity/perm_entropy.py +5 -5
- junifer/markers/complexity/range_entropy.py +5 -5
- junifer/markers/complexity/range_entropy_auc.py +5 -5
- junifer/markers/complexity/sample_entropy.py +5 -5
- junifer/markers/complexity/weighted_perm_entropy.py +5 -5
- junifer/markers/ets_rss.py +7 -7
- junifer/markers/falff/_afni_falff.py +1 -2
- junifer/markers/falff/_junifer_falff.py +1 -2
- junifer/markers/falff/falff_base.py +2 -4
- junifer/markers/falff/falff_parcels.py +7 -7
- junifer/markers/falff/falff_spheres.py +6 -6
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +6 -6
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +7 -7
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +6 -6
- junifer/markers/functional_connectivity/functional_connectivity_base.py +10 -10
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +7 -7
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +6 -6
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +1 -2
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +1 -2
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +3 -3
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +3 -3
- junifer/markers/parcel_aggregation.py +8 -8
- junifer/markers/reho/_afni_reho.py +1 -2
- junifer/markers/reho/_junifer_reho.py +1 -2
- junifer/markers/reho/reho_base.py +2 -4
- junifer/markers/reho/reho_parcels.py +8 -8
- junifer/markers/reho/reho_spheres.py +7 -7
- junifer/markers/sphere_aggregation.py +8 -8
- junifer/markers/temporal_snr/temporal_snr_base.py +8 -8
- junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -6
- junifer/markers/temporal_snr/temporal_snr_spheres.py +5 -5
- junifer/markers/utils.py +3 -3
- junifer/onthefly/_brainprint.py +2 -2
- junifer/onthefly/read_transform.py +3 -3
- junifer/pipeline/marker_collection.py +4 -4
- junifer/pipeline/pipeline_component_registry.py +5 -4
- junifer/pipeline/pipeline_step_mixin.py +7 -7
- junifer/pipeline/tests/test_pipeline_component_registry.py +2 -3
- junifer/pipeline/tests/test_pipeline_step_mixin.py +19 -19
- junifer/pipeline/tests/test_update_meta_mixin.py +4 -4
- junifer/pipeline/update_meta_mixin.py +2 -2
- junifer/pipeline/utils.py +5 -5
- junifer/preprocess/base.py +10 -10
- junifer/preprocess/confounds/fmriprep_confound_remover.py +11 -14
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +1 -2
- junifer/preprocess/smoothing/smoothing.py +7 -7
- junifer/preprocess/warping/_ants_warper.py +3 -4
- junifer/preprocess/warping/_fsl_warper.py +3 -4
- junifer/preprocess/warping/space_warper.py +6 -6
- junifer/preprocess/warping/tests/test_space_warper.py +3 -4
- junifer/stats.py +4 -4
- junifer/storage/base.py +14 -13
- junifer/storage/hdf5.py +21 -20
- junifer/storage/pandas_base.py +12 -11
- junifer/storage/sqlite.py +11 -11
- junifer/storage/tests/test_hdf5.py +1 -2
- junifer/storage/tests/test_sqlite.py +2 -2
- junifer/storage/tests/test_utils.py +8 -7
- junifer/storage/utils.py +7 -7
- junifer/testing/datagrabbers.py +9 -10
- junifer/tests/test_stats.py +2 -2
- junifer/typing/_typing.py +6 -9
- junifer/utils/helpers.py +2 -3
- junifer/utils/logging.py +5 -5
- junifer/utils/singleton.py +3 -3
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/METADATA +2 -2
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/RECORD +131 -131
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/WHEEL +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev248.dist-info → junifer-0.0.6.dev252.dist-info}/top_level.txt +0 -0
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.
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 6, '
|
15
|
+
__version__ = version = '0.0.6.dev252'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 6, 'dev252')
|
junifer/api/decorators.py
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
6
6
|
# License: AGPL
|
7
7
|
|
8
|
-
from typing import Type
|
9
8
|
|
10
9
|
from ..pipeline import PipelineComponentRegistry
|
11
10
|
from ..typing import DataGrabberLike, MarkerLike, PreprocessorLike, StorageLike
|
@@ -47,7 +46,7 @@ def register_datagrabber(klass: DataGrabberLike) -> DataGrabberLike:
|
|
47
46
|
return klass
|
48
47
|
|
49
48
|
|
50
|
-
def register_datareader(klass:
|
49
|
+
def register_datareader(klass: type) -> type:
|
51
50
|
"""Register DataReader.
|
52
51
|
|
53
52
|
Registers the DataReader so it can be used by name.
|
junifer/api/functions.py
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
import os
|
9
9
|
import shutil
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import
|
11
|
+
from typing import Optional, Union
|
12
12
|
|
13
13
|
from ..api.queue_context import GnuParallelLocalAdapter, HTCondorAdapter
|
14
14
|
from ..datagrabber import BaseDataGrabber
|
@@ -27,7 +27,7 @@ from ..utils import logger, raise_error, yaml
|
|
27
27
|
__all__ = ["run", "collect", "queue", "reset", "list_elements"]
|
28
28
|
|
29
29
|
|
30
|
-
def _get_datagrabber(datagrabber_config:
|
30
|
+
def _get_datagrabber(datagrabber_config: dict) -> DataGrabberLike:
|
31
31
|
"""Get DataGrabber.
|
32
32
|
|
33
33
|
Parameters
|
@@ -49,7 +49,7 @@ def _get_datagrabber(datagrabber_config: Dict) -> DataGrabberLike:
|
|
49
49
|
)
|
50
50
|
|
51
51
|
|
52
|
-
def _get_preprocessor(preprocessing_config:
|
52
|
+
def _get_preprocessor(preprocessing_config: dict) -> PreprocessorLike:
|
53
53
|
"""Get Preprocessor.
|
54
54
|
|
55
55
|
Parameters
|
@@ -71,7 +71,7 @@ def _get_preprocessor(preprocessing_config: Dict) -> PreprocessorLike:
|
|
71
71
|
)
|
72
72
|
|
73
73
|
|
74
|
-
def _get_marker(marker_config:
|
74
|
+
def _get_marker(marker_config: dict) -> MarkerLike:
|
75
75
|
"""Get Marker.
|
76
76
|
|
77
77
|
Parameters
|
@@ -93,7 +93,7 @@ def _get_marker(marker_config: Dict) -> MarkerLike:
|
|
93
93
|
)
|
94
94
|
|
95
95
|
|
96
|
-
def _get_storage(storage_config:
|
96
|
+
def _get_storage(storage_config: dict) -> StorageLike:
|
97
97
|
"""Get Storage.
|
98
98
|
|
99
99
|
Parameters
|
@@ -117,11 +117,11 @@ def _get_storage(storage_config: Dict) -> StorageLike:
|
|
117
117
|
|
118
118
|
def run(
|
119
119
|
workdir: Union[str, Path],
|
120
|
-
datagrabber:
|
121
|
-
markers:
|
122
|
-
storage:
|
123
|
-
preprocessors: Optional[
|
124
|
-
elements: Union[str,
|
120
|
+
datagrabber: dict,
|
121
|
+
markers: list[dict],
|
122
|
+
storage: dict,
|
123
|
+
preprocessors: Optional[list[dict]] = None,
|
124
|
+
elements: Union[str, list[Union[str, tuple]], tuple, None] = None,
|
125
125
|
) -> None:
|
126
126
|
"""Run the pipeline on the selected element.
|
127
127
|
|
@@ -202,7 +202,7 @@ def run(
|
|
202
202
|
mc.fit(datagrabber_object[t_element])
|
203
203
|
|
204
204
|
|
205
|
-
def collect(storage:
|
205
|
+
def collect(storage: dict) -> None:
|
206
206
|
"""Collect and store data.
|
207
207
|
|
208
208
|
Parameters
|
@@ -224,12 +224,12 @@ def collect(storage: Dict) -> None:
|
|
224
224
|
|
225
225
|
|
226
226
|
def queue(
|
227
|
-
config:
|
227
|
+
config: dict,
|
228
228
|
kind: str,
|
229
229
|
jobname: str = "junifer_job",
|
230
230
|
overwrite: bool = False,
|
231
|
-
elements: Union[str,
|
232
|
-
**kwargs: Union[str, int, bool,
|
231
|
+
elements: Union[str, list[Union[str, tuple]], tuple, None] = None,
|
232
|
+
**kwargs: Union[str, int, bool, dict, tuple, list],
|
233
233
|
) -> None:
|
234
234
|
"""Queue a job to be executed later.
|
235
235
|
|
@@ -316,7 +316,7 @@ def queue(
|
|
316
316
|
elements = dg.get_elements()
|
317
317
|
# Listify elements
|
318
318
|
if not isinstance(elements, list):
|
319
|
-
elements:
|
319
|
+
elements: list[Union[str, tuple]] = [elements]
|
320
320
|
|
321
321
|
# Check job queueing system
|
322
322
|
adapter = None
|
@@ -341,7 +341,7 @@ def queue(
|
|
341
341
|
logger.info("Queue done")
|
342
342
|
|
343
343
|
|
344
|
-
def reset(config:
|
344
|
+
def reset(config: dict) -> None:
|
345
345
|
"""Reset the storage and jobs directory.
|
346
346
|
|
347
347
|
Parameters
|
@@ -380,8 +380,8 @@ def reset(config: Dict) -> None:
|
|
380
380
|
|
381
381
|
|
382
382
|
def list_elements(
|
383
|
-
datagrabber:
|
384
|
-
elements: Union[str,
|
383
|
+
datagrabber: dict,
|
384
|
+
elements: Union[str, list[Union[str, tuple]], tuple, None] = None,
|
385
385
|
) -> str:
|
386
386
|
"""List elements of the datagrabber filtered using `elements`.
|
387
387
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
import shutil
|
7
7
|
import textwrap
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import
|
9
|
+
from typing import Optional, Union
|
10
10
|
|
11
11
|
from ...utils import logger, make_executable, raise_error, run_ext_cmd
|
12
12
|
from .queue_context_adapter import QueueContextAdapter
|
@@ -60,10 +60,10 @@ class GnuParallelLocalAdapter(QueueContextAdapter):
|
|
60
60
|
job_name: str,
|
61
61
|
job_dir: Path,
|
62
62
|
yaml_config_path: Path,
|
63
|
-
elements:
|
63
|
+
elements: list[Union[str, tuple]],
|
64
64
|
pre_run: Optional[str] = None,
|
65
65
|
pre_collect: Optional[str] = None,
|
66
|
-
env: Optional[
|
66
|
+
env: Optional[dict[str, str]] = None,
|
67
67
|
verbose: str = "info",
|
68
68
|
submit: bool = False,
|
69
69
|
) -> None:
|
@@ -86,7 +86,7 @@ class GnuParallelLocalAdapter(QueueContextAdapter):
|
|
86
86
|
self._run_joblog_path = self._job_dir / f"run_{self._job_name}_joblog"
|
87
87
|
self._elements_file_path = self._job_dir / "elements"
|
88
88
|
|
89
|
-
def _check_env(self, env: Optional[
|
89
|
+
def _check_env(self, env: Optional[dict[str, str]]) -> None:
|
90
90
|
"""Check value of env parameter on init.
|
91
91
|
|
92
92
|
Parameters
|
@@ -6,7 +6,7 @@
|
|
6
6
|
import shutil
|
7
7
|
import textwrap
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import
|
9
|
+
from typing import Optional, Union
|
10
10
|
|
11
11
|
from ...utils import logger, make_executable, raise_error, run_ext_cmd
|
12
12
|
from .queue_context_adapter import QueueContextAdapter
|
@@ -78,10 +78,10 @@ class HTCondorAdapter(QueueContextAdapter):
|
|
78
78
|
job_name: str,
|
79
79
|
job_dir: Path,
|
80
80
|
yaml_config_path: Path,
|
81
|
-
elements:
|
81
|
+
elements: list[Union[str, tuple]],
|
82
82
|
pre_run: Optional[str] = None,
|
83
83
|
pre_collect: Optional[str] = None,
|
84
|
-
env: Optional[
|
84
|
+
env: Optional[dict[str, str]] = None,
|
85
85
|
verbose: str = "info",
|
86
86
|
cpus: int = 1,
|
87
87
|
mem: str = "8G",
|
@@ -115,7 +115,7 @@ class HTCondorAdapter(QueueContextAdapter):
|
|
115
115
|
)
|
116
116
|
self._dag_path = self._job_dir / f"{self._job_name}.dag"
|
117
117
|
|
118
|
-
def _check_env(self, env: Optional[
|
118
|
+
def _check_env(self, env: Optional[dict[str, str]]) -> None:
|
119
119
|
"""Check value of env parameter on init.
|
120
120
|
|
121
121
|
Parameters
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
import logging
|
7
7
|
from pathlib import Path
|
8
|
-
from typing import
|
8
|
+
from typing import Optional, Union
|
9
9
|
|
10
10
|
import pytest
|
11
11
|
|
@@ -44,7 +44,7 @@ def test_GnuParallelLocalAdapter_env_shell_error() -> None:
|
|
44
44
|
],
|
45
45
|
)
|
46
46
|
def test_GnuParallelLocalAdapter_elements(
|
47
|
-
elements:
|
47
|
+
elements: list[Union[str, tuple]],
|
48
48
|
expected_text: str,
|
49
49
|
) -> None:
|
50
50
|
"""Test GnuParallelLocalAdapter elements().
|
@@ -177,7 +177,7 @@ def test_GnuParallelLocalAdapter_prepare(
|
|
177
177
|
tmp_path: Path,
|
178
178
|
monkeypatch: pytest.MonkeyPatch,
|
179
179
|
caplog: pytest.LogCaptureFixture,
|
180
|
-
env:
|
180
|
+
env: dict[str, str],
|
181
181
|
) -> None:
|
182
182
|
"""Test GnuParallelLocalAdapter prepare().
|
183
183
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
import logging
|
7
7
|
from pathlib import Path
|
8
|
-
from typing import
|
8
|
+
from typing import Optional, Union
|
9
9
|
|
10
10
|
import pytest
|
11
11
|
|
@@ -181,7 +181,7 @@ def test_HTCondorAdapter_run_collect(
|
|
181
181
|
],
|
182
182
|
)
|
183
183
|
def test_HTCondor_dag(
|
184
|
-
elements:
|
184
|
+
elements: list[Union[str, tuple]], collect: str, expected_text: str
|
185
185
|
) -> None:
|
186
186
|
"""Test HTCondorAdapter dag().
|
187
187
|
|
@@ -218,7 +218,7 @@ def test_HTCondorAdapter_prepare(
|
|
218
218
|
tmp_path: Path,
|
219
219
|
monkeypatch: pytest.MonkeyPatch,
|
220
220
|
caplog: pytest.LogCaptureFixture,
|
221
|
-
env:
|
221
|
+
env: dict[str, str],
|
222
222
|
) -> None:
|
223
223
|
"""Test HTCondorAdapter prepare().
|
224
224
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import logging
|
9
9
|
from pathlib import Path
|
10
|
-
from typing import
|
10
|
+
from typing import Optional, Union
|
11
11
|
|
12
12
|
import pytest
|
13
13
|
from ruamel.yaml import YAML
|
@@ -26,7 +26,7 @@ yaml.indent(mapping=2, sequence=4, offset=2)
|
|
26
26
|
|
27
27
|
|
28
28
|
@pytest.fixture
|
29
|
-
def datagrabber() ->
|
29
|
+
def datagrabber() -> dict[str, str]:
|
30
30
|
"""Return a datagrabber as a dictionary."""
|
31
31
|
return {
|
32
32
|
"kind": "PartlyCloudyTestingDataGrabber",
|
@@ -34,7 +34,7 @@ def datagrabber() -> Dict[str, str]:
|
|
34
34
|
|
35
35
|
|
36
36
|
@pytest.fixture
|
37
|
-
def markers() ->
|
37
|
+
def markers() -> list[dict[str, str]]:
|
38
38
|
"""Return markers as a list of dictionary."""
|
39
39
|
return [
|
40
40
|
{
|
@@ -53,7 +53,7 @@ def markers() -> List[Dict[str, str]]:
|
|
53
53
|
|
54
54
|
|
55
55
|
@pytest.fixture
|
56
|
-
def storage() ->
|
56
|
+
def storage() -> dict[str, str]:
|
57
57
|
"""Return a storage as a dictionary."""
|
58
58
|
return {
|
59
59
|
"kind": "SQLiteFeatureStorage",
|
@@ -62,9 +62,9 @@ def storage() -> Dict[str, str]:
|
|
62
62
|
|
63
63
|
def test_run_single_element(
|
64
64
|
tmp_path: Path,
|
65
|
-
datagrabber:
|
66
|
-
markers:
|
67
|
-
storage:
|
65
|
+
datagrabber: dict[str, str],
|
66
|
+
markers: list[dict[str, str]],
|
67
|
+
storage: dict[str, str],
|
68
68
|
) -> None:
|
69
69
|
"""Test run function with single element.
|
70
70
|
|
@@ -97,8 +97,8 @@ def test_run_single_element(
|
|
97
97
|
|
98
98
|
def test_run_single_element_with_preprocessing(
|
99
99
|
tmp_path: Path,
|
100
|
-
markers:
|
101
|
-
storage:
|
100
|
+
markers: list[dict[str, str]],
|
101
|
+
storage: dict[str, str],
|
102
102
|
) -> None:
|
103
103
|
"""Test run function with single element and pre-processing.
|
104
104
|
|
@@ -137,9 +137,9 @@ def test_run_single_element_with_preprocessing(
|
|
137
137
|
|
138
138
|
def test_run_multi_element_multi_output(
|
139
139
|
tmp_path: Path,
|
140
|
-
datagrabber:
|
141
|
-
markers:
|
142
|
-
storage:
|
140
|
+
datagrabber: dict[str, str],
|
141
|
+
markers: list[dict[str, str]],
|
142
|
+
storage: dict[str, str],
|
143
143
|
) -> None:
|
144
144
|
"""Test run function with multi element and multi output.
|
145
145
|
|
@@ -173,9 +173,9 @@ def test_run_multi_element_multi_output(
|
|
173
173
|
|
174
174
|
def test_run_multi_element_single_output(
|
175
175
|
tmp_path: Path,
|
176
|
-
datagrabber:
|
177
|
-
markers:
|
178
|
-
storage:
|
176
|
+
datagrabber: dict[str, str],
|
177
|
+
markers: list[dict[str, str]],
|
178
|
+
storage: dict[str, str],
|
179
179
|
) -> None:
|
180
180
|
"""Test run function with multi element and single output.
|
181
181
|
|
@@ -210,9 +210,9 @@ def test_run_multi_element_single_output(
|
|
210
210
|
|
211
211
|
def test_run_and_collect(
|
212
212
|
tmp_path: Path,
|
213
|
-
datagrabber:
|
214
|
-
markers:
|
215
|
-
storage:
|
213
|
+
datagrabber: dict[str, str],
|
214
|
+
markers: list[dict[str, str]],
|
215
|
+
storage: dict[str, str],
|
216
216
|
) -> None:
|
217
217
|
"""Test run and collect functions.
|
218
218
|
|
@@ -259,9 +259,9 @@ def test_queue_correct_yaml_config(
|
|
259
259
|
tmp_path: Path,
|
260
260
|
monkeypatch: pytest.MonkeyPatch,
|
261
261
|
caplog: pytest.LogCaptureFixture,
|
262
|
-
datagrabber:
|
263
|
-
markers:
|
264
|
-
storage:
|
262
|
+
datagrabber: dict[str, str],
|
263
|
+
markers: list[dict[str, str]],
|
264
|
+
storage: dict[str, str],
|
265
265
|
) -> None:
|
266
266
|
"""Test proper YAML config generation for queueing.
|
267
267
|
|
@@ -426,7 +426,7 @@ def test_queue_with_imports(
|
|
426
426
|
tmp_path: Path,
|
427
427
|
monkeypatch: pytest.MonkeyPatch,
|
428
428
|
caplog: pytest.LogCaptureFixture,
|
429
|
-
with_: Union[str,
|
429
|
+
with_: Union[str, list[str]],
|
430
430
|
) -> None:
|
431
431
|
"""Test queue with `with` imports.
|
432
432
|
|
@@ -477,7 +477,7 @@ def test_queue_with_elements(
|
|
477
477
|
tmp_path: Path,
|
478
478
|
monkeypatch: pytest.MonkeyPatch,
|
479
479
|
caplog: pytest.LogCaptureFixture,
|
480
|
-
elements: Union[str,
|
480
|
+
elements: Union[str, list[Union[str, tuple[str]]], tuple[str]],
|
481
481
|
) -> None:
|
482
482
|
"""Test queue with elements.
|
483
483
|
|
@@ -508,7 +508,7 @@ def test_queue_without_elements(
|
|
508
508
|
tmp_path: Path,
|
509
509
|
monkeypatch: pytest.MonkeyPatch,
|
510
510
|
caplog: pytest.LogCaptureFixture,
|
511
|
-
datagrabber:
|
511
|
+
datagrabber: dict[str, str],
|
512
512
|
) -> None:
|
513
513
|
"""Test queue without elements.
|
514
514
|
|
@@ -536,9 +536,9 @@ def test_queue_without_elements(
|
|
536
536
|
|
537
537
|
def test_reset_run(
|
538
538
|
tmp_path: Path,
|
539
|
-
datagrabber:
|
540
|
-
markers:
|
541
|
-
storage:
|
539
|
+
datagrabber: dict[str, str],
|
540
|
+
markers: list[dict[str, str]],
|
541
|
+
storage: dict[str, str],
|
542
542
|
) -> None:
|
543
543
|
"""Test reset function for run.
|
544
544
|
|
@@ -580,9 +580,9 @@ def test_reset_run(
|
|
580
580
|
def test_reset_queue(
|
581
581
|
tmp_path: Path,
|
582
582
|
monkeypatch: pytest.MonkeyPatch,
|
583
|
-
datagrabber:
|
584
|
-
markers:
|
585
|
-
storage:
|
583
|
+
datagrabber: dict[str, str],
|
584
|
+
markers: list[dict[str, str]],
|
585
|
+
storage: dict[str, str],
|
586
586
|
job_name: str,
|
587
587
|
) -> None:
|
588
588
|
"""Test reset function for queue.
|
@@ -647,8 +647,8 @@ def test_reset_queue(
|
|
647
647
|
],
|
648
648
|
)
|
649
649
|
def test_list_elements(
|
650
|
-
datagrabber:
|
651
|
-
elements: Optional[
|
650
|
+
datagrabber: dict[str, str],
|
651
|
+
elements: Optional[list[str]],
|
652
652
|
) -> None:
|
653
653
|
"""Test elements listing.
|
654
654
|
|
junifer/cli/cli.py
CHANGED
@@ -8,7 +8,7 @@ import pathlib
|
|
8
8
|
import subprocess
|
9
9
|
import sys
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import Optional,
|
11
|
+
from typing import Optional, Union
|
12
12
|
|
13
13
|
import click
|
14
14
|
|
@@ -106,7 +106,7 @@ def cli() -> None: # pragma: no cover
|
|
106
106
|
default="info",
|
107
107
|
)
|
108
108
|
def run(
|
109
|
-
filepath: click.Path, element:
|
109
|
+
filepath: click.Path, element: tuple[str], verbose: Union[str, int]
|
110
110
|
) -> None:
|
111
111
|
"""Run feature extraction.
|
112
112
|
|
@@ -395,7 +395,7 @@ def reset(
|
|
395
395
|
)
|
396
396
|
def list_elements(
|
397
397
|
filepath: click.Path,
|
398
|
-
element:
|
398
|
+
element: tuple[str],
|
399
399
|
output_file: Optional[click.Path],
|
400
400
|
verbose: Union[str, int],
|
401
401
|
) -> None:
|
junifer/cli/parser.py
CHANGED
@@ -8,7 +8,7 @@ import importlib
|
|
8
8
|
import importlib.util
|
9
9
|
import sys
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import
|
11
|
+
from typing import Union
|
12
12
|
|
13
13
|
import pandas as pd
|
14
14
|
|
@@ -18,7 +18,7 @@ from ..utils import logger, raise_error, warn_with_log, yaml
|
|
18
18
|
__all__ = ["parse_yaml", "parse_elements"]
|
19
19
|
|
20
20
|
|
21
|
-
def parse_yaml(filepath: Union[str, Path]) ->
|
21
|
+
def parse_yaml(filepath: Union[str, Path]) -> dict: # noqa: C901
|
22
22
|
"""Parse YAML.
|
23
23
|
|
24
24
|
Parameters
|
@@ -140,7 +140,7 @@ def parse_yaml(filepath: Union[str, Path]) -> Dict: # noqa: C901
|
|
140
140
|
return contents
|
141
141
|
|
142
142
|
|
143
|
-
def parse_elements(element:
|
143
|
+
def parse_elements(element: tuple[str], config: dict) -> Union[list, None]:
|
144
144
|
"""Parse elements from cli.
|
145
145
|
|
146
146
|
Parameters
|
@@ -201,7 +201,7 @@ def parse_elements(element: Tuple[str], config: Dict) -> Union[List, None]:
|
|
201
201
|
return elements
|
202
202
|
|
203
203
|
|
204
|
-
def _parse_elements_file(filepath: Path) ->
|
204
|
+
def _parse_elements_file(filepath: Path) -> list[tuple[str, ...]]:
|
205
205
|
"""Parse elements from file.
|
206
206
|
|
207
207
|
Parameters
|
junifer/cli/tests/test_cli.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# License: AGPL
|
6
6
|
|
7
7
|
from pathlib import Path
|
8
|
-
from typing import Callable
|
8
|
+
from typing import Callable
|
9
9
|
|
10
10
|
import pytest
|
11
11
|
from click.testing import CliRunner
|
@@ -42,7 +42,7 @@ runner = CliRunner()
|
|
42
42
|
],
|
43
43
|
)
|
44
44
|
def test_run_and_collect_commands(
|
45
|
-
tmp_path: Path, elements:
|
45
|
+
tmp_path: Path, elements: tuple[str, ...]
|
46
46
|
) -> None:
|
47
47
|
"""Test run and collect commands.
|
48
48
|
|
@@ -175,7 +175,7 @@ def test_run_using_element_file(tmp_path: Path, elements: str) -> None:
|
|
175
175
|
],
|
176
176
|
)
|
177
177
|
def test_multi_element_access(
|
178
|
-
tmp_path: Path, elements: str, expected_list:
|
178
|
+
tmp_path: Path, elements: str, expected_list: list[tuple[str, ...]]
|
179
179
|
) -> None:
|
180
180
|
"""Test mulit-element parsing.
|
181
181
|
|
@@ -306,7 +306,7 @@ def test_reset(
|
|
306
306
|
],
|
307
307
|
)
|
308
308
|
def test_list_elements_stdout(
|
309
|
-
elements:
|
309
|
+
elements: tuple[str, ...],
|
310
310
|
) -> None:
|
311
311
|
"""Test elements listing to stdout.
|
312
312
|
|
@@ -344,7 +344,7 @@ def test_list_elements_stdout(
|
|
344
344
|
)
|
345
345
|
def test_list_elements_output_file(
|
346
346
|
tmp_path: Path,
|
347
|
-
elements:
|
347
|
+
elements: tuple[str, ...],
|
348
348
|
) -> None:
|
349
349
|
"""Test elements listing to output file.
|
350
350
|
|
junifer/cli/utils.py
CHANGED
@@ -7,13 +7,12 @@ import os
|
|
7
7
|
import platform as pl
|
8
8
|
import re
|
9
9
|
from importlib.metadata import distribution
|
10
|
-
from typing import Dict
|
11
10
|
|
12
11
|
from .._version import __version__
|
13
12
|
from ..utils.logging import get_versions
|
14
13
|
|
15
14
|
|
16
|
-
def _get_junifer_version() ->
|
15
|
+
def _get_junifer_version() -> dict[str, str]:
|
17
16
|
"""Get junifer version information.
|
18
17
|
|
19
18
|
Returns
|
@@ -27,7 +26,7 @@ def _get_junifer_version() -> Dict[str, str]:
|
|
27
26
|
}
|
28
27
|
|
29
28
|
|
30
|
-
def _get_python_information() ->
|
29
|
+
def _get_python_information() -> dict[str, str]:
|
31
30
|
"""Get installed Python information.
|
32
31
|
|
33
32
|
Parameters
|
@@ -42,7 +41,7 @@ def _get_python_information() -> Dict[str, str]:
|
|
42
41
|
}
|
43
42
|
|
44
43
|
|
45
|
-
def _get_dependency_information(long_: bool) ->
|
44
|
+
def _get_dependency_information(long_: bool) -> dict[str, str]:
|
46
45
|
"""Get Python environment dependency information.
|
47
46
|
|
48
47
|
Parameters
|
@@ -87,7 +86,7 @@ def _get_dependency_information(long_: bool) -> Dict[str, str]:
|
|
87
86
|
return pruned_dependency_versions
|
88
87
|
|
89
88
|
|
90
|
-
def _get_system_information() ->
|
89
|
+
def _get_system_information() -> dict[str, str]:
|
91
90
|
"""Get system information.
|
92
91
|
|
93
92
|
Returns
|
@@ -101,7 +100,7 @@ def _get_system_information() -> Dict[str, str]:
|
|
101
100
|
}
|
102
101
|
|
103
102
|
|
104
|
-
def _get_environment_information(long_: bool) ->
|
103
|
+
def _get_environment_information(long_: bool) -> dict[str, str]:
|
105
104
|
"""Get system environment information.
|
106
105
|
|
107
106
|
Parameters
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# License: AGPL
|
7
7
|
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import
|
9
|
+
from typing import Union
|
10
10
|
|
11
11
|
from ....api.decorators import register_datagrabber
|
12
12
|
from ....datagrabber import PatternDataladDataGrabber
|
@@ -37,7 +37,7 @@ class JuselessDataladIXIVBM(PatternDataladDataGrabber):
|
|
37
37
|
def __init__(
|
38
38
|
self,
|
39
39
|
datadir: Union[str, Path, None] = None,
|
40
|
-
sites: Union[str,
|
40
|
+
sites: Union[str, list[str], None] = None,
|
41
41
|
) -> None:
|
42
42
|
uri = (
|
43
43
|
"ria+http://cat_12.5.ds.inm7.de"
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# License: AGPL
|
7
7
|
|
8
8
|
import socket
|
9
|
-
from typing import
|
9
|
+
from typing import Optional, Union
|
10
10
|
|
11
11
|
import pytest
|
12
12
|
|
@@ -53,7 +53,7 @@ def test_JuselessUCLA() -> None:
|
|
53
53
|
],
|
54
54
|
)
|
55
55
|
def test_JuselessUCLA_partial_data_access(
|
56
|
-
types: Union[str,
|
56
|
+
types: Union[str, list[str]],
|
57
57
|
) -> None:
|
58
58
|
"""Test JuselessUCLA DataGrabber partial data access.
|
59
59
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# License: AGPL
|
6
6
|
|
7
7
|
from pathlib import Path
|
8
|
-
from typing import
|
8
|
+
from typing import Union
|
9
9
|
|
10
10
|
from ....api.decorators import register_datagrabber
|
11
11
|
from ....datagrabber import PatternDataGrabber
|
@@ -43,8 +43,8 @@ class JuselessUCLA(PatternDataGrabber):
|
|
43
43
|
datadir: Union[
|
44
44
|
str, Path
|
45
45
|
] = "/data/project/psychosis_thalamus/data/fmriprep",
|
46
|
-
types: Union[str,
|
47
|
-
tasks: Union[str,
|
46
|
+
types: Union[str, list[str], None] = None,
|
47
|
+
tasks: Union[str, list[str], None] = None,
|
48
48
|
) -> None:
|
49
49
|
# Declare all tasks
|
50
50
|
all_tasks = [
|
@@ -136,7 +136,7 @@ class JuselessUCLA(PatternDataGrabber):
|
|
136
136
|
confounds_format="fmriprep",
|
137
137
|
)
|
138
138
|
|
139
|
-
def get_elements(self) ->
|
139
|
+
def get_elements(self) -> list:
|
140
140
|
"""Implement fetching list of elements in the dataset.
|
141
141
|
|
142
142
|
Returns
|