junifer 0.0.6.dev33__py3-none-any.whl → 0.0.6.dev51__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/__init__.py +2 -0
- junifer/_version.py +2 -2
- junifer/api/__init__.py +3 -4
- junifer/api/decorators.py +1 -1
- junifer/api/functions.py +3 -4
- junifer/api/tests/test_functions.py +2 -2
- junifer/cli/__init__.py +8 -0
- junifer/{api → cli}/cli.py +23 -119
- junifer/{api → cli}/parser.py +117 -6
- junifer/{api → cli}/tests/test_cli.py +3 -3
- junifer/{api/tests/test_api_utils.py → cli/tests/test_cli_utils.py} +2 -2
- junifer/{api → cli}/tests/test_parser.py +2 -2
- junifer/{api → cli}/utils.py +1 -10
- junifer/utils/__init__.py +2 -0
- junifer/utils/_yaml.py +16 -0
- {junifer-0.0.6.dev33.dist-info → junifer-0.0.6.dev51.dist-info}/METADATA +1 -1
- {junifer-0.0.6.dev33.dist-info → junifer-0.0.6.dev51.dist-info}/RECORD +25 -23
- {junifer-0.0.6.dev33.dist-info → junifer-0.0.6.dev51.dist-info}/WHEEL +1 -1
- junifer-0.0.6.dev51.dist-info/entry_points.txt +2 -0
- junifer-0.0.6.dev33.dist-info/entry_points.txt +0 -2
- /junifer/{api → cli}/tests/data/gmd_mean.yaml +0 -0
- /junifer/{api → cli}/tests/data/gmd_mean_htcondor.yaml +0 -0
- /junifer/{api → cli}/tests/data/partly_cloudy_agg_mean_tian.yml +0 -0
- {junifer-0.0.6.dev33.dist-info → junifer-0.0.6.dev51.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev33.dist-info → junifer-0.0.6.dev51.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev33.dist-info → junifer-0.0.6.dev51.dist-info}/top_level.txt +0 -0
junifer/__init__.py
CHANGED
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.dev51'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 6, 'dev51')
|
junifer/api/__init__.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
"""Public API
|
1
|
+
"""Public API components."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
7
|
from . import decorators
|
8
|
-
from .
|
9
|
-
from .functions import collect, queue, run
|
8
|
+
from .functions import collect, list_elements, reset, run, queue
|
10
9
|
|
11
10
|
|
12
|
-
__all__ = ["decorators", "
|
11
|
+
__all__ = ["decorators", "collect", "queue", "run", "reset", "list_elements"]
|
junifer/api/decorators.py
CHANGED
junifer/api/functions.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide functions
|
1
|
+
"""Provide API functions."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
@@ -11,6 +11,7 @@ import typing
|
|
11
11
|
from pathlib import Path
|
12
12
|
from typing import Dict, List, Optional, Tuple, Union
|
13
13
|
|
14
|
+
from ..api.queue_context import GnuParallelLocalAdapter, HTCondorAdapter
|
14
15
|
from ..datagrabber.base import BaseDataGrabber
|
15
16
|
from ..markers.base import BaseMarker
|
16
17
|
from ..markers.collection import MarkerCollection
|
@@ -18,9 +19,7 @@ from ..pipeline import WorkDirManager
|
|
18
19
|
from ..pipeline.registry import build
|
19
20
|
from ..preprocess.base import BasePreprocessor
|
20
21
|
from ..storage.base import BaseFeatureStorage
|
21
|
-
from ..utils import logger, raise_error
|
22
|
-
from .queue_context import GnuParallelLocalAdapter, HTCondorAdapter
|
23
|
-
from .utils import yaml
|
22
|
+
from ..utils import logger, raise_error, yaml
|
24
23
|
|
25
24
|
|
26
25
|
__all__ = ["run", "collect", "queue", "reset", "list_elements"]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide tests for functions."""
|
1
|
+
"""Provide tests for API functions."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
@@ -13,7 +13,7 @@ import pytest
|
|
13
13
|
from ruamel.yaml import YAML
|
14
14
|
|
15
15
|
import junifer.testing.registry # noqa: F401
|
16
|
-
from junifer.api
|
16
|
+
from junifer.api import collect, list_elements, queue, reset, run
|
17
17
|
from junifer.datagrabber.base import BaseDataGrabber
|
18
18
|
from junifer.pipeline.registry import build
|
19
19
|
|
junifer/cli/__init__.py
ADDED
junifer/{api → cli}/cli.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide functions for
|
1
|
+
"""Provide functions for CLI."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -8,122 +8,26 @@ import pathlib
|
|
8
8
|
import subprocess
|
9
9
|
import sys
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import
|
11
|
+
from typing import Optional, Tuple, Union
|
12
12
|
|
13
13
|
import click
|
14
|
-
import pandas as pd
|
15
14
|
|
16
|
-
from ..
|
15
|
+
from ..api import functions as cli_func
|
16
|
+
from ..utils import (
|
17
17
|
configure_logging,
|
18
|
-
logger,
|
19
18
|
raise_error,
|
20
|
-
|
19
|
+
yaml,
|
21
20
|
)
|
22
|
-
from .
|
23
|
-
from .functions import list_elements as api_list_elements
|
24
|
-
from .functions import queue as api_queue
|
25
|
-
from .functions import reset as api_reset
|
26
|
-
from .functions import run as api_run
|
27
|
-
from .parser import parse_yaml
|
21
|
+
from .parser import parse_elements, parse_yaml
|
28
22
|
from .utils import (
|
29
23
|
_get_dependency_information,
|
30
24
|
_get_environment_information,
|
31
25
|
_get_junifer_version,
|
32
26
|
_get_python_information,
|
33
27
|
_get_system_information,
|
34
|
-
yaml,
|
35
28
|
)
|
36
29
|
|
37
30
|
|
38
|
-
def _parse_elements(element: Tuple[str], config: Dict) -> Union[List, None]:
|
39
|
-
"""Parse elements from cli.
|
40
|
-
|
41
|
-
Parameters
|
42
|
-
----------
|
43
|
-
element : tuple of str
|
44
|
-
The element(s) to operate on.
|
45
|
-
config : dict
|
46
|
-
The configuration to operate using.
|
47
|
-
|
48
|
-
Returns
|
49
|
-
-------
|
50
|
-
list or None
|
51
|
-
The element(s) as list or None.
|
52
|
-
|
53
|
-
Raises
|
54
|
-
------
|
55
|
-
ValueError
|
56
|
-
If no element is found either in the command-line options or
|
57
|
-
the configuration file.
|
58
|
-
|
59
|
-
Warns
|
60
|
-
-----
|
61
|
-
RuntimeWarning
|
62
|
-
If elements are specified both via the command-line options and
|
63
|
-
the configuration file.
|
64
|
-
|
65
|
-
"""
|
66
|
-
logger.debug(f"Parsing elements: {element}")
|
67
|
-
# Early return None to continue with all elements
|
68
|
-
if len(element) == 0:
|
69
|
-
return None
|
70
|
-
# Check if the element is a file for single element;
|
71
|
-
# if yes, then parse elements from it
|
72
|
-
if len(element) == 1 and Path(element[0]).resolve().is_file():
|
73
|
-
elements = _parse_elements_file(Path(element[0]).resolve())
|
74
|
-
else:
|
75
|
-
# Process multi-keyed elements
|
76
|
-
elements = [tuple(x.split(",")) if "," in x else x for x in element]
|
77
|
-
logger.debug(f"Parsed elements: {elements}")
|
78
|
-
if elements is not None and "elements" in config:
|
79
|
-
warn_with_log(
|
80
|
-
"One or more elements have been specified in both the command "
|
81
|
-
"line and in the config file. The command line has precedence "
|
82
|
-
"over the configuration file. That is, the elements specified "
|
83
|
-
"in the command line will be used. The elements specified in "
|
84
|
-
"the configuration file will be ignored. To remove this warning, "
|
85
|
-
"please remove the `elements` item from the configuration file."
|
86
|
-
)
|
87
|
-
elif elements is None:
|
88
|
-
# Check in config
|
89
|
-
elements = config.get("elements", None)
|
90
|
-
if elements is None:
|
91
|
-
raise_error(
|
92
|
-
"The `elements` key is set in the configuration, but its value"
|
93
|
-
" is `None`. It is likely that there is an empty `elements` "
|
94
|
-
"section in the yaml configuration file."
|
95
|
-
)
|
96
|
-
return elements
|
97
|
-
|
98
|
-
|
99
|
-
def _parse_elements_file(filepath: Path) -> List[Tuple[str, ...]]:
|
100
|
-
"""Parse elements from file.
|
101
|
-
|
102
|
-
Parameters
|
103
|
-
----------
|
104
|
-
filepath : pathlib.Path
|
105
|
-
The path to the element file.
|
106
|
-
|
107
|
-
Returns
|
108
|
-
-------
|
109
|
-
list of tuple of str
|
110
|
-
The element(s) as list.
|
111
|
-
|
112
|
-
"""
|
113
|
-
# Read CSV into dataframe
|
114
|
-
csv_df = pd.read_csv(
|
115
|
-
filepath,
|
116
|
-
header=None, # no header # type: ignore
|
117
|
-
index_col=False, # no index column
|
118
|
-
dtype=str,
|
119
|
-
skipinitialspace=True, # no leading space after delimiter
|
120
|
-
)
|
121
|
-
# Remove trailing whitespace in cell entries
|
122
|
-
csv_df_trimmed = csv_df.apply(lambda x: x.str.strip())
|
123
|
-
# Convert to list of tuple of str
|
124
|
-
return list(map(tuple, csv_df_trimmed.to_numpy()))
|
125
|
-
|
126
|
-
|
127
31
|
def _validate_verbose(
|
128
32
|
ctx: click.Context, param: str, value: str
|
129
33
|
) -> Union[str, int]:
|
@@ -166,7 +70,7 @@ def _validate_verbose(
|
|
166
70
|
|
167
71
|
@click.group()
|
168
72
|
def cli() -> None: # pragma: no cover
|
169
|
-
"""
|
73
|
+
"""JUelich NeuroImaging FEature extractoR."""
|
170
74
|
|
171
75
|
|
172
76
|
@cli.command()
|
@@ -187,7 +91,7 @@ def cli() -> None: # pragma: no cover
|
|
187
91
|
def run(
|
188
92
|
filepath: click.Path, element: Tuple[str], verbose: Union[str, int]
|
189
93
|
) -> None:
|
190
|
-
"""Run
|
94
|
+
"""Run feature extraction.
|
191
95
|
|
192
96
|
\f
|
193
97
|
|
@@ -219,9 +123,9 @@ def run(
|
|
219
123
|
if preprocessors is not None and not isinstance(preprocessors, list):
|
220
124
|
preprocessors = [preprocessors]
|
221
125
|
# Parse elements
|
222
|
-
elements =
|
126
|
+
elements = parse_elements(element, config)
|
223
127
|
# Perform operation
|
224
|
-
|
128
|
+
cli_func.run(
|
225
129
|
workdir=workdir,
|
226
130
|
datagrabber=datagrabber,
|
227
131
|
markers=markers,
|
@@ -246,7 +150,7 @@ def run(
|
|
246
150
|
default="info",
|
247
151
|
)
|
248
152
|
def collect(filepath: click.Path, verbose: Union[str, int]) -> None:
|
249
|
-
"""Collect
|
153
|
+
"""Collect extracted features.
|
250
154
|
|
251
155
|
\f
|
252
156
|
|
@@ -263,7 +167,7 @@ def collect(filepath: click.Path, verbose: Union[str, int]) -> None:
|
|
263
167
|
config = parse_yaml(filepath) # type: ignore
|
264
168
|
storage = config["storage"]
|
265
169
|
# Perform operation
|
266
|
-
|
170
|
+
cli_func.collect(storage=storage)
|
267
171
|
|
268
172
|
|
269
173
|
@cli.command()
|
@@ -290,7 +194,7 @@ def queue(
|
|
290
194
|
submit: bool,
|
291
195
|
verbose: Union[str, int],
|
292
196
|
) -> None:
|
293
|
-
"""Queue
|
197
|
+
"""Queue feature extraction.
|
294
198
|
|
295
199
|
\f
|
296
200
|
|
@@ -311,12 +215,12 @@ def queue(
|
|
311
215
|
configure_logging(level=verbose)
|
312
216
|
# TODO: add validation
|
313
217
|
config = parse_yaml(filepath) # type: ignore
|
314
|
-
elements =
|
218
|
+
elements = parse_elements(element, config)
|
315
219
|
if "queue" not in config:
|
316
220
|
raise_error(f"No queue configuration found in {filepath}.")
|
317
221
|
queue_config = config.pop("queue")
|
318
222
|
kind = queue_config.pop("kind")
|
319
|
-
|
223
|
+
cli_func.queue(
|
320
224
|
config=config,
|
321
225
|
kind=kind,
|
322
226
|
overwrite=overwrite,
|
@@ -329,7 +233,7 @@ def queue(
|
|
329
233
|
@cli.command()
|
330
234
|
@click.option("--long", "long_", is_flag=True)
|
331
235
|
def wtf(long_: bool) -> None:
|
332
|
-
"""
|
236
|
+
"""WTF?!.
|
333
237
|
|
334
238
|
\f
|
335
239
|
|
@@ -352,7 +256,7 @@ def wtf(long_: bool) -> None:
|
|
352
256
|
@cli.command()
|
353
257
|
@click.argument("subpkg", type=str)
|
354
258
|
def selftest(subpkg: str) -> None:
|
355
|
-
"""Selftest
|
259
|
+
"""Selftest.
|
356
260
|
|
357
261
|
\f
|
358
262
|
|
@@ -433,7 +337,7 @@ def reset(
|
|
433
337
|
filepath: click.Path,
|
434
338
|
verbose: Union[str, int],
|
435
339
|
) -> None:
|
436
|
-
"""Reset
|
340
|
+
"""Reset generated assets.
|
437
341
|
|
438
342
|
\f
|
439
343
|
|
@@ -449,7 +353,7 @@ def reset(
|
|
449
353
|
# Parse YAML
|
450
354
|
config = parse_yaml(filepath)
|
451
355
|
# Perform operation
|
452
|
-
|
356
|
+
cli_func.reset(config)
|
453
357
|
|
454
358
|
|
455
359
|
@cli.command()
|
@@ -478,7 +382,7 @@ def list_elements(
|
|
478
382
|
output_file: Optional[click.Path],
|
479
383
|
verbose: Union[str, int],
|
480
384
|
) -> None:
|
481
|
-
"""
|
385
|
+
"""List elements of a dataset.
|
482
386
|
|
483
387
|
\f
|
484
388
|
|
@@ -501,9 +405,9 @@ def list_elements(
|
|
501
405
|
# Fetch datagrabber
|
502
406
|
datagrabber = config["datagrabber"]
|
503
407
|
# Parse elements
|
504
|
-
elements =
|
408
|
+
elements = parse_elements(element, config)
|
505
409
|
# Perform operation
|
506
|
-
listed_elements =
|
410
|
+
listed_elements = cli_func.list_elements(
|
507
411
|
datagrabber=datagrabber,
|
508
412
|
elements=elements,
|
509
413
|
)
|
@@ -517,7 +421,7 @@ def list_elements(
|
|
517
421
|
|
518
422
|
@cli.group()
|
519
423
|
def setup() -> None: # pragma: no cover
|
520
|
-
"""Configure
|
424
|
+
"""Configure external tools."""
|
521
425
|
pass
|
522
426
|
|
523
427
|
|
junifer/{api → cli}/parser.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide functions for parser."""
|
1
|
+
"""Provide functions for CLI parser."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -8,16 +8,17 @@ import importlib
|
|
8
8
|
import importlib.util
|
9
9
|
import sys
|
10
10
|
from pathlib import Path
|
11
|
-
from typing import Dict, Union
|
11
|
+
from typing import Dict, List, Tuple, Union
|
12
12
|
|
13
|
-
|
14
|
-
from .utils import yaml
|
13
|
+
import pandas as pd
|
15
14
|
|
15
|
+
from ..utils import logger, raise_error, warn_with_log, yaml
|
16
16
|
|
17
|
-
__all__ = ["parse_yaml"]
|
18
17
|
|
18
|
+
__all__ = ["parse_yaml", "parse_elements"]
|
19
19
|
|
20
|
-
|
20
|
+
|
21
|
+
def parse_yaml(filepath: Union[str, Path]) -> Dict: # noqa: C901
|
21
22
|
"""Parse YAML.
|
22
23
|
|
23
24
|
Parameters
|
@@ -64,14 +65,35 @@ def parse_yaml(filepath: Union[str, Path]) -> Dict:
|
|
64
65
|
raise_error(
|
65
66
|
f"File in 'with' section does not exist: {file_path}"
|
66
67
|
)
|
68
|
+
# Add the parent directory to the sys.path so that the
|
69
|
+
# any imports from this module work correctly
|
70
|
+
t_path = str(file_path.parent)
|
71
|
+
if t_path not in sys.path:
|
72
|
+
sys.path.append(str(file_path.parent))
|
73
|
+
|
67
74
|
spec = importlib.util.spec_from_file_location(
|
68
75
|
t_module, file_path
|
69
76
|
)
|
70
77
|
module = importlib.util.module_from_spec(spec) # type: ignore
|
71
78
|
sys.modules[t_module] = module
|
72
79
|
spec.loader.exec_module(module) # type: ignore
|
80
|
+
|
73
81
|
# Add absolute path to final list
|
74
82
|
final_to_load.append(str(file_path.resolve()))
|
83
|
+
|
84
|
+
# Check if the module has junifer_module_deps function
|
85
|
+
if hasattr(module, "junifer_module_deps"):
|
86
|
+
logger.debug(
|
87
|
+
f"Module {t_module} has junifer_module_deps function"
|
88
|
+
)
|
89
|
+
# Get the dependencies
|
90
|
+
deps = module.junifer_module_deps()
|
91
|
+
# Add the dependencies to the final list
|
92
|
+
for dep in deps:
|
93
|
+
if dep not in final_to_load:
|
94
|
+
final_to_load.append(
|
95
|
+
str((file_path.parent / dep).resolve())
|
96
|
+
)
|
75
97
|
else:
|
76
98
|
logger.info(f"Importing module: {t_module}")
|
77
99
|
importlib.import_module(t_module)
|
@@ -116,3 +138,92 @@ def parse_yaml(filepath: Union[str, Path]) -> Dict:
|
|
116
138
|
)
|
117
139
|
|
118
140
|
return contents
|
141
|
+
|
142
|
+
|
143
|
+
def parse_elements(element: Tuple[str], config: Dict) -> Union[List, None]:
|
144
|
+
"""Parse elements from cli.
|
145
|
+
|
146
|
+
Parameters
|
147
|
+
----------
|
148
|
+
element : tuple of str
|
149
|
+
The element(s) to operate on.
|
150
|
+
config : dict
|
151
|
+
The configuration to operate using.
|
152
|
+
|
153
|
+
Returns
|
154
|
+
-------
|
155
|
+
list or None
|
156
|
+
The element(s) as list or None.
|
157
|
+
|
158
|
+
Raises
|
159
|
+
------
|
160
|
+
ValueError
|
161
|
+
If no element is found either in the command-line options or
|
162
|
+
the configuration file.
|
163
|
+
|
164
|
+
Warns
|
165
|
+
-----
|
166
|
+
RuntimeWarning
|
167
|
+
If elements are specified both via the command-line options and
|
168
|
+
the configuration file.
|
169
|
+
|
170
|
+
"""
|
171
|
+
logger.debug(f"Parsing elements: {element}")
|
172
|
+
# Early return None to continue with all elements
|
173
|
+
if len(element) == 0:
|
174
|
+
return None
|
175
|
+
# Check if the element is a file for single element;
|
176
|
+
# if yes, then parse elements from it
|
177
|
+
if len(element) == 1 and Path(element[0]).resolve().is_file():
|
178
|
+
elements = _parse_elements_file(Path(element[0]).resolve())
|
179
|
+
else:
|
180
|
+
# Process multi-keyed elements
|
181
|
+
elements = [tuple(x.split(",")) if "," in x else x for x in element]
|
182
|
+
logger.debug(f"Parsed elements: {elements}")
|
183
|
+
if elements is not None and "elements" in config:
|
184
|
+
warn_with_log(
|
185
|
+
"One or more elements have been specified in both the command "
|
186
|
+
"line and in the config file. The command line has precedence "
|
187
|
+
"over the configuration file. That is, the elements specified "
|
188
|
+
"in the command line will be used. The elements specified in "
|
189
|
+
"the configuration file will be ignored. To remove this warning, "
|
190
|
+
"please remove the `elements` item from the configuration file."
|
191
|
+
)
|
192
|
+
elif elements is None:
|
193
|
+
# Check in config
|
194
|
+
elements = config.get("elements", None)
|
195
|
+
if elements is None:
|
196
|
+
raise_error(
|
197
|
+
"The `elements` key is set in the configuration, but its value"
|
198
|
+
" is `None`. It is likely that there is an empty `elements` "
|
199
|
+
"section in the yaml configuration file."
|
200
|
+
)
|
201
|
+
return elements
|
202
|
+
|
203
|
+
|
204
|
+
def _parse_elements_file(filepath: Path) -> List[Tuple[str, ...]]:
|
205
|
+
"""Parse elements from file.
|
206
|
+
|
207
|
+
Parameters
|
208
|
+
----------
|
209
|
+
filepath : pathlib.Path
|
210
|
+
The path to the element file.
|
211
|
+
|
212
|
+
Returns
|
213
|
+
-------
|
214
|
+
list of tuple of str
|
215
|
+
The element(s) as list.
|
216
|
+
|
217
|
+
"""
|
218
|
+
# Read CSV into dataframe
|
219
|
+
csv_df = pd.read_csv(
|
220
|
+
filepath,
|
221
|
+
header=None, # no header # type: ignore
|
222
|
+
index_col=False, # no index column
|
223
|
+
dtype=str,
|
224
|
+
skipinitialspace=True, # no leading space after delimiter
|
225
|
+
)
|
226
|
+
# Remove trailing whitespace in cell entries
|
227
|
+
csv_df_trimmed = csv_df.apply(lambda x: x.str.strip())
|
228
|
+
# Convert to list of tuple of str
|
229
|
+
return list(map(tuple, csv_df_trimmed.to_numpy()))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide tests for
|
1
|
+
"""Provide tests for CLI."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -11,8 +11,7 @@ import pytest
|
|
11
11
|
from click.testing import CliRunner
|
12
12
|
from ruamel.yaml import YAML
|
13
13
|
|
14
|
-
from junifer.
|
15
|
-
_parse_elements_file,
|
14
|
+
from junifer.cli.cli import (
|
16
15
|
collect,
|
17
16
|
list_elements,
|
18
17
|
queue,
|
@@ -21,6 +20,7 @@ from junifer.api.cli import (
|
|
21
20
|
selftest,
|
22
21
|
wtf,
|
23
22
|
)
|
23
|
+
from junifer.cli.parser import _parse_elements_file
|
24
24
|
|
25
25
|
|
26
26
|
# Configure YAML class
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide tests for utils."""
|
1
|
+
"""Provide tests for CLI utils."""
|
2
2
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
@@ -9,7 +9,7 @@ import sys
|
|
9
9
|
import pytest
|
10
10
|
|
11
11
|
from junifer._version import __version__
|
12
|
-
from junifer.
|
12
|
+
from junifer.cli.utils import (
|
13
13
|
_get_dependency_information,
|
14
14
|
_get_environment_information,
|
15
15
|
_get_junifer_version,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide tests for parser."""
|
1
|
+
"""Provide tests for CLI parser."""
|
2
2
|
|
3
3
|
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
@@ -9,7 +9,7 @@ from pathlib import Path
|
|
9
9
|
|
10
10
|
import pytest
|
11
11
|
|
12
|
-
from junifer.
|
12
|
+
from junifer.cli.parser import parse_yaml
|
13
13
|
|
14
14
|
|
15
15
|
def test_parse_yaml_failure() -> None:
|
junifer/{api → cli}/utils.py
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Provide utility functions for the
|
1
|
+
"""Provide utility functions for the cli sub-package."""
|
2
2
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
@@ -9,19 +9,10 @@ import re
|
|
9
9
|
from importlib.metadata import distribution
|
10
10
|
from typing import Dict
|
11
11
|
|
12
|
-
from ruamel.yaml import YAML
|
13
|
-
|
14
12
|
from .._version import __version__
|
15
13
|
from ..utils.logging import get_versions
|
16
14
|
|
17
15
|
|
18
|
-
# Configure YAML class once for further use
|
19
|
-
yaml = YAML()
|
20
|
-
yaml.default_flow_style = False
|
21
|
-
yaml.allow_unicode = True
|
22
|
-
yaml.indent(mapping=2, sequence=4, offset=2)
|
23
|
-
|
24
|
-
|
25
16
|
def _get_junifer_version() -> Dict[str, str]:
|
26
17
|
"""Get junifer version information.
|
27
18
|
|
junifer/utils/__init__.py
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
from .fs import make_executable
|
8
8
|
from .logging import configure_logging, logger, raise_error, warn_with_log
|
9
9
|
from .helpers import run_ext_cmd, deep_update
|
10
|
+
from ._yaml import yaml
|
10
11
|
|
11
12
|
|
12
13
|
__all__ = [
|
@@ -17,4 +18,5 @@ __all__ = [
|
|
17
18
|
"warn_with_log",
|
18
19
|
"run_ext_cmd",
|
19
20
|
"deep_update",
|
21
|
+
"yaml",
|
20
22
|
]
|
junifer/utils/_yaml.py
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
"""Provide YAML config definition for junifer use."""
|
2
|
+
|
3
|
+
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
|
+
# License: AGPL
|
5
|
+
|
6
|
+
from ruamel.yaml import YAML
|
7
|
+
|
8
|
+
|
9
|
+
__all__ = ["yaml"]
|
10
|
+
|
11
|
+
|
12
|
+
# Configure YAML class once for further use
|
13
|
+
yaml = YAML()
|
14
|
+
yaml.default_flow_style = False
|
15
|
+
yaml.allow_unicode = True
|
16
|
+
yaml.indent(mapping=2, sequence=4, offset=2)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: junifer
|
3
|
-
Version: 0.0.6.
|
3
|
+
Version: 0.0.6.dev51
|
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,12 +1,9 @@
|
|
1
|
-
junifer/__init__.py,sha256
|
2
|
-
junifer/_version.py,sha256=
|
1
|
+
junifer/__init__.py,sha256=qlrkRK5qZYHkYG6B4tLA7cvrQsgyCunNRv1Oz4FBWlQ,624
|
2
|
+
junifer/_version.py,sha256=wxfrOd7_CEPqj_M0iVbFwX_dk3Cf85sB-l-MFRD_h1o,426
|
3
3
|
junifer/stats.py,sha256=BjQb2lfTGDP9l4UuQYmJFcJJNRfbJDGlNvC06SJaDDE,6237
|
4
|
-
junifer/api/__init__.py,sha256=
|
5
|
-
junifer/api/
|
6
|
-
junifer/api/
|
7
|
-
junifer/api/functions.py,sha256=dnQvLDHE3bSLP9yBj3MkNLYdy8jhvjTF5vI4IDGwpbE,13105
|
8
|
-
junifer/api/parser.py,sha256=f7xZbn3MW1GEEJnb1SlCGkAj9n6gvquzjDB5knmBDcA,4443
|
9
|
-
junifer/api/utils.py,sha256=dyjTdPMwX9qeCrn8SQT2Pjshfnu-y1FEyujV7lCzvm0,3333
|
4
|
+
junifer/api/__init__.py,sha256=JYZLJe8oEnJpNpq0RrhEGP6Tj5GP2DHlixFwJtTcV0Y,324
|
5
|
+
junifer/api/decorators.py,sha256=SkQjDYcB_cwG7AS5Q_BU1-T3b38T5RHzbW3aQHP-NzM,2723
|
6
|
+
junifer/api/functions.py,sha256=uHGXt4mj3V6oZf0T0VcOSrD2DarfamIRWKOz5lqXLjU,13088
|
10
7
|
junifer/api/queue_context/__init__.py,sha256=1ZO7e0rlfCvgXeVsfqZhHTqqIEbE_lOExCLro5jYaFA,353
|
11
8
|
junifer/api/queue_context/gnu_parallel_local_adapter.py,sha256=x2eQRVkhwJKd-Kx8AYia4F8nYnOLJrFzMGMjcwUygEc,9561
|
12
9
|
junifer/api/queue_context/htcondor_adapter.py,sha256=92pt4M_r52inBVlQ2M8Di6quEKW4Xcq3qVNRXaV4rGY,13233
|
@@ -36,13 +33,17 @@ junifer/api/res/fsl/flirt,sha256=tSjiUco8ui8AbHD7mTzChEwbR0Rf_4iJTgzYTPF_WuQ,42
|
|
36
33
|
junifer/api/res/fsl/img2imgcoord,sha256=Zmaw3oJYrEltcXiPyEubXry9ppAq3SND52tdDWGgeZk,49
|
37
34
|
junifer/api/res/fsl/run_fsl_docker.sh,sha256=pq-fcNdLuvHzVIQePN4GebZGlcE2UF-xj5rBIqAMz4g,1122
|
38
35
|
junifer/api/res/fsl/std2imgcoord,sha256=-X5wRH6XMl0yqnTACJX6MFhO8DFOEWg42MHRxGvimXg,49
|
39
|
-
junifer/api/tests/
|
40
|
-
junifer/
|
41
|
-
junifer/
|
42
|
-
junifer/
|
43
|
-
junifer/
|
44
|
-
junifer/
|
45
|
-
junifer/
|
36
|
+
junifer/api/tests/test_functions.py,sha256=JjtdB_dFnikGdgkhtvzoJsV_jbW0X1cNRqjFk2jJmLI,17747
|
37
|
+
junifer/cli/__init__.py,sha256=nrv2l2-t0kLWtNoqmjJKPM0_FP7BvuA_Qc3_GjHBWpM,128
|
38
|
+
junifer/cli/cli.py,sha256=8emD8-GZzeXyY6mPw3WUYWllConuzLOZLAacYtNgqJw,12981
|
39
|
+
junifer/cli/parser.py,sha256=oZf0oiFcp7vTTMFmFv9qcIqnKMS5wZSCqBmKggN_F0c,8355
|
40
|
+
junifer/cli/utils.py,sha256=uA_MaPuZe8qFxxF0hM5iWNL6rLwbYN2mAPXcWm7YxcM,3140
|
41
|
+
junifer/cli/tests/test_cli.py,sha256=DEgjdnGu0r1UmCcu6DavwRuN2i6tZpAs-sYxgoAF7oo,10995
|
42
|
+
junifer/cli/tests/test_cli_utils.py,sha256=dGHuH-86_vhvqhEmWsoM2ujT31n6I535OutiafFKoHo,2700
|
43
|
+
junifer/cli/tests/test_parser.py,sha256=5A6yI2t9Ou5w--wpEzXY7mdcVMWWFZaTNLPQ6yLU9gI,6113
|
44
|
+
junifer/cli/tests/data/gmd_mean.yaml,sha256=Ohb_C5cfQMK-59U9O1ZhejXyBtzLc5Y4cv8QyYq2azg,330
|
45
|
+
junifer/cli/tests/data/gmd_mean_htcondor.yaml,sha256=f7NLv_KIJXTiPNFmOWl2Vw8EfwojhfkGtwbh5prbd6w,417
|
46
|
+
junifer/cli/tests/data/partly_cloudy_agg_mean_tian.yml,sha256=nS8K_R1hEuV71Vv-i9SYjnDGAK2FClQqBiE4kOuQ_ys,313
|
46
47
|
junifer/configs/__init__.py,sha256=mE70B1Sc7Tn4uts1vMVF7Ie6hdj7PuDvmDmie3soA9I,121
|
47
48
|
junifer/configs/juseless/__init__.py,sha256=kQ8b7wIYfpUqQXlWzZQkGzSUfAOi_VLyLq4brRz6-Dg,188
|
48
49
|
junifer/configs/juseless/datagrabbers/__init__.py,sha256=vDg8wL5fs3mpsA4modWXpXqYkRy6neP-RiMlGdfTe58,623
|
@@ -260,17 +261,18 @@ junifer/testing/tests/test_spmauditory_datagrabber.py,sha256=1G1emk-Ze59HiNLaYsy
|
|
260
261
|
junifer/testing/tests/test_testing_registry.py,sha256=oerticBaPRaRZm3yANzInLac0Mqph3Y0aZPQFayu7xA,827
|
261
262
|
junifer/tests/test_main.py,sha256=GMff7jlisGM9_FsiUwWDte43j-KQJGFRYZpwRRqTkd8,373
|
262
263
|
junifer/tests/test_stats.py,sha256=3vPMgYYpWxk8ECDFOMm3-dFBlh4XxjL83SwRBSBAHok,4155
|
263
|
-
junifer/utils/__init__.py,sha256=
|
264
|
+
junifer/utils/__init__.py,sha256=K_9X0b5GE9bPHaFjBAKR-k9ONxmcKKkORG53dVyn_q4,507
|
265
|
+
junifer/utils/_yaml.py,sha256=jpTroTI2rajECj0RXGCXaOwLpad858WzI7Jg-eXJ_jU,336
|
264
266
|
junifer/utils/fs.py,sha256=M3CKBLh4gPS6s9giyopgb1hHMXzLb6k3cung2wHVBjs,492
|
265
267
|
junifer/utils/helpers.py,sha256=_IqnaPaOcFy1yrEyNmmg7XqQWb1wHOtxfOBnlaRYbiI,2063
|
266
268
|
junifer/utils/logging.py,sha256=ardaiJkDfZMYvak5UIL5Etxg5Ii7inmVQSBdFLdgtb8,9781
|
267
269
|
junifer/utils/tests/test_fs.py,sha256=WQS7cKlKEZ742CIuiOYYpueeAhY9PqlastfDVpVVtvE,923
|
268
270
|
junifer/utils/tests/test_helpers.py,sha256=k5qqfxK8dFyuewTJyR1Qn6-nFaYNuVr0ysc18bfPjyU,929
|
269
271
|
junifer/utils/tests/test_logging.py,sha256=duO4ou365hxwa_kwihFtKPLaL6LC5XHiyhOijrrngbA,8009
|
270
|
-
junifer-0.0.6.
|
271
|
-
junifer-0.0.6.
|
272
|
-
junifer-0.0.6.
|
273
|
-
junifer-0.0.6.
|
274
|
-
junifer-0.0.6.
|
275
|
-
junifer-0.0.6.
|
276
|
-
junifer-0.0.6.
|
272
|
+
junifer-0.0.6.dev51.dist-info/AUTHORS.rst,sha256=rmULKpchpSol4ExWFdm-qu4fkpSZPYqIESVJBZtGb6E,163
|
273
|
+
junifer-0.0.6.dev51.dist-info/LICENSE.md,sha256=MqCnOBu8uXsEOzRZWh9EBVfVz-kE9NkXcLCrtGXo2yU,34354
|
274
|
+
junifer-0.0.6.dev51.dist-info/METADATA,sha256=6-2OPunBbAYeN-FI86ZEc6XN9VHLKliwndVyE4Y3tPA,8398
|
275
|
+
junifer-0.0.6.dev51.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
276
|
+
junifer-0.0.6.dev51.dist-info/entry_points.txt,sha256=6O8ru0BP-SP7YMUZiizFNoaZ2HvJpadO2G7nKk4PwjI,48
|
277
|
+
junifer-0.0.6.dev51.dist-info/top_level.txt,sha256=4bAq1R2QFQ4b3hohjys2JBvxrl0GKk5LNFzYvz9VGcA,8
|
278
|
+
junifer-0.0.6.dev51.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|