Skip to content

Commit

Permalink
sort bids specs in update-bids
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed Feb 11, 2024
1 parent 210332e commit 6447384
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion scripts/update_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_latest(versions: Iterable[BidsPathSpecFile]) -> tuple[str, BidsPathSpecF

def main():
"""update_bids entrypoint."""
all_specs = list(get_specs())
all_specs = sorted(get_specs(), key=lambda o: o["version"])
latest_version, latest_spec = get_latest(all_specs)
generate_stub(
specs,
Expand Down
2 changes: 1 addition & 1 deletion snakebids/paths/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# poetry run poe update-bids
#

VALID_SPECS: TypeAlias = Literal["v0_11_0", "v0_0_0", "latest"]
VALID_SPECS: TypeAlias = Literal["v0_0_0", "v0_11_0", "latest"]
# </AUTOUPDATE>

__all__ = ["set_bids_spec"]
Expand Down
4 changes: 2 additions & 2 deletions snakebids/paths/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#
if not TYPE_CHECKING:
__all__ = [ # noqa:F822
"v0_11_0",
"v0_0_0",
"v0_11_0",
"latest",
"LATEST",
]
Expand All @@ -25,7 +25,7 @@ def __dir__():
return __all__


_SPECS = ["v0_11_0", "v0_0_0"]
_SPECS = ["v0_0_0", "v0_11_0"]
# LATEST = "v0_11_0"
# </AUTOUPDATE>

Expand Down
52 changes: 26 additions & 26 deletions snakebids/paths/specs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,21 @@ from ._utils import BidsPathSpec

LATEST: str

def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""Spec corresponding to `BIDS v1.9.0`_.
Significantly expanded from the v0.0.0 spec, now including long names for every
relevant entity. In addition to the official spec, it includes `from` and `to`
entities intended for transformations. Unknown entities are placed just before desc,
so that the description entity is always last.
def v0_0_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""Get the v0.0.0 BidsPathSpec.
.. _BIDS v1.9.0: https://bids-specification.readthedocs.io/en/v1.9.0/
This spec alone equips :func:`~snakebids.bids` with 2 extra arguments:
``include_subject_dir`` and ``include_session_dir``. These default to ``True``, but
if set ``False``, remove the subject and session dirs respectively from the output
path. For future specs, this behaviour should be achieved by modifying the spec and
generating a new :func:`~snakebids.bids` function
Formatted as::
sub-{subject}/ses-{session}/{datatype}/{prefix}_sub-{subject}_ses-{session}_
sample-{sample}_task-{task}_tracksys-{tracksys}_acq-{acquisition}_
ce-{ceagent}_stain-{staining}_trc-{tracer}_rec-{reconstruction}_
dir-{direction}_run-{run}_mod-{modality}_echo-{echo}_flip-{flip}_
inv-{inversion}_mt-{mt}_proc-{processed}_part-{part}_space-{space}_
atlas-{atlas}_seg-{segmentation}_hemi-{hemisphere}_res-{resolution}_
den-{density}_roi-{roi}_from-{from}_to-{to}_split-{split}_
recording-{recording}_chunk-{chunk}_model-{model}_subset-{subset}_
label-{label}_..._desc-{description}_{suffix}{extension}
task-{task}_acq-{acq}_ce-{ce}_rec-{rec}_dir-{dir}_run-{run}_mod-{mod}_
echo-{echo}_hemi-{hemi}_space-{space}_res-{res}_den-{den}_label-{label}_
desc-{desc}_..._{suffix}{extension}
Parameters
Expand All @@ -41,21 +35,27 @@ def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""
...

def v0_0_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""Get the v0.0.0 BidsPathSpec.
def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""Spec corresponding to `BIDS v1.9.0`_.
This spec alone equips :func:`~snakebids.bids` with 2 extra arguments:
``include_subject_dir`` and ``include_session_dir``. These default to ``True``, but
if set ``False``, remove the subject and session dirs respectively from the output
path. For future specs, this behaviour should be achieved by modifying the spec and
generating a new :func:`~snakebids.bids` function
Significantly expanded from the v0.0.0 spec, now including long names for every
relevant entity. In addition to the official spec, it includes `from` and `to`
entities intended for transformations. Unknown entities are placed just before desc,
so that the description entity is always last.
.. _BIDS v1.9.0: https://bids-specification.readthedocs.io/en/v1.9.0/
Formatted as::
sub-{subject}/ses-{session}/{datatype}/{prefix}_sub-{subject}_ses-{session}_
task-{task}_acq-{acq}_ce-{ce}_rec-{rec}_dir-{dir}_run-{run}_mod-{mod}_
echo-{echo}_hemi-{hemi}_space-{space}_res-{res}_den-{den}_label-{label}_
desc-{desc}_..._{suffix}{extension}
sample-{sample}_task-{task}_tracksys-{tracksys}_acq-{acquisition}_
ce-{ceagent}_stain-{staining}_trc-{tracer}_rec-{reconstruction}_
dir-{direction}_run-{run}_mod-{modality}_echo-{echo}_flip-{flip}_
inv-{inversion}_mt-{mt}_proc-{processed}_part-{part}_space-{space}_
atlas-{atlas}_seg-{segmentation}_hemi-{hemisphere}_res-{resolution}_
den-{density}_roi-{roi}_from-{from}_to-{to}_split-{split}_
recording-{recording}_chunk-{chunk}_model-{model}_subset-{subset}_
label-{label}_..._desc-{description}_{suffix}{extension}
Parameters
Expand Down

0 comments on commit 6447384

Please sign in to comment.