Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#838)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.2 → v0.5.6](astral-sh/ruff-pre-commit@v0.5.2...v0.5.6)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* 📌 Update `ruff`

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>

* 🐛 Fix PLR1714 Consider merging multiple comparisons.

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>

* fix mypy error

* ignore mypy bug

* 🐛 Add logger info to debug error

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>

* 📌 Pin pytest version

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>

* 📌 Pin pytest version

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>

* 🔥 Remove logger

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>

---------

Signed-off-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Co-authored-by: Jiaqi Lv <lvjiaqi9@gmail.com>
  • Loading branch information
3 people authored Aug 9, 2024
1 parent 964c846 commit aed63b6
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tiatoolbox/annotation/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1841,10 +1841,10 @@ def _dump_cases(
# It is a file-like object, write to it
if hasattr(fp, "write"):
file_handle = cast(IO, fp)
return file_fn(file_handle)
return file_fn(file_handle) # type: ignore[func-returns-value]
# Turn a path into a file handle, then write to it
with Path(fp).open("w", encoding="utf-8") as file_handle:
return file_fn(file_handle)
return file_fn(file_handle) # type: ignore[func-returns-value]
# Return as str or bytes if no handle/path is given
return none_fn()

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tiatoolbox/models/dataset/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tiatoolbox/models/engine/multi_task_segmentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class MultiTaskSegmentor(NucleusInstanceSegmentor):
"""

def __init__( # noqa: PLR0913
def __init__(
self: MultiTaskSegmentor,
batch_size: int = 8,
num_loader_workers: int = 0,
Expand Down
2 changes: 1 addition & 1 deletion tiatoolbox/tools/patchextraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ class SlidingWindowPatchExtractor(PatchExtractor):
"""

def __init__( # noqa: PLR0913
def __init__(
self: SlidingWindowPatchExtractor,
input_img: str | Path | np.ndarray,
patch_size: int | tuple[int, int],
Expand Down
4 changes: 1 addition & 3 deletions tiatoolbox/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tiatoolbox/wsicore/wsimeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit aed63b6

Please sign in to comment.