Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3
rev: v0.9.4
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black
args: [--preview]
Expand Down Expand Up @@ -45,7 +45,7 @@ repos:
exclude: tests/eval_files/.*_py311.py

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.392.post0
rev: v1.1.393
hooks:
- id: pyright
# ignore warnings about new version being available, no other warnings
Expand All @@ -66,7 +66,7 @@ repos:
- trio

- repo: https://github.com/codespell-project/codespell
rev: v2.4.0
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
Expand Down
6 changes: 4 additions & 2 deletions flake8_async/visitors/visitor2xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ class Visitor22X(Visitor200):
"Sync call {} in async function, use "
"`asyncio.create_subprocess_[exec/shell]."
),
"ASYNC222": "Sync call {} in async function, wrap in `{}.to_thread.run_sync()`.",
"ASYNC222": (
"Sync call {} in async function, wrap in `{}.to_thread.run_sync()`."
),
"ASYNC222_asyncio": (
"Sync call {} in async function, use `asyncio.loop.run_in_executor`."
),
Expand Down Expand Up @@ -397,7 +399,7 @@ def visit_Call(self, node: ast.Call):
@error_class
class Visitor25X(Visitor200):
error_codes: Mapping[str, str] = {
"ASYNC250": ("Blocking sync call `input()` in async function. Wrap in `{}`."),
"ASYNC250": "Blocking sync call `input()` in async function. Wrap in `{}`.",
"ASYNC251": (
"Blocking sync call `time.sleep(...)` in async function."
" Use `await {}.sleep(...)`."
Expand Down
2 changes: 1 addition & 1 deletion flake8_async/visitors/visitor91x.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class Visitor91X(Flake8AsyncVisitor_cst, CommonVisitors):
"CancelScope with no guaranteed cancel point. This makes it potentially "
"impossible to cancel."
),
"ASYNC913": ("Indefinite loop with no guaranteed cancel points."),
"ASYNC913": "Indefinite loop with no guaranteed cancel points.",
"ASYNC100": (
"{0}.{1} context contains no checkpoints, remove the context or add"
" `await {0}.lowlevel.checkpoint()`."
Expand Down
12 changes: 8 additions & 4 deletions flake8_async/visitors/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,10 @@ def visit_Call(self, node: ast.Call):
@error_class
class Visitor119(Flake8AsyncVisitor):
error_codes: Mapping[str, str] = {
"ASYNC119": "Yield in contextmanager in async generator might not trigger"
" cleanup. Use `@asynccontextmanager` or refactor."
"ASYNC119": (
"Yield in contextmanager in async generator might not trigger"
" cleanup. Use `@asynccontextmanager` or refactor."
)
}

def __init__(self, *args: Any, **kwargs: Any):
Expand Down Expand Up @@ -490,8 +492,10 @@ def leave_IfExp_test(self, node: cst.IfExp):
@disabled_by_default
class Visitor900(Flake8AsyncVisitor):
error_codes: Mapping[str, str] = {
"ASYNC900": "Async generator not allowed, unless transformed "
"by a known decorator (one of: {})."
"ASYNC900": (
"Async generator not allowed, unless transformed "
"by a known decorator (one of: {})."
)
}

def __init__(self, *args: Any, **kwargs: Any):
Expand Down
1 change: 0 additions & 1 deletion tests/eval_files/async111.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import trio
import trio as noterror


# shed/black breaks up a *ton* of lines since adding more detailed error messages, so
# disable formatting to avoid having to adjust a ton of line references
# fmt: off
Expand Down
Loading