Skip to content

Commit 741463c

Browse files
📌 Update ruff Version to v0.8.1 (#890)
- Update `ruff` Version to `v0.8.1` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9a62c10 commit 741463c

File tree

12 files changed

+41
-39
lines changed

12 files changed

+41
-39
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 libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
33-
python -m pip install ruff==0.7.4 pytest pytest-cov pytest-runner
33+
python -m pip install ruff==0.8.1 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.7.4
63+
rev: v0.8.1
6464
hooks:
6565
- id: ruff
6666
args: [--fix, --exit-non-zero-on-fix]

benchmarks/annotation_store.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
"from typing import TYPE_CHECKING, Any\n",
196196
"\n",
197197
"import numpy as np\n",
198-
"from IPython.display import display\n",
198+
"from IPython.display import display_svg\n",
199199
"from matplotlib import patheffects\n",
200200
"from matplotlib import pyplot as plt\n",
201201
"from shapely import affinity\n",
@@ -444,7 +444,7 @@
444444
],
445445
"source": [
446446
"for n in range(4):\n",
447-
" display(cell_polygon(xy=(0, 0), n_points=20, repeat_first=False, seed=n))"
447+
" display_svg(cell_polygon(xy=(0, 0), n_points=20, repeat_first=False, seed=n))"
448448
]
449449
},
450450
{

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

tiatoolbox/annotation/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
SQLiteStore,
99
)
1010

11-
__all__ = ["AnnotationStore", "SQLiteStore", "DictionaryStore", "Annotation"]
11+
__all__ = ["Annotation", "AnnotationStore", "DictionaryStore", "SQLiteStore"]

tiatoolbox/annotation/storage.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,11 +1371,13 @@ def bquery(
13711371
for key, annotation in self.items()
13721372
if (
13731373
query_geometry is None
1374-
or isinstance(query_geometry, (Polygon, Point, LineString))
1375-
and Polygon.from_bounds(*annotation.geometry.bounds).intersects(
1376-
Polygon.from_bounds(*query_geometry.bounds),
1374+
or (
1375+
isinstance(query_geometry, (Polygon, Point, LineString))
1376+
and Polygon.from_bounds(*annotation.geometry.bounds).intersects(
1377+
Polygon.from_bounds(*query_geometry.bounds),
1378+
)
1379+
and self._eval_where(where, annotation.properties)
13771380
)
1378-
and self._eval_where(where, annotation.properties)
13791381
)
13801382
}
13811383

tiatoolbox/models/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
)
2626

2727
__all__ = [
28+
"SCCNN",
2829
"HoVerNet",
2930
"HoVerNetPlus",
3031
"IDaRS",
3132
"MapDe",
3233
"MicroNet",
33-
"NuClick",
34-
"SCCNN",
3534
"MultiTaskSegmentor",
35+
"NuClick",
3636
"NucleusInstanceSegmentor",
3737
"PatchPredictor",
3838
"SemanticSegmentor",

tiatoolbox/models/architecture/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from tiatoolbox.models.models_abc import IOConfigABC
1919

2020

21-
__all__ = ["get_pretrained_model", "fetch_pretrained_weights"]
21+
__all__ = ["fetch_pretrained_weights", "get_pretrained_model"]
2222
PRETRAINED_INFO = rcParam["pretrained_model_info"]
2323

2424

tiatoolbox/utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
)
2121

2222
__all__ = [
23+
"download_data",
2324
"imread",
2425
"imwrite",
25-
"save_yaml",
2626
"save_as_json",
27-
"download_data",
27+
"save_yaml",
2828
"unzip_data",
2929
]

tiatoolbox/utils/visualization.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -914,26 +914,27 @@ def _set_mapper(
914914

915915
def __setattr__(
916916
self: AnnotationRenderer,
917-
__name: str,
918-
__value: str | list | dict | None,
917+
name: str,
918+
value: str | list | dict | None,
919+
/,
919920
) -> None:
920921
"""Set attribute each time an attribute is set."""
921-
if __name == "mapper":
922+
if name == "mapper":
922923
# save a more readable version of the mapper too
923-
_ = self._set_mapper(__value)
924+
_ = self._set_mapper(value)
924925
return
925-
if __name == "blur_radius" and isinstance(__value, int):
926+
if name == "blur_radius" and isinstance(value, int):
926927
# need to change additional settings
927-
if __value > 0:
928-
self.__dict__["blur"] = ImageFilter.GaussianBlur(__value)
928+
if value > 0:
929+
self.__dict__["blur"] = ImageFilter.GaussianBlur(value)
929930
self.__dict__["edge_thickness"] = 0
930931
else:
931932
self.__dict__["blur"] = None
932933
self.__dict__["edge_thickness"] = self.__dict__["edge_thickness_old"]
933-
elif __name == "edge_thickness":
934-
self.__dict__["edge_thickness_old"] = __value
934+
elif name == "edge_thickness":
935+
self.__dict__["edge_thickness_old"] = value
935936

936-
self.__dict__[__name] = __value
937+
self.__dict__[name] = value
937938

938939
def render_annotations(
939940
self: AnnotationRenderer,

0 commit comments

Comments
 (0)