Skip to content

Commit d82df5c

Browse files
🧑‍💻 pre-commit autoupdate (#910)
* 🧑‍💻 pre-commit autoupdate updates: - [github.com/executablebooks/mdformat: 0.7.21 → 0.7.22](hukkin/mdformat@0.7.21...0.7.22) - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.4](astral-sh/ruff-pre-commit@v0.8.6...v0.9.4) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 📌 Update `ruff` dependency * 🔥 TIAToolbox does not support Python > 3.12 yet - There is no need for this check as this will be tested while upgrading to Python 3.13 * ♻️ Refactor `typing` to `type_hints`. * 🐛 Fix `mypy` workflow --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Shan E Ahmed Raza <[email protected]>
1 parent 8ff4f5e commit d82df5c

29 files changed

+42
-43
lines changed

.github/workflows/mypy-type-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
mypy --install-types --non-interactive --follow-imports=skip \
4141
tiatoolbox/__init__.py \
4242
tiatoolbox/__main__.py \
43-
tiatoolbox/typing.py \
43+
tiatoolbox/type_hints.py \
4444
tiatoolbox/tiatoolbox.py \
4545
tiatoolbox/utils \
4646
tiatoolbox/tools \

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
sudo apt update
3131
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
33-
python -m pip install ruff==0.8.2 pytest pytest-cov pytest-runner
33+
python -m pip install ruff==0.9.4 pytest pytest-cov pytest-runner
3434
pip install -r requirements/requirements.txt
3535
- name: Cache tiatoolbox static assets
3636
uses: actions/cache@v3

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- mdformat-black
2424
- mdformat-myst
2525
- repo: https://github.com/executablebooks/mdformat
26-
rev: 0.7.21
26+
rev: 0.7.22
2727
hooks:
2828
- id: mdformat
2929
# Optionally add plugins
@@ -60,7 +60,7 @@ repos:
6060
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst.
6161
- repo: https://github.com/astral-sh/ruff-pre-commit
6262
# Ruff version.
63-
rev: v0.8.6
63+
rev: v0.9.4
6464
hooks:
6565
- id: ruff
6666
args: [--fix, --exit-non-zero-on-fix]

pre-commit/notebook_urls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def check_notebook(
197197
for line_num, line in enumerate(cell["source"]):
198198
new_line = replace_line(line, to_ref, replacements)
199199
if new_line != line:
200-
print(f"{path.name}: Changed (cell {cell_num+1}, line {line_num+1})")
200+
print(
201+
f"{path.name}: Changed (cell {cell_num + 1}, line {line_num + 1})"
202+
)
201203
changed = True
202204
cell["source"][line_num] = new_line
203205
return changed, notebook

requirements/requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pytest>=7.2.0
1010
pytest-cov>=4.0.0
1111
pytest-runner>=6.0
1212
pytest-xdist[psutil]
13-
ruff==0.8.2 # This will be updated by pre-commit bot to latest version
13+
ruff==0.9.4 # This will be updated by pre-commit bot to latest version
1414
toml>=0.10.2
1515
twine>=4.0.1
1616
wheel>=0.37.1

tests/models/test_multi_task_segmentor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ def test_functionality_hovernetplus(remote_sample: Callable, tmp_path: Path) ->
128128

129129
assert len(inst_dict) > 0, "Must have some nuclei."
130130
assert layer_map is not None, "Must have some layers."
131-
assert (
132-
layer_map.shape == required_dims
133-
), "Output layer map dimensions must be same as the expected output shape"
131+
assert layer_map.shape == required_dims, (
132+
"Output layer map dimensions must be same as the expected output shape"
133+
)
134134

135135

136136
def test_functionality_hovernet(remote_sample: Callable, tmp_path: Path) -> None:

tests/test_annotation_stores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
if TYPE_CHECKING: # pragma: no cover
4141
from numbers import Number
4242

43-
from tiatoolbox.typing import Geometry
43+
from tiatoolbox.type_hints import Geometry
4444

4545

4646
sqlite3.enable_callback_tracebacks(True) # noqa: FBT003

tests/test_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def raise_source_exception(
141141
for n, line in enumerate(source.splitlines())
142142
]
143143
if source_offset:
144-
source_lines.insert(source_lineno, f"{' '*(source_offset+3)}^ {message}")
144+
source_lines.insert(source_lineno, f"{' ' * (source_offset + 3)}^ {message}")
145145
annotated_source = "\n".join(source_lines)
146146
exception = type(exception) if exception else SyntaxError
147147
msg = f"{rel_path}:{file_lineno}: {message}\n{annotated_source}"

tests/test_patch_extraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222

2323
if TYPE_CHECKING:
24-
from tiatoolbox.typing import IntPair, Resolution, Units
24+
from tiatoolbox.type_hints import IntPair, Resolution, Units
2525

2626

2727
def read_points_patches(

tests/test_tileserver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def test_change_overlay( # noqa: PLR0915
461461
assert response.status_code == 200
462462
assert response.content_type == "text/html; charset=utf-8"
463463
# check that the overlay has been correctly added
464-
lname = f"layer{len(empty_app.pyramids[session_id])-1}"
464+
lname = f"layer{len(empty_app.pyramids[session_id]) - 1}"
465465
layer = empty_app.pyramids[session_id][lname]
466466
assert layer.wsi.info.file_path == overlay_path
467467

@@ -493,7 +493,7 @@ def test_change_overlay( # noqa: PLR0915
493493
data={"overlay_path": safe_str(jpg_path)},
494494
)
495495
# check that the overlay has been correctly added
496-
lname = f"layer{len(empty_app.pyramids[session_id])-1}"
496+
lname = f"layer{len(empty_app.pyramids[session_id]) - 1}"
497497
layer = empty_app.pyramids[session_id][lname]
498498
assert np.all(layer.wsi.img == imread(jpg_path))
499499

@@ -517,7 +517,7 @@ def test_change_overlay( # noqa: PLR0915
517517
data={"overlay_path": safe_str(tiff_path)},
518518
)
519519
# check that the overlay has been correctly added
520-
lname = f"layer{len(empty_app.pyramids[session_id])-1}"
520+
lname = f"layer{len(empty_app.pyramids[session_id]) - 1}"
521521
layer = empty_app.pyramids[session_id][lname]
522522
assert layer.wsi.info.file_path == tiff_path
523523

0 commit comments

Comments
 (0)