From b801e7c6afb03a8d57a2cb894d6f0a8852a45cce Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 21 Jul 2025 20:54:54 +0000
Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.3 → v0.12.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.3...v0.12.4)
- [github.com/pre-commit/mirrors-mypy: v1.16.1 → v1.17.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.16.1...v1.17.0)
---
.pre-commit-config.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0edd273..b7a7e07 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -9,7 +9,7 @@ ci:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.12.3
+ rev: v0.12.4
hooks:
- id: ruff
args: [--fix]
@@ -38,7 +38,7 @@ repos:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.16.1
+ rev: v1.17.0
hooks:
- id: mypy
# uses py311 syntax, mypy configured for py39
From e04f7bb079d68b2d8b0774f49aa0040d878f60cd Mon Sep 17 00:00:00 2001
From: jakkdl
Date: Tue, 22 Jul 2025 12:38:21 +0200
Subject: [PATCH 2/2] fix typing errors
---
flake8_async/visitors/flake8asyncvisitor.py | 4 +---
flake8_async/visitors/helpers.py | 10 +++-------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/flake8_async/visitors/flake8asyncvisitor.py b/flake8_async/visitors/flake8asyncvisitor.py
index 7bce4a9..46b236c 100644
--- a/flake8_async/visitors/flake8asyncvisitor.py
+++ b/flake8_async/visitors/flake8asyncvisitor.py
@@ -16,9 +16,7 @@
from ..runner import SharedState
- HasLineCol = Union[
- ast.expr, ast.stmt, ast.arg, ast.excepthandler, ast.alias, Statement
- ]
+ HasLineCol = Union[ast.expr, ast.stmt, ast.arg, ast.excepthandler, Statement]
class Flake8AsyncVisitor(ast.NodeVisitor, ABC):
diff --git a/flake8_async/visitors/helpers.py b/flake8_async/visitors/helpers.py
index 7821dcd..ea2da3d 100644
--- a/flake8_async/visitors/helpers.py
+++ b/flake8_async/visitors/helpers.py
@@ -6,6 +6,7 @@
from __future__ import annotations
import ast
+from collections.abc import Sized
from dataclasses import dataclass
from fnmatch import fnmatch
from typing import TYPE_CHECKING, Generic, TypeVar, Union
@@ -140,14 +141,9 @@ def iter_guaranteed_once(iterable: ast.expr) -> bool:
else:
return True
return False
- # once we drop 3.9 we can add `and not isinstance(iterable.value, types.EllipsisType)`
- # to get rid of `type: ignore`. Or just live with the fact that pyright doesn't
- # make use of the `hasattr`.
+
if isinstance(iterable, ast.Constant):
- return (
- hasattr(iterable.value, "__len__")
- and len(iterable.value) > 0 # pyright: ignore[reportArgumentType]
- )
+ return isinstance(iterable.value, Sized) and len(iterable.value) > 0
if isinstance(iterable, ast.Dict):
for key, val in zip(iterable.keys, iterable.values):