Skip to content

Commit bac061b

Browse files
authored
Merge pull request #1074 from onekey-sec/renovate/ruff-0.x
chore(deps): update dependency ruff to v0.9.1
2 parents ceff220 + d282e4f commit bac061b

File tree

20 files changed

+141
-138
lines changed

20 files changed

+141
-138
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pyright = "^1.1.349"
4343
pytest = "^8.0.0"
4444
pytest-cov = ">=3,<7"
4545
pyyaml = "^6.0.1"
46-
ruff = "0.8.6"
46+
ruff = "0.9.1"
4747
taplo = "^0.9.3"
4848

4949
[tool.poetry.group.docs]
@@ -90,12 +90,14 @@ select = [
9090
"T10", # flake8-debugger
9191
"T20", # flake8-print
9292
"TC", # flake8-type-checking
93+
"TID251", # flake8-tidy-imports; banned-api
9394
"TRY", # tryceratops
9495
"UP", # pyupgrade
9596
"W", # pycodestyle (warnings)
9697
]
9798

9899
ignore = [
100+
"A005", # stdlib-module-shadowing: E.g. `unblog.logging` collides with stdlib `logging`. It's okay for us
99101
"B027", # empty-method-without-abstract-decorator: It is okay to have empty methods in abstract classes
100102
"D1", # undocumented-*: We are not documenting every public symbol
101103
"D203", # one-blank-line-before-class: D211 (no-blank-line-before-class) is used instead
@@ -143,6 +145,9 @@ fixture-parentheses = false
143145
mark-parentheses = false
144146
parametrize-names-type = "csv"
145147

148+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
149+
"attr".msg = "Use `attrs` (with an 's') instead"
150+
146151
[tool.pytest.ini_options]
147152
addopts = "--cov=unblob --cov=tests --cov-branch --cov-fail-under=90"
148153
norecursedirs = """

tests/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ def test_skip_extraction(
377377

378378
assert result.exit_code == 0
379379
process_file_mock.assert_called_once()
380-
assert (
381-
process_file_mock.call_args.args[0].skip_extraction == skip_extraction
382-
), fail_message
380+
assert process_file_mock.call_args.args[0].skip_extraction == skip_extraction, (
381+
fail_message
382+
)
383383

384384

385385
@pytest.mark.parametrize(

tests/test_finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import attr
1+
import attrs
22
import pytest
33
from pyperscan import Scan
44

@@ -233,4 +233,4 @@ def test_search_chunks(content, expected_chunks, task_result):
233233

234234
assert len(chunks) == len(expected_chunks)
235235
for expected_chunk, chunk in zip(expected_chunks, chunks):
236-
assert attr.evolve(chunk, id="") == attr.evolve(expected_chunk, id="")
236+
assert attrs.evolve(chunk, id="") == attrs.evolve(expected_chunk, id="")

tests/test_processing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from statistics import mean
77
from typing import Optional, TypeVar
88

9-
import attr
9+
import attrs
1010
import pytest
1111

1212
from unblob import handlers
@@ -54,7 +54,7 @@ def assert_same_chunks(expected, actual, explanation=None):
5454
"""Assert ignoring the chunk.id-s."""
5555
assert len(expected) == len(actual), explanation
5656
for e, a in zip(expected, actual):
57-
assert attr.evolve(e, id="") == attr.evolve(a, id=""), explanation
57+
assert attrs.evolve(e, id="") == attrs.evolve(a, id=""), explanation
5858

5959

6060
@pytest.mark.parametrize(

unblob/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __init__(
177177
help=f"""Skip processing files with given magic prefix.
178178
The provided values are appended to unblob's own skip magic list unless
179179
--clear-skip-magic is provided.
180-
[default: {', '.join(DEFAULT_SKIP_MAGIC)}]
180+
[default: {", ".join(DEFAULT_SKIP_MAGIC)}]
181181
""",
182182
multiple=True,
183183
)
@@ -481,12 +481,12 @@ def print_report(reports: ProcessResult):
481481
chunks_distribution.items(), key=lambda item: item[1], reverse=True
482482
):
483483
chunks_table.add_row(
484-
handler.upper(), human_size(size), f"{(size/total_size) * 100:0.2f}%"
484+
handler.upper(), human_size(size), f"{(size / total_size) * 100:0.2f}%"
485485
)
486486

487487
console.print(chunks_table)
488488
console.print(
489-
f"Chunk identification ratio: [#00FFC8]{(valid_size/total_size) * 100:0.2f}%[/#00FFC8]"
489+
f"Chunk identification ratio: [#00FFC8]{(valid_size / total_size) * 100:0.2f}%[/#00FFC8]"
490490
)
491491

492492
if len(reports.errors):

unblob/dependencies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import shutil
22

3-
import attr
3+
import attrs
44

55
from .models import DirectoryHandlers, Handlers
66

77

8-
@attr.define
8+
@attrs.define
99
class Dependency:
1010
command: str
1111
is_installed: bool

unblob/finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from functools import lru_cache
77
from typing import Optional
88

9-
import attr
9+
import attrs
1010
from pyperscan import Flag, Pattern, Scan, StreamDatabase
1111
from structlog import get_logger
1212

@@ -19,7 +19,7 @@
1919
logger = get_logger()
2020

2121

22-
@attr.define
22+
@attrs.define
2323
class HyperscanMatchContext:
2424
file: File
2525
file_size: int

unblob/handlers/archive/cpio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55
from typing import Optional
66

7-
import attr
7+
import attrs
88
from structlog import get_logger
99

1010
from ...file_utils import (
@@ -110,7 +110,7 @@
110110
"""
111111

112112

113-
@attr.define
113+
@attrs.define
114114
class CPIOEntry:
115115
start_offset: int
116116
size: int

unblob/handlers/archive/qnap/qnap_nas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33
from typing import Optional
44

5-
import attr
5+
import attrs
66
from pyperscan import Flag, Pattern, Scan, StreamDatabase
77
from structlog import get_logger
88

@@ -36,7 +36,7 @@
3636
]
3737

3838

39-
@attr.define
39+
@attrs.define
4040
class QTSSearchContext:
4141
start_offset: int
4242
file: File

0 commit comments

Comments
 (0)