From 674201ca032f55f6a671999935fee589663b16c6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:46:53 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_annotation_tilerendering.py | 2 +- tests/test_utils.py | 10 ++-- tiatoolbox/visualization/bokeh_app/main.py | 54 +++++++++++----------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/test_annotation_tilerendering.py b/tests/test_annotation_tilerendering.py index 0ee34b17b..7acdcdfe9 100644 --- a/tests/test_annotation_tilerendering.py +++ b/tests/test_annotation_tilerendering.py @@ -271,7 +271,7 @@ def sub_tile_level_count(self: MockTileGenerator) -> int: def test_unknown_geometry( - fill_store: Callable, # noqa: ARG001 + fill_store: Callable, caplog: pytest.LogCaptureFixture, ) -> None: """Test warning when unknown geometries cannot be rendered.""" diff --git a/tests/test_utils.py b/tests/test_utils.py index 95e6ee520..a5c357740 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -578,9 +578,9 @@ def test_sub_pixel_read_bad_read_func() -> None: bounds = (0, 0, 8, 8) def bad_read_func( - img: np.ndarray, # noqa: ARG001 - bounds: IntBounds, # noqa: ARG001 - *kwargs: dict, # noqa: ARG001 + img: np.ndarray, + bounds: IntBounds, + *kwargs: dict, ) -> None: """Dummy function for a failing test.""" return @@ -740,7 +740,7 @@ def test_sub_pixel_read_incorrect_read_func_return() -> None: bounds = (0, 0, 8, 8) image = np.ones((10, 10)) - def read_func(*args: tuple, **kwargs: dict) -> np.ndarray: # noqa: ARG001 + def read_func(*args: tuple, **kwargs: dict) -> np.ndarray: """Dummy read function for tests.""" return np.ones((5, 5)) @@ -759,7 +759,7 @@ def test_sub_pixel_read_empty_read_func_return() -> None: bounds = (0, 0, 8, 8) image = np.ones((10, 10)) - def read_func(*args: tuple, **kwargs: dict) -> np.ndarray: # noqa: ARG001 + def read_func(*args: tuple, **kwargs: dict) -> np.ndarray: """Dummy read function for tests.""" return np.ones((0, 0)) diff --git a/tiatoolbox/visualization/bokeh_app/main.py b/tiatoolbox/visualization/bokeh_app/main.py index 140c3dce6..3bb422c72 100644 --- a/tiatoolbox/visualization/bokeh_app/main.py +++ b/tiatoolbox/visualization/bokeh_app/main.py @@ -854,7 +854,7 @@ def __setattr__( # Define UI callbacks # region -def res_switch_cb(attr: str, old: int, new: int) -> None: # noqa: ARG001 +def res_switch_cb(attr: str, old: int, new: int) -> None: """Callback to switch between resolutions.""" if new == 0: UI["vstate"].res = 1 @@ -864,7 +864,7 @@ def res_switch_cb(attr: str, old: int, new: int) -> None: # noqa: ARG001 UI["vstate"].to_update.update(["overlay", "slide"]) -def slide_toggle_cb(attr: str) -> None: # noqa: ARG001 +def slide_toggle_cb(attr: str) -> None: """Callback to toggle the slide on/off.""" if UI["p"].renderers[0].alpha == 0: UI["p"].renderers[0].alpha = UI["slide_alpha"].value @@ -877,7 +877,7 @@ def node_select_cb(attr: str, old: int, new: int) -> None: # Do something on node select if desired -def overlay_toggle_cb(attr: str) -> None: # noqa: ARG001 +def overlay_toggle_cb(attr: str) -> None: """Callback to toggle the overlay on/off.""" for i in range(5, len(UI["p"].renderers)): if UI["p"].renderers[i].alpha == 0: @@ -935,14 +935,14 @@ def populate_slide_list(slide_folder: Path, search_txt: str | None = None) -> No UI["slide_select"].options = file_list -def filter_input_cb(attr: str, old: str, new: str) -> None: # noqa: ARG001 # skipcq: PYL-W0613 +def filter_input_cb(attr: str, old: str, new: str) -> None: # skipcq: PYL-W0613 """Change predicate to be used to filter annotations.""" build_predicate() UI["vstate"].update_state = 1 UI["vstate"].to_update.update(["overlay"]) -def cprop_input_cb(attr: str, old: str, new: list[str]) -> None: # noqa: ARG001 # skipcq: PYL-W0613 +def cprop_input_cb(attr: str, old: str, new: list[str]) -> None: # skipcq: PYL-W0613 """Change property to color by.""" if len(new) == 0: return @@ -957,30 +957,30 @@ def cprop_input_cb(attr: str, old: str, new: list[str]) -> None: # noqa: ARG001 UI["vstate"].to_update.update(["overlay"]) -def slide_alpha_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 +def slide_alpha_cb(attr: str, old: float, new: float) -> None: """Callback to change the alpha of the slide.""" UI["p"].renderers[0].alpha = new -def overlay_alpha_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 +def overlay_alpha_cb(attr: str, old: float, new: float) -> None: """Callback to change the alpha of all overlay layers.""" for i in range(5, len(UI["p"].renderers)): UI["p"].renderers[i].alpha = new -def pt_size_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 +def pt_size_cb(attr: str, old: float, new: float) -> None: """Callback to change the size of the points.""" UI["vstate"].graph_node.radius = 2 * new -def edge_size_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 +def edge_size_cb(attr: str, old: float, new: float) -> None: """Callback to change the size of the edges.""" update_renderer("edge_thickness", new) UI["vstate"].update_state = 1 UI["vstate"].to_update.update(["overlay"]) -def opt_buttons_cb(attr: str, old: list[int], new: list[int]) -> None: # noqa: ARG001 +def opt_buttons_cb(attr: str, old: list[int], new: list[int]) -> None: """Callback to handle options changes in the ui widget.""" old_thickness = UI["vstate"].thickness if FILLED in new: @@ -1008,7 +1008,7 @@ def opt_buttons_cb(attr: str, old: list[int], new: list[int]) -> None: # noqa: UI["p"].xgrid.grid_line_alpha = 0 -def cmap_select_cb(attr: str, old: str, new: str) -> None: # noqa: ARG001 +def cmap_select_cb(attr: str, old: str, new: str) -> None: """Callback to change the color map.""" if not (UI["vstate"].is_categorical and new != "dict"): update_renderer("mapper", new) @@ -1016,14 +1016,14 @@ def cmap_select_cb(attr: str, old: str, new: str) -> None: # noqa: ARG001 UI["vstate"].to_update.update(["overlay"]) -def blur_spinner_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 +def blur_spinner_cb(attr: str, old: float, new: float) -> None: """Callback to change the blur radius.""" update_renderer("blur_radius", new) UI["vstate"].update_state = 1 UI["vstate"].to_update.update(["overlay"]) -def scale_spinner_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 +def scale_spinner_cb(attr: str, old: float, new: float) -> None: """Callback to change the max scale. This defines a scale above which small annotations are @@ -1035,7 +1035,7 @@ def scale_spinner_cb(attr: str, old: float, new: float) -> None: # noqa: ARG001 UI["vstate"].to_update.update(["overlay"]) -def slide_select_cb(attr: str, old: str, new: str) -> None: # noqa: ARG001 +def slide_select_cb(attr: str, old: str, new: str) -> None: """Set up the newly chosen slide.""" if len(new) == 0: return @@ -1200,14 +1200,14 @@ def layer_drop_cb(attr: MenuItemClick) -> None: change_tiles(resp) -def layer_select_cb(attr: ButtonClick) -> None: # noqa: ARG001 +def layer_select_cb(attr: ButtonClick) -> None: """Callback to handle toggling specific annotation types on and off.""" build_predicate() UI["vstate"].update_state = 1 UI["vstate"].to_update.update(["overlay"]) -def fixed_layer_select_cb(obj: Button, attr: ButtonClick) -> None: # noqa: ARG001 +def fixed_layer_select_cb(obj: Button, attr: ButtonClick) -> None: """Callback to handle toggling non-annotation layers on and off.""" key = UI["vstate"].layer_dict[obj.label] if obj.label == "edges": @@ -1231,8 +1231,8 @@ def fixed_layer_select_cb(obj: Button, attr: ButtonClick) -> None: # noqa: ARG0 def layer_slider_cb( obj: Slider, - attr: str, # noqa: ARG001 - old: float, # noqa: ARG001 + attr: str, + old: float, new: float, ) -> None: """Callback to handle changing the alpha of a layer.""" @@ -1251,8 +1251,8 @@ def layer_slider_cb( def color_input_cb( obj: ColorPicker, - attr: str, # noqa: ARG001 - old: str, # noqa: ARG001 + attr: str, + old: str, new: str, ) -> None: """Callback to handle changing the color of an annotation type.""" @@ -1283,12 +1283,12 @@ def wrapped(attr: ButtonClick) -> None: return wrapped -def model_drop_cb(attr: str, old: str, new: str) -> None: # noqa: ARG001 +def model_drop_cb(attr: str, old: str, new: str) -> None: """Callback to handle model selection.""" UI["vstate"].current_model = new -def to_model_cb(attr: ButtonClick) -> None: # noqa: ARG001 +def to_model_cb(attr: ButtonClick) -> None: """Callback to run currently selected model.""" if UI["vstate"].current_model == "hovernet": segment_on_box() @@ -1297,7 +1297,7 @@ def to_model_cb(attr: ButtonClick) -> None: # noqa: ARG001 logger.warning("unknown model") -def type_cmap_cb(attr: str, old: list[str], new: list[str]) -> None: # noqa: ARG001 +def type_cmap_cb(attr: str, old: list[str], new: list[str]) -> None: """Callback to handle changing a type-specific color property.""" if len(new) == 0: # Remove type-specific coloring @@ -1362,7 +1362,7 @@ def type_cmap_cb(attr: str, old: list[str], new: list[str]) -> None: # noqa: AR UI["vstate"].to_update.update(["overlay"]) -def save_cb(attr: ButtonClick) -> None: # noqa: ARG001 +def save_cb(attr: ButtonClick) -> None: """Callback to handle saving annotations.""" save_path = make_safe_name( str( @@ -2132,7 +2132,7 @@ def update() -> None: UI["vstate"].update_state = DO_UPDATE -def control_tabs_cb(attr: str, old: int, new: int) -> None: # noqa: ARG001 +def control_tabs_cb(attr: str, old: int, new: int) -> None: """Callback to handle selecting active window.""" if new == 1 and len(slide_wins.children) == 1: # Make new window @@ -2154,8 +2154,8 @@ def control_tabs_cb(attr: str, old: int, new: int) -> None: # noqa: ARG001 def control_tabs_remove_cb( - attr: str, # noqa: ARG001 - old: list[int], # noqa: ARG001 + attr: str, + old: list[int], new: list[int], ) -> None: """Callback to handle removing a window."""