Skip to content

Commit 64e4a65

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b9b462e commit 64e4a65

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

Diff for: pre-commit/notebook_urls.py

+3-1
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

Diff for: tests/models/test_multi_task_segmentor.py

+3-3
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:

Diff for: tests/test_docs.py

+1-1
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}"

Diff for: tests/test_tileserver.py

+3-3
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

Diff for: tiatoolbox/models/architecture/hovernet.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ def __init__(
338338

339339
if mode not in ["original", "fast"]:
340340
msg = (
341-
f"Invalid mode {mode} for HoVerNet. "
342-
f"Only support `original` or `fast`."
341+
f"Invalid mode {mode} for HoVerNet. Only support `original` or `fast`."
343342
)
344343
raise ValueError(
345344
msg,

Diff for: tiatoolbox/utils/misc.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ def load_stain_matrix(stain_matrix_input: np.ndarray | PathLike) -> np.ndarray:
220220
_, __, suffixes = split_path_name_ext(stain_matrix_input)
221221
if suffixes[-1] not in [".csv", ".npy"]:
222222
msg = (
223-
"If supplying a path to a stain matrix, "
224-
"use either a npy or a csv file"
223+
"If supplying a path to a stain matrix, use either a npy or a csv file"
225224
)
226225
raise FileNotSupportedError(
227226
msg,

Diff for: tiatoolbox/visualization/bokeh_app/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ def segment_on_box() -> None:
12041204
# Make a mask defining the box
12051205
thumb = UI["vstate"].wsi.slide_thumbnail()
12061206
conv_mpp = UI["vstate"].dims[0] / thumb.shape[1]
1207-
msg = f'box tl: {UI["box_source"].data["x"][0]}, {UI["box_source"].data["y"][0]}'
1207+
msg = f"box tl: {UI['box_source'].data['x'][0]}, {UI['box_source'].data['y'][0]}"
12081208
logger.info(msg)
12091209
x = round(
12101210
(UI["box_source"].data["x"][0] - 0.5 * UI["box_source"].data["width"][0])

Diff for: tiatoolbox/visualization/tileserver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __init__( # noqa: PLR0915
102102
if isinstance(layers, list):
103103
layers_dict = {"slide": layers[0]}
104104
for i, p in enumerate(layers[1:]):
105-
layers_dict[f"layer-{i+1}"] = p
105+
layers_dict[f"layer-{i + 1}"] = p
106106
layers = layers_dict
107107
# Set up the layer dict.
108108
meta = None

0 commit comments

Comments
 (0)