Skip to content

Commit aab418e

Browse files
[pre-commit.ci] pre-commit autoupdate (#392)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.3 → v0.12.4](astral-sh/ruff-pre-commit@v0.12.3...v0.12.4) - [github.com/pre-commit/mirrors-mypy: v1.16.1 → v1.17.0](pre-commit/mirrors-mypy@v1.16.1...v1.17.0) * fix typing errors --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: jakkdl <[email protected]>
1 parent 170d488 commit aab418e

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99

1010
repos:
1111
- repo: https://github.com/astral-sh/ruff-pre-commit
12-
rev: v0.12.3
12+
rev: v0.12.4
1313
hooks:
1414
- id: ruff
1515
args: [--fix]
@@ -38,7 +38,7 @@ repos:
3838
- id: isort
3939

4040
- repo: https://github.com/pre-commit/mirrors-mypy
41-
rev: v1.16.1
41+
rev: v1.17.0
4242
hooks:
4343
- id: mypy
4444
# uses py311 syntax, mypy configured for py39

flake8_async/visitors/flake8asyncvisitor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
from ..runner import SharedState
1818

19-
HasLineCol = Union[
20-
ast.expr, ast.stmt, ast.arg, ast.excepthandler, ast.alias, Statement
21-
]
19+
HasLineCol = Union[ast.expr, ast.stmt, ast.arg, ast.excepthandler, Statement]
2220

2321

2422
class Flake8AsyncVisitor(ast.NodeVisitor, ABC):

flake8_async/visitors/helpers.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import annotations
77

88
import ast
9+
from collections.abc import Sized
910
from dataclasses import dataclass
1011
from fnmatch import fnmatch
1112
from typing import TYPE_CHECKING, Generic, TypeVar, Union
@@ -140,14 +141,9 @@ def iter_guaranteed_once(iterable: ast.expr) -> bool:
140141
else:
141142
return True
142143
return False
143-
# once we drop 3.9 we can add `and not isinstance(iterable.value, types.EllipsisType)`
144-
# to get rid of `type: ignore`. Or just live with the fact that pyright doesn't
145-
# make use of the `hasattr`.
144+
146145
if isinstance(iterable, ast.Constant):
147-
return (
148-
hasattr(iterable.value, "__len__")
149-
and len(iterable.value) > 0 # pyright: ignore[reportArgumentType]
150-
)
146+
return isinstance(iterable.value, Sized) and len(iterable.value) > 0
151147

152148
if isinstance(iterable, ast.Dict):
153149
for key, val in zip(iterable.keys, iterable.values):

0 commit comments

Comments
 (0)