Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed May 1, 2024
1 parent ed7dbe6 commit 39eee99
Show file tree
Hide file tree
Showing 21 changed files with 272 additions and 302 deletions.
457 changes: 224 additions & 233 deletions poetry.lock

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ docutils = "!=0.21.post1"
pluggy = ">=1.3"

[tool.poetry.group.dev.dependencies]
pytest = "^7.0.0"
pytest = "^8"
pytest-mock = "^3.7.0"
poethepoet = "^0.25.1"
poethepoet = "^0.26"
pre-commit = "^3.0.0"
# a mkinit dep has the 'platform_system == "Windows"' as a marker on an incompatible dependeny
# (pydantic<2.0 cf copier), so set the inverse as a marker here so mkinit can
Expand All @@ -95,7 +95,7 @@ pathvalidate = "^3.0.0"
# Bug in .358 preventing the types from the converter arguments of attrs classes to
# propogate properly
pyright = "^1.1.339,<1.1.358"
ruff = "^0.1.7"
ruff = "^0.4"
pytest-xdist = "^3.3.1"
pytest-split = "^0.8.1"
tomli = "^2.0.1"
Expand All @@ -107,9 +107,9 @@ docstring-parser = "^0.16"
[tool.poetry.group.docs.dependencies]
sphinx = "^7"
sphinx-argparse = "^0.4.0"
sphinxcontrib-asciinema = "^0.3.8"
myst-parser = "^2.0.0"
furo = "^2023.9.10"
sphinxcontrib-asciinema = "^0.4"
myst-parser = "^3"
furo = "^2024.4.27"
sphinx-copybutton = "^0.5.2"
sphinx-reredirects = "^0.1.3"
sphinx-design = "^0.5.0"
Expand Down Expand Up @@ -204,6 +204,9 @@ reportPrivateUsage = false
reportImportCycles = false

[tool.ruff]
target-version = "py38"

[tool.ruff.lint]
select = [
"E", # pycodestyle error
"W", # pycodestyle warning
Expand Down Expand Up @@ -267,11 +270,7 @@ ignore = [
"ISC002",
]


target-version = "py38"


[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"snakebids/project_template/**" = ["N999"]
"snakebids/tests/**" = [
"D",
Expand All @@ -280,14 +279,14 @@ target-version = "py38"
"SLF",
]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
ignore-decorators = ["snakebids.utils.utils.property_alias"]

[tool.ruff.flake8-builtins]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["filter"]

[tool.ruff.flake8-import-conventions.extend-aliases]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
itertools = "it"
functools = "ft"
operator = "op"
Expand All @@ -300,5 +299,5 @@ more_itertools = "itx"
"snakebids.tests.strategies" = "sb_st"
"snakebids.utils.sb_itertools" = "sb_it"

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
1 change: 1 addition & 0 deletions scripts/update_bids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Recompile the bids function stub file based on latest specs."""

from __future__ import annotations

import inspect
Expand Down
1 change: 1 addition & 0 deletions snakebids/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
bidsapp.app([plugins.SnakemakeBidsApp(...)])
"""

from __future__ import annotations

import logging
Expand Down
6 changes: 2 additions & 4 deletions snakebids/core/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,10 @@ def __repr__(self) -> str:
return self.pformat()

@overload
def __getitem__(self, key: str, /) -> BidsComponentRow:
...
def __getitem__(self, key: str, /) -> BidsComponentRow: ...

@overload
def __getitem__(self, key: tuple[str, ...], /) -> BidsPartialComponent:
...
def __getitem__(self, key: tuple[str, ...], /) -> BidsPartialComponent: ...

def __getitem__(
self, key: str | tuple[str, ...], /
Expand Down
6 changes: 2 additions & 4 deletions snakebids/core/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def filter_list(
filters: Mapping[str, Iterable[str] | str],
return_indices_only: Literal[False] = ...,
regex_search: bool = ...,
) -> ZipList:
...
) -> ZipList: ...


@overload
Expand All @@ -27,8 +26,7 @@ def filter_list(
filters: Mapping[str, Iterable[str] | str],
return_indices_only: Literal[True],
regex_search: bool = ...,
) -> list[int]:
...
) -> list[int]: ...


def filter_list(
Expand Down
7 changes: 3 additions & 4 deletions snakebids/core/input_generation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for converting Snakemake apps to BIDS apps."""

from __future__ import annotations

import json
Expand Down Expand Up @@ -60,8 +61,7 @@ def generate_inputs(
validate: bool = ...,
pybids_database_dir: Path | str | None = ...,
pybids_reset_database: bool = ...,
) -> BidsDataset:
...
) -> BidsDataset: ...


@overload
Expand All @@ -80,8 +80,7 @@ def generate_inputs(
validate: bool = ...,
pybids_database_dir: Path | str | None = ...,
pybids_reset_database: bool = ...,
) -> BidsDatasetDict:
...
) -> BidsDatasetDict: ...


def generate_inputs(
Expand Down
1 change: 1 addition & 0 deletions snakebids/io/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

from __future__ import annotations

import functools as ft
Expand Down
2 changes: 1 addition & 1 deletion snakebids/jinja2_ext/toml_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def toml_string(item: str):
Technically encodes as json, a (mostly) strict subset of toml, with some encoding
fixes
"""
return json.dumps(item, ensure_ascii=False).replace("\x7F", "\\u007f")
return json.dumps(item, ensure_ascii=False).replace("\x7f", "\\u007f")


def toml_encode(item: str):
Expand Down
3 changes: 1 addition & 2 deletions snakebids/paths/_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def __call__(
suffix: str | None = None,
extension: str | None = None,
**entities: str | bool,
) -> str:
...
) -> str: ...


def _handle_subses_dir(
Expand Down
3 changes: 0 additions & 3 deletions snakebids/paths/specs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def v0_0_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
If False, downstream path generator will not include the session dir
`*/ses-{session}/*`
"""
...

def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""Spec corresponding to `BIDS v1.9.0`_.
Expand Down Expand Up @@ -67,7 +66,6 @@ def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
If False, downstream path generator will not include the session dir
`*/ses-{session}/*`
"""
...

def latest(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
"""Spec corresponding to `BIDS v1.9.0`_.
Expand Down Expand Up @@ -101,4 +99,3 @@ def latest(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec:
If False, downstream path generator will not include the session dir
`*/ses-{session}/*`
"""
...
6 changes: 2 additions & 4 deletions snakebids/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ class PluginBase:
PREFIX = ""

@overload
def pop(self, mapping: dict[str, Any], key: str, default: Any, /) -> Any:
...
def pop(self, mapping: dict[str, Any], key: str, default: Any, /) -> Any: ...

@overload
def pop(self, mapping: dict[str, Any], key: str, /) -> Any:
...
def pop(self, mapping: dict[str, Any], key: str, /) -> Any: ...

def pop(self, mapping: dict[str, Any], *args: Any):
"""Remove specified key from mapping, prepending the plugin prefix."""
Expand Down
6 changes: 3 additions & 3 deletions snakebids/plugins/pybidsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ def update_cli_namespace(self, namespace: dict[str, Any], config: dict[str, Any]
if config["pybidsdb_dir"] is not None
else None
)
config[
"pybids_db_reset"
] = f"{DEPRECATION_FLAG}{int(config['pybidsdb_reset'])}{DEPRECATION_FLAG}"
config["pybids_db_reset"] = (
f"{DEPRECATION_FLAG}{int(config['pybidsdb_reset'])}{DEPRECATION_FLAG}"
)
6 changes: 2 additions & 4 deletions snakebids/plugins/snakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@ def wrapper(self: SnakemakeBidsApp):


@overload
def _resolve_path(path_candidate: Sequence[Any]) -> list[Any]:
...
def _resolve_path(path_candidate: Sequence[Any]) -> list[Any]: ...


@overload
def _resolve_path(path_candidate: _T) -> _T:
...
def _resolve_path(path_candidate: _T) -> _T: ...


def _resolve_path(path_candidate: Any) -> Any:
Expand Down
1 change: 0 additions & 1 deletion snakebids/snakemake_compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def expand(
with their values as lists. If allow_missing=True is included
wildcards in filepattern without values will stay unformatted.
"""
...

class Namedlist[T](list[T | Iterable[T]]): ...

Expand Down
7 changes: 3 additions & 4 deletions snakebids/tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions and classes for tests"""

from __future__ import annotations

import functools as ft
Expand Down Expand Up @@ -339,16 +340,14 @@ def inner(func: Callable[_P, _T]) -> Callable[_P, _T]:
class Benchmark(Protocol):
def __call__(
self, func: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs
) -> _T:
...
) -> _T: ...


"""Comparison Dunders copied from typeshed"""


class SupportsDunderLT(Protocol[_T_contra]):
def __lt__(self, __other: _T_contra) -> bool:
...
def __lt__(self, __other: _T_contra) -> bool: ...


def is_strictly_increasing(items: Iterable[SupportsDunderLT[Any]]) -> bool:
Expand Down
6 changes: 2 additions & 4 deletions snakebids/tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,9 @@ def multiselect_dicts(

if TYPE_CHECKING:

def everything() -> st.SearchStrategy[Any]:
...
def everything() -> st.SearchStrategy[Any]: ...

def everything_except(*excluded_types: type[Any]) -> st.SearchStrategy[Any]:
...
def everything_except(*excluded_types: type[Any]) -> st.SearchStrategy[Any]: ...

else:

Expand Down
1 change: 1 addition & 0 deletions snakebids/tests/test_snakemake_io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for snakemake_io"""

from snakebids.utils import snakemake_io


Expand Down
12 changes: 4 additions & 8 deletions snakebids/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ def expand( # noqa: D102
/,
allow_missing: bool | str | Iterable[str] = False,
**wildcards: str | Iterable[str],
) -> list[str]:
...
) -> list[str]: ...

def filter( # noqa: D102
self,
*,
regex_search: bool | str | Iterable[str] = False,
**filters: str | Iterable[str],
) -> Self:
...
) -> Self: ...


_K_contra = TypeVar("_K_contra", bound="str", contravariant=True)
Expand All @@ -105,12 +103,10 @@ class MultiSelectable(Protocol, Generic[_K_contra, _V_co, _Valt_co]):
"""Mappings supporting selection with multiple keys."""

@overload
def __getitem__(self, key: _K_contra, /) -> _V_co:
...
def __getitem__(self, key: _K_contra, /) -> _V_co: ...

@overload
def __getitem__(self, key: tuple[_K_contra, ...], /) -> _Valt_co:
...
def __getitem__(self, key: tuple[_K_contra, ...], /) -> _Valt_co: ...


InputsConfig: TypeAlias = Dict[str, InputConfig]
Expand Down
12 changes: 4 additions & 8 deletions snakebids/utils/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ def __bool__(self) -> bool:
return bool(self._data)

@overload
def __getitem__(self, index: int) -> _T_co:
...
def __getitem__(self, index: int) -> _T_co: ...

@overload
def __getitem__(self, index: slice) -> Self:
...
def __getitem__(self, index: slice) -> Self: ...

@override
def __getitem__(self, index: int | slice) -> _T_co | Self:
Expand Down Expand Up @@ -241,12 +239,10 @@ class MultiSelectDict(UserDictPy38[_K, _T]):
"""

@overload
def __getitem__(self, key: _K, /) -> _T:
...
def __getitem__(self, key: _K, /) -> _T: ...

@overload
def __getitem__(self, key: tuple[_K, ...], /) -> Self:
...
def __getitem__(self, key: tuple[_K, ...], /) -> Self: ...

def __getitem__(self, key: _K | tuple[_K, ...], /) -> _T | Self:
if isinstance(key, tuple):
Expand Down
1 change: 1 addition & 0 deletions snakebids/utils/snakemake_io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File globbing functions based on snakemake.io library."""

from __future__ import annotations

import collections
Expand Down

0 comments on commit 39eee99

Please sign in to comment.