Skip to content

Commit

Permalink
Merge branch 'main' into schema
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Jan 23, 2025
2 parents 3f23bd2 + 3025315 commit dcca4a6
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,5 @@ data/*
.DS_Store
notebooks/testdata
.vscode/settings.json
notebooks/test1
notebooks/test1
docs/generated
25 changes: 19 additions & 6 deletions cubids/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def _parse_validate():
parser = argparse.ArgumentParser(
description="cubids validate: Wrapper around the official BIDS Validator",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -245,6 +246,7 @@ def _parse_bids_version():
parser = argparse.ArgumentParser(
description="cubids bids-version: Get BIDS Validator and Schema version",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -328,6 +330,7 @@ def _parse_bids_sidecar_merge():
parser = argparse.ArgumentParser(
description=("bids-sidecar-merge: merge critical keys from one sidecar to another"),
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
IsFile = partial(_is_file, parser=parser)

Expand Down Expand Up @@ -412,6 +415,7 @@ def _parse_group():
parser = argparse.ArgumentParser(
description="cubids group: find key and parameter groups in BIDS",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -534,6 +538,7 @@ def _parse_apply():
parser = argparse.ArgumentParser(
description=("cubids apply: apply the changes specified in a tsv to a BIDS directory"),
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)
IsFile = partial(_is_file, parser=parser)
Expand All @@ -549,7 +554,7 @@ def _parse_apply():
)
parser.add_argument(
"edited_summary_tsv",
type=IsFile,
type=Path,
action="store",
help=(
"path to the _summary.tsv that has been edited "
Expand All @@ -561,7 +566,7 @@ def _parse_apply():
)
parser.add_argument(
"files_tsv",
type=IsFile,
type=Path,
action="store",
help=(
"path to the _files.tsv that has been edited "
Expand Down Expand Up @@ -669,6 +674,7 @@ def _parse_datalad_save():
parser = argparse.ArgumentParser(
description=("cubids datalad-save: perform a DataLad save on a BIDS directory"),
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -756,6 +762,7 @@ def _parse_undo():
parser = argparse.ArgumentParser(
description="cubids undo: revert most recent commit",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -852,9 +859,10 @@ def _parse_copy_exemplars():
"one subject from each Acquisition Group in the BIDS dataset"
),
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)
IsFile = partial(_is_file, parser=parser)
# IsFile = partial(_is_file, parser=parser)

parser.add_argument(
"bids_dir",
Expand All @@ -868,7 +876,7 @@ def _parse_copy_exemplars():
)
parser.add_argument(
"exemplars_dir",
type=PathExists,
type=Path,
action="store",
help=(
"name of the directory to create where to store exemplar dataset. "
Expand All @@ -879,7 +887,7 @@ def _parse_copy_exemplars():
)
parser.add_argument(
"exemplars_tsv",
type=IsFile,
type=Path,
action="store",
help=(
"path to the .tsv that lists one "
Expand Down Expand Up @@ -987,6 +995,7 @@ def _parse_add_nifti_info():
"files to the sidecars of each dataset"
),
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -1081,6 +1090,7 @@ def _parse_purge():
parser = argparse.ArgumentParser(
description="cubids purge: purge associations from the dataset",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)
IsFile = partial(_is_file, parser=parser)
Expand Down Expand Up @@ -1182,6 +1192,7 @@ def _parse_remove_metadata_fields():
parser = argparse.ArgumentParser(
description="cubids remove-metadata-fields: delete fields from metadata",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -1274,6 +1285,7 @@ def _parse_print_metadata_fields():
parser = argparse.ArgumentParser(
description="cubids print-metadata-fields: print all unique metadata fields",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
allow_abbrev=False,
)
PathExists = partial(_path_exists, parser=parser)

Expand Down Expand Up @@ -1359,7 +1371,7 @@ def _get_parser():
"""
from cubids import __version__

parser = argparse.ArgumentParser(prog="cubids")
parser = argparse.ArgumentParser(prog="cubids", allow_abbrev=False)
parser.add_argument("-v", "--version", action="version", version=__version__)
subparsers = parser.add_subparsers(help="CuBIDS commands")

Expand All @@ -1371,6 +1383,7 @@ def _get_parser():
parents=[subparser],
help=subparser.description,
add_help=False,
allow_abbrev=False,
)

return parser
Expand Down
Loading

0 comments on commit dcca4a6

Please sign in to comment.