Skip to content

Commit e3c0cc9

Browse files
🧑‍💻 pre-commit autoupdate (#957)
* 🧑‍💻 pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.11 → v0.13.3](astral-sh/ruff-pre-commit@v0.12.11...v0.13.3) * 📌 Update `ruff` version to 0.13.3 * 🐛 Fix `RUF059` Unpacked variable `fig` is never used * 🐛 Use a raw string or `re.escape()` to make the intention explicit * 🐛 Use a raw string or `re.escape()` to make the intention explicit * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 🐛 Use a raw string or `re.escape()` to make the intention explicit --------- 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 5bb255b commit e3c0cc9

13 files changed

+28
-28
lines changed

.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 libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
33-
python -m pip install ruff==0.12.11 pytest pytest-cov pytest-runner
33+
python -m pip install ruff==0.13.3 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.12.11
63+
rev: v0.13.3
6464
hooks:
6565
- id: ruff
6666
args: [--fix, --exit-non-zero-on-fix]

examples/04-patch-extraction.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@
762762
},
763763
{
764764
"cell_type": "code",
765-
"execution_count": 16,
765+
"execution_count": null,
766766
"metadata": {
767767
"colab": {
768768
"base_uri": "https://localhost:8080/",
@@ -793,7 +793,7 @@
793793
"source": [
794794
"def plot_mask_and_locs(thumb: np.ndarray, mask: np.ndarray, locs: dict) -> None:\n",
795795
" \"\"\"Plots slide thumbnail, mask and patch locations side by side.\"\"\"\n",
796-
" fig, axs = plt.subplots(1, 3)\n",
796+
" _, axs = plt.subplots(1, 3)\n",
797797
" for ax in axs:\n",
798798
" ax.set(xticks=[], yticks=[])\n",
799799
"\n",

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.12.11 # This will be updated by pre-commit bot to latest version
13+
ruff==0.13.3 # 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_patch_predictor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
147147
],
148148
dtype=object,
149149
)
150-
with pytest.raises(ValueError, match="Provided input array is non-numerical."):
150+
with pytest.raises(ValueError, match=r"Provided input array is non-numerical."):
151151
_ = PatchDataset(imgs)
152152

153153
# ndarray(s) of NHW images
@@ -160,7 +160,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
160160
RNG.integers(0, 255, (4, 4, 3)),
161161
RNG.integers(0, 255, (4, 5, 3)),
162162
]
163-
with pytest.raises(ValueError, match="Images must have the same dimensions."):
163+
with pytest.raises(ValueError, match=r"Images must have the same dimensions."):
164164
_ = PatchDataset(imgs)
165165

166166
# list of ndarray(s) with HW and HWC mixed up
@@ -170,15 +170,15 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
170170
]
171171
with pytest.raises(
172172
ValueError,
173-
match="Each sample must be an array of the form HWC.",
173+
match=r"Each sample must be an array of the form HWC.",
174174
):
175175
_ = PatchDataset(imgs)
176176

177177
# list of mixed dtype
178178
imgs = [RNG.integers(0, 255, (4, 4, 3)), "you_should_crash_here", 123, 456]
179179
with pytest.raises(
180180
ValueError,
181-
match="Input must be either a list/array of images or a list of "
181+
match=r"Input must be either a list/array of images or a list of "
182182
"valid image paths.",
183183
):
184184
_ = PatchDataset(imgs)
@@ -187,7 +187,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
187187
imgs = ["you_should_crash_here", 123, 456]
188188
with pytest.raises(
189189
ValueError,
190-
match="Input must be either a list/array of images or a list of "
190+
match=r"Input must be either a list/array of images or a list of "
191191
"valid image paths.",
192192
):
193193
_ = PatchDataset(imgs)
@@ -290,11 +290,11 @@ def __getitem__(self: Proto, idx: int) -> object:
290290
)
291291

292292
# invalid mode
293-
with pytest.raises(ValueError, match="`X` is not supported."):
293+
with pytest.raises(ValueError, match=r"`X` is not supported."):
294294
reuse_init(mode="X")
295295

296296
# invalid patch
297-
with pytest.raises(ValueError, match="Invalid `patch_input_shape` value None."):
297+
with pytest.raises(ValueError, match=r"Invalid `patch_input_shape` value None."):
298298
reuse_init()
299299
with pytest.raises(
300300
ValueError,
@@ -306,7 +306,7 @@ def __getitem__(self: Proto, idx: int) -> object:
306306
match=r"Invalid `patch_input_shape` value \['512' 'a'\].",
307307
):
308308
reuse_init_wsi(patch_input_shape=[512, "a"])
309-
with pytest.raises(ValueError, match="Invalid `stride_shape` value None."):
309+
with pytest.raises(ValueError, match=r"Invalid `stride_shape` value None."):
310310
reuse_init_wsi(patch_input_shape=512)
311311
# invalid stride
312312
with pytest.raises(

tests/test_annotation_stores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def test_sqlite_store_index_version_error(monkeypatch: object) -> None:
569569
"""Test adding an index with SQlite <3.9."""
570570
store = SQLiteStore()
571571
monkeypatch.setattr(sqlite3, "sqlite_version_info", (3, 8, 0))
572-
with pytest.raises(EnvironmentError, match="Requires sqlite version 3.9.0"):
572+
with pytest.raises(EnvironmentError, match=r"Requires sqlite version 3.9.0"):
573573
store.create_index("foo", lambda _, p: "foo" in p)
574574

575575

tests/test_dsl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def test_has_key_exception(
467467
"""Test has_key function with exception."""
468468
eval_globals, eval_locals, _ = extract_variables(scenario_variables)
469469
query = "has_key(1, 'a')"
470-
with pytest.raises(TypeError, match="(not iterable)|(Unsupported type)"):
470+
with pytest.raises(TypeError, match=r"(not iterable)|(Unsupported type)"):
471471
_ = eval( # skipcq: PYL-W0123
472472
query,
473473
eval_globals,

tests/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ def test_exception_tests() -> None:
1313

1414
with pytest.raises(
1515
ValueError,
16-
match="`stain_matrix` is only defined when using.*custom",
16+
match=r"`stain_matrix` is only defined when using.*custom",
1717
):
1818
get_normalizer(method_name="reinhard", stain_matrix="[1, 2]")

tests/test_patch_extraction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def test_filter_coordinates() -> None:
470470
# Test for bad mask input
471471
with pytest.raises(
472472
TypeError,
473-
match="`mask_reader` should be wsireader.VirtualWSIReader.",
473+
match=r"`mask_reader` should be wsireader.VirtualWSIReader.",
474474
):
475475
PatchExtractor.filter_coordinates(
476476
mask,
@@ -495,14 +495,14 @@ def test_filter_coordinates() -> None:
495495
)
496496

497497
# Test for put of range min_mask_ratio
498-
with pytest.raises(ValueError, match="`min_mask_ratio` must be between 0 and 1."):
498+
with pytest.raises(ValueError, match=r"`min_mask_ratio` must be between 0 and 1."):
499499
PatchExtractor.filter_coordinates(
500500
mask_reader,
501501
bbox_list,
502502
slide_shape,
503503
min_mask_ratio=-0.5,
504504
)
505-
with pytest.raises(ValueError, match="`min_mask_ratio` must be between 0 and 1."):
505+
with pytest.raises(ValueError, match=r"`min_mask_ratio` must be between 0 and 1."):
506506
PatchExtractor.filter_coordinates(
507507
mask_reader,
508508
bbox_list,

tests/test_tileserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ def test_no_ann_layer(empty_app: TileServer, remote_sample: Callable) -> None:
701701
"/tileserver/slide",
702702
data={"slide_path": safe_str(remote_sample("svs-1-small"))},
703703
)
704-
with pytest.raises(ValueError, match="No annotation layer found."):
704+
with pytest.raises(ValueError, match=r"No annotation layer found."):
705705
client.get("/tileserver/prop_names/all")
706706

707707

0 commit comments

Comments
 (0)