Skip to content

Commit

Permalink
Add deprecation warnings to BidsDataset props
Browse files Browse the repository at this point in the history
Deprecate the Component getter properties (that currently allow
dataset->attr->component) to allow for future modification of those
properties
  • Loading branch information
pvandyken committed Feb 18, 2023
1 parent fe2bd79 commit f07e222
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions snakebids/core/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import attr
import more_itertools as itx
from cached_property import cached_property
from deprecation import deprecated
from typing_extensions import TypedDict

import snakebids.utils.sb_itertools as sb_it
Expand Down Expand Up @@ -200,6 +201,15 @@ def __setitem__(self, _: Any, __: Any):
)

@cached_property
@deprecated(
details="""
The behaviour of path will change in an upcoming release, where it
refer instead to the root path of the dataset. Please access component paths
using :attr:`Dataset[\\<component_name\\>].path <BidsComponent.path>`
""",
deprecated_in="0.8.0",
admonition="warning",
)
def path(self):
"""Dict mapping :class:`BidsComponents <snakebids.BidsComponent>` names to \
their ``paths``.
Expand All @@ -211,6 +221,16 @@ def input_path(self):
return self.path

@cached_property
@deprecated(
details="""
The behaviour of zip_lists will change in an upcoming release, where it will
refer instead to the consensus of entity groups across all components in the
dataset. Please access component zip_lists using
:attr:`Dataset[\\<component_name\\>].zip_lists <BidsComponent.zip_lists>`
""",
deprecated_in="0.8.0",
admonition="warning",
)
def zip_lists(self):
"""Dict mapping :class:`BidsComponents <snakebids.BidsComponent>` names to \
their ``zip_lists``
Expand All @@ -222,6 +242,16 @@ def input_zip_lists(self):
return self.zip_lists

@cached_property
@deprecated(
details="""
The behaviour of entities will change in the 1.0 release, where it will refer
instead to the union of all entity-values across all components in the dataset.
Please access component entity lists using
:attr:`Dataset[\\<component_name\\>].entities <BidsComponent.entities>`
""",
deprecated_in="0.8.0",
admonition="warning",
)
def entities(self):
"""Dict mapping :class:`BidsComponents <snakebids.BidsComponent>` names to \
to their :attr:`entities <snakebids.BidsComponent.entities>`
Expand All @@ -233,6 +263,16 @@ def input_lists(self):
return self.entities

@cached_property
@deprecated(
details="""
The behaviour of wildcards will change in an upcoming release, where it will
refer instead to the union of all entity-wildcard mappings across all components
in the dataset. Please access component entity lists using
:attr:`Dataset[\\<component_name\\>].wildcards <BidsComponent.wildcards>`
""",
deprecated_in="0.8.0",
admonition="warning",
)
def wildcards(self):
"""Dict mapping :class:`BidsComponents <snakebids.BidsComponent>` names to \
their :attr:`wildcards <snakebids.BidsComponent.wildcards>`
Expand Down

0 comments on commit f07e222

Please sign in to comment.