Skip to content

Commit

Permalink
Make paths in expand position-only
Browse files Browse the repository at this point in the history
This will allow the addition of a second, optional position-only
argument following it: __spec. It also frees the name paths for
potential wilcard names, since paths is a valid wildcard name and right
now there's a conflict
  • Loading branch information
pvandyken committed Jun 22, 2023
1 parent 7a53418 commit 369c8e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions snakebids/core/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __eq__(self, other: BidsComponentRow | object) -> bool:

def expand(
self,
paths: Iterable[Path | str] | Path | str,
__paths: Iterable[Path | str] | Path | str,
allow_missing: bool = False,
**wildcards: str | Iterable[str],
) -> list[str]:
Expand All @@ -114,7 +114,7 @@ def expand(
Parameters
==========
paths:
__paths:
Path or list of paths to expand over
allow_missing:
If True, allow ``{wildcards}`` in the provided paths that are not present
Expand All @@ -126,7 +126,7 @@ def expand(
lists of values to be expanded over the provided paths.
"""
return sn_expand(
list(itx.always_iterable(paths)),
list(itx.always_iterable(__paths)),
allow_missing=allow_missing,
**{self.entity: list(set(self._data))},
**{
Expand Down Expand Up @@ -340,7 +340,7 @@ def __eq__(self, other: BidsComponent | object) -> bool:

def expand(
self,
paths: Iterable[Path | str] | Path | str,
__paths: Iterable[Path | str] | Path | str,
allow_missing: bool = False,
**wildcards: str | Iterable[str],
) -> list[str]:
Expand All @@ -358,7 +358,7 @@ def expand(
Parameters
==========
paths:
__paths:
Path or list of paths to expand over
allow_missing:
If True, allow ``{wildcards}`` in the provided paths that are not present
Expand All @@ -372,7 +372,7 @@ def expand(
inner_expand = list(
set(
sn_expand(
list(itx.always_iterable(paths)),
list(itx.always_iterable(__paths)),
zip,
allow_missing=True if wildcards else allow_missing,
**self.zip_lists,
Expand Down Expand Up @@ -515,7 +515,7 @@ def __eq__(self, other: BidsComponent | object) -> bool:

def expand(
self,
paths: Iterable[Path | str] | Path | str | None = None,
__paths: Iterable[Path | str] | Path | str | None = None,
allow_missing: bool = False,
**wildcards: str | Iterable[str],
) -> list[str]:
Expand All @@ -535,7 +535,7 @@ def expand(
Parameters
==========
paths:
__paths:
Path or list of paths to expand over. If not provided, the component's own
:attr:`~BidsComponent.path` will be expanded over.
allow_missing:
Expand All @@ -547,7 +547,7 @@ def expand(
Keywords not found in the path will be ignored. Keywords take values or
lists of values to be expanded over the provided paths.
"""
paths = paths or self.path
paths = __paths or self.path
return super().expand(paths, allow_missing, **wildcards)

@property
Expand Down
2 changes: 1 addition & 1 deletion snakebids/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def zip_lists(self) -> ZipList:

def expand(
self,
paths: Iterable[Path | str] | Path | str,
__paths: Iterable[Path | str] | Path | str,
allow_missing: bool = False,
**wildcards: str | Iterable[str],
) -> list[str]:
Expand Down

0 comments on commit 369c8e5

Please sign in to comment.