Skip to content

Commit cc2f801

Browse files
committed
🎨 Apply ruff fixes
1 parent 6d20d4d commit cc2f801

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

tests/test_wsireader.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,29 +1900,29 @@ def test_command_line_jp2_read_bounds(sample_jp2: Path, tmp_path: Path) -> None:
19001900
assert Path(tmp_path).joinpath("../im_region.jpg").is_file()
19011901

19021902

1903-
# @pytest.mark.skipif(
1904-
# utils.env_detection.running_on_ci(),
1905-
# reason="No need to display image on travis.",
1906-
# )
1907-
# def test_command_line_jp2_read_bounds_show(sample_jp2: Path) -> None:
1908-
# """Test JP2 read_bounds with mode as 'show'."""
1909-
# runner = CliRunner()
1910-
# read_bounds_result = runner.invoke(
1911-
# cli.main,
1912-
# [
1913-
# "read-bounds",
1914-
# "--img-input",
1915-
# str(Path(sample_jp2)),
1916-
# "--resolution",
1917-
# "0",
1918-
# "--units",
1919-
# "level",
1920-
# "--mode",
1921-
# "show",
1922-
# ],
1923-
# )
1924-
#
1925-
# assert read_bounds_result.exit_code == 0
1903+
@pytest.mark.skipif(
1904+
utils.env_detection.running_on_ci(),
1905+
reason="No need to display image on travis.",
1906+
)
1907+
def test_command_line_jp2_read_bounds_show(sample_jp2: Path) -> None:
1908+
"""Test JP2 read_bounds with mode as 'show'."""
1909+
runner = CliRunner()
1910+
read_bounds_result = runner.invoke(
1911+
cli.main,
1912+
[
1913+
"read-bounds",
1914+
"--img-input",
1915+
str(Path(sample_jp2)),
1916+
"--resolution",
1917+
"0",
1918+
"--units",
1919+
"level",
1920+
"--mode",
1921+
"show",
1922+
],
1923+
)
1924+
1925+
assert read_bounds_result.exit_code == 0
19261926

19271927

19281928
def test_command_line_unsupported_file_read_bounds(sample_svs: Path) -> None:

tiatoolbox/type_hints.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33
from __future__ import annotations
44

55
from collections.abc import Callable, Sequence
6-
from typing import Literal, SupportsFloat, Union
6+
from typing import Literal, SupportsFloat
77

88
import numpy as np
99
from shapely.geometry import LineString, Point, Polygon # type: ignore[import-untyped]
1010

1111
# Proper type annotations for shapely is not yet available.
1212

1313

14-
JSON = Union[dict[str, "JSON"], list["JSON"], str, int, float, bool, None]
14+
JSON = dict[str, "JSON"] | list["JSON"] | str | int | float | bool | None
1515
NumPair = tuple[SupportsFloat, SupportsFloat]
1616
IntPair = tuple[int, int]
1717

1818
# WSIReader
19-
Resolution = Union[SupportsFloat, NumPair, np.ndarray, Sequence[SupportsFloat]]
19+
Resolution = SupportsFloat | NumPair | np.ndarray | Sequence[SupportsFloat]
2020
Units = Literal["mpp", "power", "baseline", "level"]
2121
Bounds = tuple[SupportsFloat, SupportsFloat, SupportsFloat, SupportsFloat]
2222
IntBounds = tuple[int, int, int, int]
2323

2424
# Annotation Store
25-
Geometry = Union[Point, LineString, Polygon]
25+
Geometry = Point | LineString | Polygon
2626
Properties = JSON # Could define this using a TypedDict
27-
QueryGeometry = Union[Bounds, Geometry]
27+
QueryGeometry = Bounds | Geometry
2828
CallablePredicate = Callable[[Properties], bool]
2929
CallableSelect = Callable[[Properties], Properties]
30-
Predicate = Union[str, bytes, CallablePredicate]
31-
Select = Union[str, bytes, CallableSelect]
30+
Predicate = str | bytes | CallablePredicate
31+
Select = str | bytes | CallableSelect
3232
NumpyPadLiteral = Literal[
3333
"constant",
3434
"edge",

0 commit comments

Comments
 (0)