Skip to content

Commit ed701ce

Browse files
committed
yesqa
Signed-off-by: jirka <[email protected]>
1 parent 5633f16 commit ed701ce

File tree

11 files changed

+27
-32
lines changed

11 files changed

+27
-32
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ repos:
3737
^monai/_version.py
3838
)
3939
40-
- repo: https://github.com/asottile/yesqa
41-
rev: v1.5.0
42-
hooks:
43-
- id: yesqa
44-
name: Unused noqa
45-
additional_dependencies:
46-
- flake8>=3.8.1
47-
- flake8-bugbear<=24.2.6
48-
- flake8-comprehensions
49-
- pep8-naming
50-
exclude: |
51-
(?x)^(
52-
monai/__init__.py|
53-
docs/source/conf.py|
54-
tests/utils.py
55-
)$
40+
# - repo: https://github.com/asottile/yesqa
41+
# rev: v1.5.0
42+
# hooks:
43+
# - id: yesqa
44+
# name: Unused noqa
45+
# additional_dependencies:
46+
# - flake8>=3.8.1
47+
# - flake8-bugbear<=24.2.6
48+
# - flake8-comprehensions
49+
# - pep8-naming
50+
# exclude: |
51+
# (?x)^(
52+
# monai/__init__.py|
53+
# docs/source/conf.py|
54+
# tests/utils.py
55+
# )$
5656

5757
- repo: https://github.com/hadialqattan/pycln
5858
rev: v2.5.0

monai/apps/nnunet/nnunetv2_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from typing import Any
1919

2020
import monai
21-
from monai.apps.nnunet.utils import NNUNETMode as M # noqa: N814
21+
from monai.apps.nnunet.utils import NNUNETMode as M
2222
from monai.apps.nnunet.utils import analyze_data, create_new_data_copy, create_new_dataset_json
2323
from monai.bundle import ConfigParser
2424
from monai.utils import ensure_tuple, optional_import
@@ -34,7 +34,7 @@
3434
__all__ = ["nnUNetV2Runner"]
3535

3636

37-
class nnUNetV2Runner: # noqa: N801
37+
class nnUNetV2Runner:
3838
"""
3939
``nnUNetV2Runner`` provides an interface in MONAI to use `nnU-Net` V2 library to analyze, train, and evaluate
4040
neural networks for medical image segmentation tasks.

monai/metrics/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import warnings
1515
from collections.abc import Iterable, Sequence
16-
from functools import partial
16+
from functools import partial, lru_cache
1717
from types import ModuleType
1818
from typing import Any
1919

@@ -465,7 +465,7 @@ def prepare_spacing(
465465
ENCODING_KERNEL = {2: [[8, 4], [2, 1]], 3: [[[128, 64], [32, 16]], [[8, 4], [2, 1]]]}
466466

467467

468-
@lru_cache(maxsize=None)
468+
@lru_cache(maxsize=None) # noqa: UP033
469469
def _get_neighbour_code_to_normals_table(device=None):
470470
"""
471471
returns a lookup table. For every binary neighbour code (2x2x2 neighbourhood = 8 neighbours = 8 bits = 256 codes)

monai/transforms/compose.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@
2929
# For backwards compatibility (so this still works: from monai.transforms.compose import MapTransform)
3030
from monai.transforms.lazy.functional import apply_pending_transforms
3131
from monai.transforms.traits import ThreadUnsafe
32-
from monai.transforms.transform import ( # noqa: F401
32+
from monai.transforms.transform import (
3333
LazyTransform,
34-
MapTransform,
3534
Randomizable,
36-
RandomizableTransform,
37-
Transform,
3835
apply_transform,
3936
)
4037
from monai.utils import MAX_SEED, TraceKeys, TraceStatusKeys, ensure_tuple, get_seed

monai/utils/profiling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def profile_iter(self, name, iterable):
337337

338338
class _Iterable:
339339

340-
def __iter__(_self): # noqa: B902, N805 pylint: disable=E0213
340+
def __iter__(_self):
341341
do_iter = True
342342
orig_iter = iter(iterable)
343343
caller = getframeinfo(stack()[1][0])

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ select = [
4747
"E", "F", "W", # flake8
4848
"NPY", # NumPy specific rules
4949
"UP", # pyupgrade
50+
"RUF100", # aka yesqa
5051
]
5152
extend-ignore = [
5253
"E741", # ambiguous variable name

tests/integration/test_integration_lazy_samples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def run_training_test(root_dir, device="cuda:0", cachedataset=0, readers=(None,
137137
ops = [0]
138138
if len(item.applied_operations) > 1:
139139
found = False
140-
for idx, n in enumerate(item.applied_operations): # noqa
140+
for idx, n in enumerate(item.applied_operations):
141141
if n["class"] == "RandCropByPosNegLabel":
142142
found = True
143143
break

tests/integration/test_loader_semaphore.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import multiprocessing as mp
1616
import unittest
1717

18-
import monai # noqa
1918

2019

2120
def w():

tests/profile_subclass/pyspy_profiling.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
import argparse
1818

1919
import torch
20-
from min_classes import SubTensor, SubWithTorchFunc # noqa: F401
2120

22-
from monai.data import MetaTensor # noqa: F401
2321

2422
Tensor = torch.Tensor
2523

tests/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def __init__(self, *args, **kwargs):
3232
super().__init__(*args, **kwargs)
3333
self.timed_tests = {}
3434

35-
def startTest(self, test): # noqa: N802
35+
def startTest(self, test):
3636
"""Start timer, print test name, do normal test."""
3737
self.start_time = time.time()
3838
name = self.getDescription(test)
3939
self.stream.write(f"Starting test: {name}...\n")
4040
super().startTest(test)
4141

42-
def stopTest(self, test): # noqa: N802
42+
def stopTest(self, test):
4343
"""On test end, get time, print, store and do normal behaviour."""
4444
elapsed = time.time() - self.start_time
4545
name = self.getDescription(test)

0 commit comments

Comments
 (0)