Skip to content

Commit 68ea17d

Browse files
committed
also fix new errors from ruff
1 parent 4fe3618 commit 68ea17d

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

flake8_async/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ def __repr__(self) -> str: # pragma: no cover
102102
def __str__(self) -> str:
103103
# flake8 adds 1 to the yielded column from `__iter__`, so we do the same here
104104
return f"{self.line}:{self.col+1}: {self.format_message()}"
105+
106+
def __hash__(self) -> int:
107+
return hash(self.cmp())

tests/check_changelog_and_version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pathlib import Path
99
from typing import TYPE_CHECKING, NamedTuple, TypeVar
1010

11+
from git.repo import Repo
1112
from typing_extensions import Self
1213

1314
if TYPE_CHECKING:
@@ -90,8 +91,6 @@ def test_version_increments_are_correct() -> None:
9091

9192

9293
def ensure_tagged() -> None:
93-
from git.repo import Repo
94-
9594
last_version = next(iter(get_releases()))
9695
repo = Repo(ROOT_PATH)
9796
if str(last_version) not in iter(map(str, repo.tags)):

tests/test_config_and_args.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_systemexit_0(
7676
tmp_path.joinpath("example.py").write_text("")
7777

7878
with pytest.raises(SystemExit) as exc_info:
79-
from flake8_async import __main__ # noqa: F401
79+
from flake8_async import __main__ # noqa: F401, PLC0415
8080

8181
assert exc_info.value.code == 0
8282
out, err = capsys.readouterr()
@@ -91,7 +91,7 @@ def test_systemexit_1(
9191
monkeypatch_argv(monkeypatch, tmp_path)
9292

9393
with pytest.raises(SystemExit) as exc_info:
94-
from flake8_async import __main__ # noqa: F401
94+
from flake8_async import __main__ # noqa: F401, PLC0415
9595

9696
assert exc_info.value.code == 1
9797
out, err = capsys.readouterr()
@@ -174,7 +174,7 @@ def test_anyio_from_config(tmp_path: Path, capsys: pytest.CaptureFixture[str]):
174174
"""
175175
)
176176

177-
from flake8_async.visitors.visitor2xx import Visitor22X
177+
from flake8_async.visitors.visitor2xx import Visitor22X # noqa: PLC0415
178178

179179
err_msg = Visitor22X.error_codes["ASYNC220"].format(
180180
"subprocess.Popen",
@@ -193,7 +193,7 @@ def test_anyio_from_config(tmp_path: Path, capsys: pytest.CaptureFixture[str]):
193193

194194
# construct the full error message
195195
expected = f"{err_file}:{lineno}:5: ASYNC220 {err_msg}\n"
196-
from flake8.main.cli import main
196+
from flake8.main.cli import main # noqa: PLC0415
197197

198198
returnvalue = main(
199199
argv=[
@@ -246,7 +246,7 @@ def test_200_from_config_flake8_internals(
246246
# replace ./ with tmp_path/
247247
err_msg = str(tmp_path) + EXAMPLE_PY_TEXT[1:]
248248

249-
from flake8.main.cli import main
249+
from flake8.main.cli import main # noqa: PLC0415
250250

251251
returnvalue = main(
252252
argv=[
@@ -330,7 +330,7 @@ def test_900_default_off():
330330

331331
@pytest.mark.skipif(flake8 is None, reason="flake8 is not installed")
332332
def test_900_default_off_flake8(capsys: pytest.CaptureFixture[str]):
333-
from flake8.main.cli import main
333+
from flake8.main.cli import main # noqa: PLC0415
334334

335335
returnvalue = main(
336336
argv=[

0 commit comments

Comments
 (0)