junifer 0.0.6.dev227__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 +6 -8
- junifer/data/coordinates/_coordinates.py +34 -21
- junifer/data/coordinates/_fsl_coordinates_warper.py +6 -8
- junifer/data/masks/_ants_mask_warper.py +18 -11
- junifer/data/masks/_fsl_mask_warper.py +6 -8
- junifer/data/masks/_masks.py +27 -34
- junifer/data/masks/tests/test_masks.py +4 -4
- junifer/data/parcellations/_ants_parcellation_warper.py +18 -11
- junifer/data/parcellations/_fsl_parcellation_warper.py +6 -8
- junifer/data/parcellations/_parcellations.py +39 -43
- 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 +69 -4
- junifer/datagrabber/aomic/id1000.py +24 -11
- junifer/datagrabber/aomic/piop1.py +27 -14
- junifer/datagrabber/aomic/piop2.py +27 -14
- 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 +18 -12
- junifer/datagrabber/datalad_base.py +18 -11
- junifer/datagrabber/dmcc13_benchmark.py +31 -18
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -3
- junifer/datagrabber/hcp1200/hcp1200.py +26 -15
- junifer/datagrabber/hcp1200/tests/test_hcp1200.py +2 -1
- junifer/datagrabber/multiple.py +7 -7
- junifer/datagrabber/pattern.py +75 -45
- junifer/datagrabber/pattern_validation_mixin.py +204 -94
- junifer/datagrabber/tests/test_datalad_base.py +7 -8
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +28 -11
- 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 +15 -11
- 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 +21 -17
- 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 +26 -6
- junifer/preprocess/warping/_fsl_warper.py +22 -7
- junifer/preprocess/warping/space_warper.py +37 -10
- 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.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/METADATA +2 -2
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/RECORD +131 -131
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/WHEEL +1 -1
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/top_level.txt +0 -0
junifer/storage/sqlite.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
import json
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import TYPE_CHECKING, Any,
|
9
|
+
from typing import TYPE_CHECKING, Any, Optional, Union
|
10
10
|
|
11
11
|
import numpy as np
|
12
12
|
import pandas as pd
|
@@ -92,7 +92,7 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
92
92
|
# Set upsert
|
93
93
|
self._upsert = upsert
|
94
94
|
|
95
|
-
def get_engine(self, element: Optional[
|
95
|
+
def get_engine(self, element: Optional[dict] = None) -> "Engine":
|
96
96
|
"""Get engine.
|
97
97
|
|
98
98
|
Parameters
|
@@ -209,7 +209,7 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
209
209
|
msg=f"Invalid option {if_exists} for if_exists."
|
210
210
|
)
|
211
211
|
|
212
|
-
def list_features(self) ->
|
212
|
+
def list_features(self) -> dict[str, dict[str, Any]]:
|
213
213
|
"""List the features in the storage.
|
214
214
|
|
215
215
|
Returns
|
@@ -229,7 +229,7 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
229
229
|
# Format index names for retrieved data
|
230
230
|
meta_df.index = meta_df.index.str.replace(r"meta_", "")
|
231
231
|
# Convert dataframe to dictionary
|
232
|
-
out:
|
232
|
+
out: dict[str, dict[str, str]] = meta_df.to_dict(
|
233
233
|
orient="index"
|
234
234
|
) # type: ignore
|
235
235
|
# Format output
|
@@ -242,8 +242,8 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
242
242
|
self,
|
243
243
|
feature_name: Optional[str] = None,
|
244
244
|
feature_md5: Optional[str] = None,
|
245
|
-
) ->
|
246
|
-
str, Union[str,
|
245
|
+
) -> dict[
|
246
|
+
str, Union[str, list[Union[int, str, dict[str, str]]], np.ndarray]
|
247
247
|
]:
|
248
248
|
"""Read stored feature.
|
249
249
|
|
@@ -358,7 +358,7 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
358
358
|
df = df.set_index(index_names)
|
359
359
|
return df
|
360
360
|
|
361
|
-
def store_metadata(self, meta_md5: str, element:
|
361
|
+
def store_metadata(self, meta_md5: str, element: dict, meta: dict) -> None:
|
362
362
|
"""Implement metadata storing in the storage.
|
363
363
|
|
364
364
|
Parameters
|
@@ -381,7 +381,7 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
381
381
|
self._save_upsert(meta_df, "meta", engine)
|
382
382
|
|
383
383
|
def store_df(
|
384
|
-
self, meta_md5: str, element:
|
384
|
+
self, meta_md5: str, element: dict, df: Union[pd.DataFrame, pd.Series]
|
385
385
|
) -> None:
|
386
386
|
"""Implement pandas DataFrame storing.
|
387
387
|
|
@@ -434,10 +434,10 @@ class SQLiteFeatureStorage(PandasBaseFeatureStorage):
|
|
434
434
|
def store_matrix(
|
435
435
|
self,
|
436
436
|
meta_md5: str,
|
437
|
-
element:
|
437
|
+
element: dict,
|
438
438
|
data: np.ndarray,
|
439
|
-
col_names: Optional[
|
440
|
-
row_names: Optional[
|
439
|
+
col_names: Optional[list[str]] = None,
|
440
|
+
row_names: Optional[list[str]] = None,
|
441
441
|
matrix_kind: str = "full",
|
442
442
|
diagonal: bool = True,
|
443
443
|
) -> None:
|
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
from copy import deepcopy
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import Dict, Tuple
|
10
9
|
|
11
10
|
import h5py
|
12
11
|
import numpy as np
|
@@ -874,7 +873,7 @@ def test_store_scalar_table(tmp_path: Path) -> None:
|
|
874
873
|
assert_array_equal(read_df.values, data)
|
875
874
|
|
876
875
|
|
877
|
-
def _create_data_to_store(n_elements: int, kind: str) ->
|
876
|
+
def _create_data_to_store(n_elements: int, kind: str) -> tuple[str, dict]:
|
878
877
|
"""Create data to store.
|
879
878
|
|
880
879
|
Parameters
|
@@ -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
|
import numpy as np
|
11
11
|
import pandas as pd
|
@@ -56,7 +56,7 @@ df_ignore = pd.DataFrame(
|
|
56
56
|
|
57
57
|
|
58
58
|
def _read_sql(
|
59
|
-
table_name: str, uri: str, index_col: Union[str,
|
59
|
+
table_name: str, uri: str, index_col: Union[str, list[str]]
|
60
60
|
) -> pd.DataFrame:
|
61
61
|
"""Read database table into a pandas DataFrame.
|
62
62
|
|
@@ -4,7 +4,8 @@
|
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from
|
7
|
+
from collections.abc import Iterable
|
8
|
+
from typing import Union
|
8
9
|
|
9
10
|
import numpy as np
|
10
11
|
import pytest
|
@@ -198,7 +199,7 @@ def test_process_meta_invalid_metadata_key() -> None:
|
|
198
199
|
),
|
199
200
|
],
|
200
201
|
)
|
201
|
-
def test_process_meta_element(meta:
|
202
|
+
def test_process_meta_element(meta: dict, elements: list[str]) -> None:
|
202
203
|
"""Test metadata element after processing.
|
203
204
|
|
204
205
|
Parameters
|
@@ -215,7 +216,7 @@ def test_process_meta_element(meta: Dict, elements: List[str]) -> None:
|
|
215
216
|
assert "A" in processed_meta
|
216
217
|
assert "B" in processed_meta
|
217
218
|
assert "element" not in processed_meta
|
218
|
-
assert isinstance(processed_meta["dependencies"],
|
219
|
+
assert isinstance(processed_meta["dependencies"], dict)
|
219
220
|
assert all(
|
220
221
|
x in processed_meta["dependencies"] for x in meta["dependencies"]
|
221
222
|
)
|
@@ -232,7 +233,7 @@ def test_process_meta_element(meta: Dict, elements: List[str]) -> None:
|
|
232
233
|
({"subject": 1, "session": 2}, "element_1_2_"),
|
233
234
|
],
|
234
235
|
)
|
235
|
-
def test_element_to_prefix(element:
|
236
|
+
def test_element_to_prefix(element: dict, prefix: str) -> None:
|
236
237
|
"""Test converting element to prefix (for file naming).
|
237
238
|
|
238
239
|
Parameters
|
@@ -320,7 +321,7 @@ def test_element_to_prefix_invalid_type() -> None:
|
|
320
321
|
],
|
321
322
|
)
|
322
323
|
def test_store_matrix_checks(
|
323
|
-
params:
|
324
|
+
params: dict[str, Union[str, bool, tuple[int, int], int]], err_msg: str
|
324
325
|
) -> None:
|
325
326
|
"""Test matrix storing parameter checks.
|
326
327
|
|
@@ -401,9 +402,9 @@ def test_store_matrix_checks(
|
|
401
402
|
],
|
402
403
|
)
|
403
404
|
def test_matrix_to_vector(
|
404
|
-
params:
|
405
|
+
params: dict[str, Union[np.ndarray, Iterable[str], str, bool]],
|
405
406
|
expected_data: np.ndarray,
|
406
|
-
expected_columns:
|
407
|
+
expected_columns: list[str],
|
407
408
|
) -> None:
|
408
409
|
"""Test matrix to vector.
|
409
410
|
|
junifer/storage/utils.py
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
import hashlib
|
8
8
|
import json
|
9
|
+
from collections.abc import Iterable
|
9
10
|
from importlib.metadata import PackageNotFoundError, version
|
10
|
-
from typing import Dict, Iterable, List, Tuple
|
11
11
|
|
12
12
|
import numpy as np
|
13
13
|
|
@@ -50,7 +50,7 @@ def get_dependency_version(dependency: str) -> str:
|
|
50
50
|
return dep_version
|
51
51
|
|
52
52
|
|
53
|
-
def _meta_hash(meta:
|
53
|
+
def _meta_hash(meta: dict) -> str:
|
54
54
|
"""Compute the MD5 hash of the metadata.
|
55
55
|
|
56
56
|
Parameters
|
@@ -78,7 +78,7 @@ def _meta_hash(meta: Dict) -> str:
|
|
78
78
|
return meta_md5
|
79
79
|
|
80
80
|
|
81
|
-
def process_meta(meta:
|
81
|
+
def process_meta(meta: dict) -> tuple[str, dict, dict]:
|
82
82
|
"""Process the metadata for storage.
|
83
83
|
|
84
84
|
It removes the key "element" and adds the "_element_keys" with the keys
|
@@ -109,7 +109,7 @@ def process_meta(meta: Dict) -> Tuple[str, Dict, Dict]:
|
|
109
109
|
# Copy the metadata
|
110
110
|
t_meta = meta.copy()
|
111
111
|
# Remove key "element"
|
112
|
-
element:
|
112
|
+
element: dict = t_meta.pop("element", None)
|
113
113
|
if element is None:
|
114
114
|
raise_error(msg="`meta` must contain the key 'element'")
|
115
115
|
if "marker" not in t_meta:
|
@@ -128,7 +128,7 @@ def process_meta(meta: Dict) -> Tuple[str, Dict, Dict]:
|
|
128
128
|
return md5_hash, t_meta, element
|
129
129
|
|
130
130
|
|
131
|
-
def element_to_prefix(element:
|
131
|
+
def element_to_prefix(element: dict) -> str:
|
132
132
|
"""Convert the element metadata to prefix.
|
133
133
|
|
134
134
|
Parameters
|
@@ -156,7 +156,7 @@ def element_to_prefix(element: Dict) -> str:
|
|
156
156
|
def store_matrix_checks(
|
157
157
|
matrix_kind: str,
|
158
158
|
diagonal: bool,
|
159
|
-
data_shape:
|
159
|
+
data_shape: tuple[int, int],
|
160
160
|
row_names_len: int,
|
161
161
|
col_names_len: int,
|
162
162
|
) -> None:
|
@@ -218,7 +218,7 @@ def matrix_to_vector(
|
|
218
218
|
row_names: Iterable[str],
|
219
219
|
matrix_kind: str,
|
220
220
|
diagonal: bool,
|
221
|
-
) ->
|
221
|
+
) -> tuple[np.ndarray, list[str]]:
|
222
222
|
"""Convert matrix to vector based on parameters.
|
223
223
|
|
224
224
|
Parameters
|
junifer/testing/datagrabbers.py
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
import tempfile
|
8
8
|
from pathlib import Path
|
9
|
-
from typing import Dict, List
|
10
9
|
|
11
10
|
import nibabel as nib
|
12
11
|
from nilearn import datasets, image
|
@@ -35,7 +34,7 @@ class OasisVBMTestingDataGrabber(BaseDataGrabber):
|
|
35
34
|
types = ["VBM_GM"]
|
36
35
|
super().__init__(types=types, datadir=datadir)
|
37
36
|
|
38
|
-
def get_element_keys(self) ->
|
37
|
+
def get_element_keys(self) -> list[str]:
|
39
38
|
"""Get element keys.
|
40
39
|
|
41
40
|
Returns
|
@@ -46,7 +45,7 @@ class OasisVBMTestingDataGrabber(BaseDataGrabber):
|
|
46
45
|
"""
|
47
46
|
return ["subject"]
|
48
47
|
|
49
|
-
def get_item(self, subject: str) ->
|
48
|
+
def get_item(self, subject: str) -> dict[str, dict]:
|
50
49
|
"""Implement indexing support.
|
51
50
|
|
52
51
|
Parameters
|
@@ -80,7 +79,7 @@ class OasisVBMTestingDataGrabber(BaseDataGrabber):
|
|
80
79
|
self._dataset = datasets.fetch_oasis_vbm(n_subjects=10)
|
81
80
|
return self
|
82
81
|
|
83
|
-
def get_elements(self) ->
|
82
|
+
def get_elements(self) -> list[str]:
|
84
83
|
"""Get elements.
|
85
84
|
|
86
85
|
Returns
|
@@ -106,7 +105,7 @@ class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
|
|
106
105
|
types = ["BOLD", "T1w"] # TODO: Check that they are T1w
|
107
106
|
super().__init__(types=types, datadir=datadir)
|
108
107
|
|
109
|
-
def get_element_keys(self) ->
|
108
|
+
def get_element_keys(self) -> list[str]:
|
110
109
|
"""Get element keys.
|
111
110
|
|
112
111
|
Returns
|
@@ -117,7 +116,7 @@ class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
|
|
117
116
|
"""
|
118
117
|
return ["subject"]
|
119
118
|
|
120
|
-
def get_elements(self) ->
|
119
|
+
def get_elements(self) -> list[str]:
|
121
120
|
"""Get elements.
|
122
121
|
|
123
122
|
Returns
|
@@ -128,7 +127,7 @@ class SPMAuditoryTestingDataGrabber(BaseDataGrabber):
|
|
128
127
|
"""
|
129
128
|
return [f"sub{x:03d}" for x in list(range(1, 11))]
|
130
129
|
|
131
|
-
def get_item(self, subject: str) ->
|
130
|
+
def get_item(self, subject: str) -> dict[str, dict]:
|
132
131
|
"""Implement indexing support.
|
133
132
|
|
134
133
|
Parameters
|
@@ -208,7 +207,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
208
207
|
)
|
209
208
|
return self
|
210
209
|
|
211
|
-
def get_element_keys(self) ->
|
210
|
+
def get_element_keys(self) -> list[str]:
|
212
211
|
"""Get element keys.
|
213
212
|
|
214
213
|
Returns
|
@@ -219,7 +218,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
219
218
|
"""
|
220
219
|
return ["subject"]
|
221
220
|
|
222
|
-
def get_elements(self) ->
|
221
|
+
def get_elements(self) -> list[str]:
|
223
222
|
"""Get elements.
|
224
223
|
|
225
224
|
Returns
|
@@ -230,7 +229,7 @@ class PartlyCloudyTestingDataGrabber(BaseDataGrabber):
|
|
230
229
|
"""
|
231
230
|
return [f"sub-{x:02d}" for x in list(range(1, 11))]
|
232
231
|
|
233
|
-
def get_item(self, subject: str) ->
|
232
|
+
def get_item(self, subject: str) -> dict[str, dict]:
|
234
233
|
"""Implement indexing support.
|
235
234
|
|
236
235
|
Parameters
|
junifer/tests/test_stats.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
5
5
|
|
6
|
-
from typing import
|
6
|
+
from typing import Optional
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import pytest
|
@@ -25,7 +25,7 @@ from junifer.stats import count, get_aggfunc_by_name, select, winsorized_mean
|
|
25
25
|
("mode", {"keepdims": True}),
|
26
26
|
],
|
27
27
|
)
|
28
|
-
def test_get_aggfunc_by_name(name: str, params: Optional[
|
28
|
+
def test_get_aggfunc_by_name(name: str, params: Optional[dict]) -> None:
|
29
29
|
"""Test aggregation function retrieval by name.
|
30
30
|
|
31
31
|
Parameters
|
junifer/typing/_typing.py
CHANGED
@@ -3,12 +3,9 @@
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
5
5
|
|
6
|
+
from collections.abc import MutableMapping, Sequence
|
6
7
|
from typing import (
|
7
8
|
TYPE_CHECKING,
|
8
|
-
AbstractSet,
|
9
|
-
MutableMapping,
|
10
|
-
Sequence,
|
11
|
-
Type,
|
12
9
|
Union,
|
13
10
|
)
|
14
11
|
|
@@ -34,10 +31,10 @@ __all__ = [
|
|
34
31
|
]
|
35
32
|
|
36
33
|
|
37
|
-
DataGrabberLike =
|
38
|
-
PreprocessorLike =
|
39
|
-
MarkerLike =
|
40
|
-
StorageLike =
|
34
|
+
DataGrabberLike = type["BaseDataGrabber"]
|
35
|
+
PreprocessorLike = type["BasePreprocessor"]
|
36
|
+
MarkerLike = type["BaseMarker"]
|
37
|
+
StorageLike = type["BaseFeatureStorage"]
|
41
38
|
PipelineComponent = Union[
|
42
39
|
"DataGrabberLike",
|
43
40
|
"DefaultDataReader",
|
@@ -45,7 +42,7 @@ PipelineComponent = Union[
|
|
45
42
|
"MarkerLike",
|
46
43
|
"StorageLike",
|
47
44
|
]
|
48
|
-
Dependencies =
|
45
|
+
Dependencies = set[str]
|
49
46
|
ConditionalDependencies = Sequence[
|
50
47
|
MutableMapping[
|
51
48
|
str,
|
junifer/utils/helpers.py
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
import collections.abc
|
7
7
|
import subprocess
|
8
8
|
import sys
|
9
|
-
from typing import Dict, List
|
10
9
|
|
11
10
|
from .logging import logger, raise_error
|
12
11
|
|
@@ -14,7 +13,7 @@ from .logging import logger, raise_error
|
|
14
13
|
__all__ = ["run_ext_cmd", "deep_update"]
|
15
14
|
|
16
15
|
|
17
|
-
def run_ext_cmd(name: str, cmd:
|
16
|
+
def run_ext_cmd(name: str, cmd: list[str]) -> None:
|
18
17
|
"""Run external command via subprocess.
|
19
18
|
|
20
19
|
Parameters
|
@@ -58,7 +57,7 @@ def run_ext_cmd(name: str, cmd: List[str]) -> None:
|
|
58
57
|
)
|
59
58
|
|
60
59
|
|
61
|
-
def deep_update(d:
|
60
|
+
def deep_update(d: dict, u: dict) -> dict:
|
62
61
|
"""Deep update `d` with `u`.
|
63
62
|
|
64
63
|
From: "https://stackoverflow.com/questions/3232943/update-value-of-a-nested
|
junifer/utils/logging.py
CHANGED
@@ -16,7 +16,7 @@ import logging
|
|
16
16
|
import warnings
|
17
17
|
from pathlib import Path
|
18
18
|
from subprocess import PIPE, Popen, TimeoutExpired
|
19
|
-
from typing import
|
19
|
+
from typing import NoReturn, Optional, Union
|
20
20
|
from warnings import warn
|
21
21
|
|
22
22
|
import datalad
|
@@ -119,7 +119,7 @@ def _get_git_head(path: Path) -> str:
|
|
119
119
|
return proc_stdout
|
120
120
|
|
121
121
|
|
122
|
-
def get_versions() ->
|
122
|
+
def get_versions() -> dict:
|
123
123
|
"""Import stuff and get versions if module.
|
124
124
|
|
125
125
|
Returns
|
@@ -189,7 +189,7 @@ def _close_handlers(logger: logging.Logger) -> None:
|
|
189
189
|
logger.removeHandler(handler)
|
190
190
|
|
191
191
|
|
192
|
-
def _safe_log(versions:
|
192
|
+
def _safe_log(versions: dict, name: str) -> None:
|
193
193
|
"""Log with safety.
|
194
194
|
|
195
195
|
Parameters
|
@@ -308,7 +308,7 @@ def configure_logging(
|
|
308
308
|
|
309
309
|
def raise_error(
|
310
310
|
msg: str,
|
311
|
-
klass:
|
311
|
+
klass: type[Exception] = ValueError,
|
312
312
|
exception: Optional[Exception] = None,
|
313
313
|
) -> NoReturn:
|
314
314
|
"""Raise error, but first log it.
|
@@ -331,7 +331,7 @@ def raise_error(
|
|
331
331
|
|
332
332
|
|
333
333
|
def warn_with_log(
|
334
|
-
msg: str, category: Optional[
|
334
|
+
msg: str, category: Optional[type[Warning]] = RuntimeWarning
|
335
335
|
) -> None:
|
336
336
|
"""Warn, but first log it.
|
337
337
|
|
junifer/utils/singleton.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# License: AGPL
|
6
6
|
|
7
7
|
from abc import ABCMeta
|
8
|
-
from typing import Any, ClassVar
|
8
|
+
from typing import Any, ClassVar
|
9
9
|
|
10
10
|
|
11
11
|
__all__ = ["Singleton", "ABCSingleton"]
|
@@ -21,9 +21,9 @@ class Singleton(type):
|
|
21
21
|
|
22
22
|
"""
|
23
23
|
|
24
|
-
instances: ClassVar[
|
24
|
+
instances: ClassVar[dict] = {}
|
25
25
|
|
26
|
-
def __call__(cls, *args: Any, **kwargs: Any) ->
|
26
|
+
def __call__(cls, *args: Any, **kwargs: Any) -> type:
|
27
27
|
"""Get the only instance for a class.
|
28
28
|
|
29
29
|
Parameters
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.6.
|
3
|
+
Version: 0.0.6.dev252
|
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>
|
@@ -24,7 +24,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.11
|
25
25
|
Classifier: Programming Language :: Python :: 3.12
|
26
26
|
Classifier: Programming Language :: Python :: 3.13
|
27
|
-
Requires-Python: >=3.
|
27
|
+
Requires-Python: >=3.9
|
28
28
|
Description-Content-Type: text/markdown
|
29
29
|
License-File: LICENSE.md
|
30
30
|
License-File: AUTHORS.rst
|