Skip to content

Commit bc897fd

Browse files
authored
upgrade ruff to 0.11.13 (#5003)
1 parent 04a455c commit bc897fd

File tree

170 files changed

+552
-629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+552
-629
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ repos:
6969

7070
# Ruff
7171
- repo: https://github.com/charliermarsh/ruff-pre-commit
72-
rev: v0.4.10
72+
rev: v0.11.13
7373
hooks:
74-
- id: ruff
75-
args: [--fix]
74+
- id: ruff-check
75+
args: [--fix, --unsafe-fixes]
7676
- id: ruff-format

application/backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ dev = [
5151
"time-machine~=2.19.0",
5252
]
5353
lint = [
54-
"ruff==0.9.3",
54+
"ruff==0.11.13",
5555
"mypy~=1.16.1",
5656
"types-PyYAML~=6.0.12",
5757
"types-requests~=2.32.4",

application/backend/uv.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/pyproject.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,19 +291,17 @@ ignore = [
291291
"D105", # Missing docstring in magic method
292292

293293
# flake8-annotations
294-
"ANN101", # Missing-type-self
295294
"ANN002", # Missing type annotation for *args
296295
"ANN003", # Missing type annotation for **kwargs
297296

298-
"ANN102", # Missing type annotation for `cls` in classmethod
299297
"ANN204", # Missing return type annotation for special method `__init__`
300298

301299
"ARG002", # Unused method argument -> some function cannot use argument
302300

303301
"COM812", # Missing trailing comma -> conflicts with ISC001
304302

305303
# flake8-type-checking
306-
"TCH001", # typing-only-first-party-import, Sometimes this causes an incorrect error.
304+
"TC001", # typing-only-first-party-import, Sometimes this causes an incorrect error.
307305
# flake8-fixme
308306
"FIX002", # line-contains-todo
309307

@@ -342,15 +340,15 @@ exclude = [
342340
"venv",
343341
"tests/assets",
344342

345-
# it will be cleaned up later
346-
"for_developers/helpers.py",
347-
348343
# Ruff complains it but don't know how to fix since it literally showed no useful logs.
349344
# https://github.com/openvinotoolkit/training_extensions/actions/runs/7176557723/job/19541622452?pr=2718#step:5:170
350345
"tests/regression/*.py",
351346

352347
# Mostly borrowed from jsonargparse codebase
353-
"src/otx/core/utils/jsonargparse.py"
348+
"src/otx/core/utils/jsonargparse.py",
349+
350+
# Sphinx auto-generated files
351+
"docs/source/conf.py",
354352
]
355353

356354
# Allow unused variables when underscore-prefixed.
@@ -391,6 +389,7 @@ notice-rgx = """
391389
# Declare an additional exclude rule for test code
392390
"tests/**/*.py" = [
393391
"S101", # pytest-style allows `assert` statements in tests.
392+
"S603", # Allow for untrusted input in tests.
394393
"SLF001", # We sometimes need to inspect private functions for testing.
395394
"TCH003", # It doesn't seem necessary to use TYPE_CHECKING in tests.
396395
"PT004", # fixture ignore type returning.

library/src/otx/backend/native/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
from .utils import get_otx_root_path, list_models
1010

11-
__all__ = ["list_models", "get_otx_root_path"]
11+
__all__ = ["get_otx_root_path", "list_models"]

library/src/otx/backend/native/engine.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ def __init__(
129129
input_size = self._datamodule.input_size
130130
if input_size is None:
131131
msg = (
132-
"Input size is not specified in the datamodule. "
133-
"Ensure that the datamodule has a valid input size."
132+
"Input size is not specified in the datamodule. Ensure that the datamodule has a valid input size."
134133
)
135134
raise ValueError(msg)
136135
get_model_args["data_input_params"] = DataInputParams(

library/src/otx/backend/native/exporter/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ def to_exportable_code(
237237
@staticmethod
238238
def _embed_onnx_metadata(onnx_model: onnx.ModelProto, metadata: dict[tuple[str, str], Any]) -> onnx.ModelProto:
239239
"""Embeds metadata to ONNX model."""
240-
for item in metadata:
240+
for k, v in metadata.items():
241241
meta = onnx_model.metadata_props.add()
242-
attr_path = " ".join(map(str, item))
242+
attr_path = " ".join(map(str, k))
243243
meta.key = attr_path.strip()
244-
meta.value = str(metadata[item])
244+
meta.value = str(v)
245245

246246
return onnx_model
247247

library/src/otx/backend/native/exporter/exportable_code/demo/demo_package/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
)
1616

1717
__all__ = [
18-
"SyncExecutor",
1918
"AsyncExecutor",
20-
"create_visualizer",
21-
"ModelWrapper",
2219
"BaseVisualizer",
2320
"ClassificationVisualizer",
24-
"SemanticSegmentationVisualizer",
2521
"InstanceSegmentationVisualizer",
22+
"ModelWrapper",
2623
"ObjectDetectionVisualizer",
24+
"SemanticSegmentationVisualizer",
25+
"SyncExecutor",
26+
"create_visualizer",
2727
]

library/src/otx/backend/native/exporter/exportable_code/demo/demo_package/executors/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
from .synchronous import SyncExecutor
88

99
__all__ = [
10-
"SyncExecutor",
1110
"AsyncExecutor",
11+
"SyncExecutor",
1212
]

library/src/otx/backend/native/exporter/exportable_code/demo/demo_package/streamer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
)
1515

1616
__all__ = [
17+
"BaseStreamer",
1718
"CameraStreamer",
1819
"DirStreamer",
1920
"ImageStreamer",
2021
"ThreadedStreamer",
2122
"VideoStreamer",
22-
"BaseStreamer",
2323
"get_streamer",
2424
]

0 commit comments

Comments
 (0)