From 62eac66754a3f0db91fdb8c7ccd081a263d9f529 Mon Sep 17 00:00:00 2001 From: jirka Date: Tue, 13 Jan 2026 09:41:26 +0100 Subject: [PATCH 1/2] Replace yesqa hook from pre-commit configuration with Ruff's RUF100 Signed-off-by: jirka --- .pre-commit-config.yaml | 17 ----------------- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db2d0f7534..16a06059a3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,23 +37,6 @@ repos: ^monai/_version.py ) - - repo: https://github.com/asottile/yesqa - rev: v1.5.0 - hooks: - - id: yesqa - name: Unused noqa - additional_dependencies: - - flake8>=3.8.1 - - flake8-bugbear<=24.2.6 - - flake8-comprehensions - - pep8-naming - exclude: | - (?x)^( - monai/__init__.py| - docs/source/conf.py| - tests/utils.py - )$ - - repo: https://github.com/hadialqattan/pycln rev: v2.5.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index f9fab1141a..b23e1de95a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ select = [ "E", "F", "W", # flake8 "NPY", # NumPy specific rules "UP", # pyupgrade - # "RUF100", # aka yesqa + "RUF100", # aka yesqa ] extend-ignore = [ "E741", # ambiguous variable name From c04bb146b4180f723e942a2dd88d727181a90e68 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 08:42:50 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- monai/apps/nnunet/nnunetv2_runner.py | 4 ++-- monai/utils/profiling.py | 2 +- tests/runner.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monai/apps/nnunet/nnunetv2_runner.py b/monai/apps/nnunet/nnunetv2_runner.py index 8a10849904..e2f2262793 100644 --- a/monai/apps/nnunet/nnunetv2_runner.py +++ b/monai/apps/nnunet/nnunetv2_runner.py @@ -18,7 +18,7 @@ from typing import Any import monai -from monai.apps.nnunet.utils import NNUNETMode as M # noqa: N814 +from monai.apps.nnunet.utils import NNUNETMode as M from monai.apps.nnunet.utils import analyze_data, create_new_data_copy, create_new_dataset_json from monai.bundle import ConfigParser from monai.utils import ensure_tuple, optional_import @@ -34,7 +34,7 @@ __all__ = ["nnUNetV2Runner"] -class nnUNetV2Runner: # noqa: N801 +class nnUNetV2Runner: """ ``nnUNetV2Runner`` provides an interface in MONAI to use `nnU-Net` V2 library to analyze, train, and evaluate neural networks for medical image segmentation tasks. diff --git a/monai/utils/profiling.py b/monai/utils/profiling.py index 5c880bbe1f..f9e64902ce 100644 --- a/monai/utils/profiling.py +++ b/monai/utils/profiling.py @@ -337,7 +337,7 @@ def profile_iter(self, name, iterable): class _Iterable: - def __iter__(_self): # noqa: B902, N805 pylint: disable=E0213 + def __iter__(_self): do_iter = True orig_iter = iter(iterable) caller = getframeinfo(stack()[1][0]) diff --git a/tests/runner.py b/tests/runner.py index 8079a26091..6b6e2c092a 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -32,14 +32,14 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.timed_tests = {} - def startTest(self, test): # noqa: N802 + def startTest(self, test): """Start timer, print test name, do normal test.""" self.start_time = time.time() name = self.getDescription(test) self.stream.write(f"Starting test: {name}...\n") super().startTest(test) - def stopTest(self, test): # noqa: N802 + def stopTest(self, test): """On test end, get time, print, store and do normal behaviour.""" elapsed = time.time() - self.start_time name = self.getDescription(test)