diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b471ede7f..25da8cc1d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -30,7 +30,7 @@ jobs: sudo apt update sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools python -m pip install --upgrade pip - python -m pip install ruff==0.5.2 pytest pytest-cov pytest-runner + python -m pip install ruff==0.5.6 "pytest<8.3.0" pytest-cov pytest-runner pip install -r requirements/requirements.txt - name: Cache tiatoolbox static assets uses: actions/cache@v3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 02b44aa70..b61806ec7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,7 +60,7 @@ repos: - id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst. - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.5.2 + rev: v0.5.6 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index 264af30d1..065adcbb9 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -7,11 +7,11 @@ mypy>=1.6.1 pip>=22.3 poetry-bumpversion>=0.3.1 pre-commit>=2.20.0 -pytest>=7.2.0 +pytest>=7.2.0, <8.3.0 pytest-cov>=4.0.0 pytest-runner>=6.0 pytest-xdist[psutil] -ruff==0.5.2 # This will be updated by pre-commit bot to latest version +ruff==0.5.6 # This will be updated by pre-commit bot to latest version toml>=0.10.2 twine>=4.0.1 wheel>=0.37.1 diff --git a/tiatoolbox/annotation/storage.py b/tiatoolbox/annotation/storage.py index fcde17510..8ce05566d 100644 --- a/tiatoolbox/annotation/storage.py +++ b/tiatoolbox/annotation/storage.py @@ -2826,7 +2826,7 @@ def _initialize_query_string_parameters( return query_string, query_parameters - def _query( # noqa: PLR0913 + def _query( self: SQLiteStore, columns: str, geometry: Geometry | None = None, diff --git a/tiatoolbox/models/dataset/classification.py b/tiatoolbox/models/dataset/classification.py index 66dbe36d1..cd17dab7e 100644 --- a/tiatoolbox/models/dataset/classification.py +++ b/tiatoolbox/models/dataset/classification.py @@ -163,7 +163,7 @@ class WSIPatchDataset(dataset_abc.PatchDatasetABC): """ - def __init__( # skipcq: PY-R1000 # noqa: PLR0913, PLR0915 + def __init__( # skipcq: PY-R1000 # noqa: PLR0915 self: WSIPatchDataset, img_path: str | Path, mode: str = "wsi", diff --git a/tiatoolbox/models/engine/multi_task_segmentor.py b/tiatoolbox/models/engine/multi_task_segmentor.py index 93864fcc3..c0e5ff337 100644 --- a/tiatoolbox/models/engine/multi_task_segmentor.py +++ b/tiatoolbox/models/engine/multi_task_segmentor.py @@ -243,7 +243,7 @@ class MultiTaskSegmentor(NucleusInstanceSegmentor): """ - def __init__( # noqa: PLR0913 + def __init__( self: MultiTaskSegmentor, batch_size: int = 8, num_loader_workers: int = 0, diff --git a/tiatoolbox/tools/patchextraction.py b/tiatoolbox/tools/patchextraction.py index 0516e134c..052a9f80b 100644 --- a/tiatoolbox/tools/patchextraction.py +++ b/tiatoolbox/tools/patchextraction.py @@ -625,7 +625,7 @@ class SlidingWindowPatchExtractor(PatchExtractor): """ - def __init__( # noqa: PLR0913 + def __init__( self: SlidingWindowPatchExtractor, input_img: str | Path | np.ndarray, patch_size: int | tuple[int, int], diff --git a/tiatoolbox/utils/misc.py b/tiatoolbox/utils/misc.py index 775ff2476..7239f0a8c 100644 --- a/tiatoolbox/utils/misc.py +++ b/tiatoolbox/utils/misc.py @@ -1190,9 +1190,7 @@ def add_from_dat( anns = [] for subcat in data: if ( - subcat == "resolution" - or subcat == "proc_dimensions" - or subcat == "base_dimensions" + subcat in {"resolution", "proc_dimensions", "base_dimensions"} or "resolution" in subcat ): continue diff --git a/tiatoolbox/wsicore/wsimeta.py b/tiatoolbox/wsicore/wsimeta.py index 4a7ad0d9b..0870e4fe1 100644 --- a/tiatoolbox/wsicore/wsimeta.py +++ b/tiatoolbox/wsicore/wsimeta.py @@ -96,7 +96,7 @@ class WSIMeta: _valid_axes_characters = "YXSTZ" - def __init__( # noqa: PLR0913 + def __init__( self: WSIMeta, slide_dimensions: tuple[int, int], axes: str,