ASYNC115: autofix to use full qualified anyio.lowlevel import#24166
Merged
MichaReiser merged 4 commits intoastral-sh:mainfrom Mar 25, 2026
Merged
ASYNC115: autofix to use full qualified anyio.lowlevel import#24166MichaReiser merged 4 commits intoastral-sh:mainfrom
ASYNC115: autofix to use full qualified anyio.lowlevel import#24166MichaReiser merged 4 commits intoastral-sh:mainfrom
Conversation
…ort lowlevel` The autofix for `anyio.sleep(0)` was generating `from anyio import lowlevel`, but `anyio.lowlevel` is a submodule that requires `import anyio.lowlevel`. Fixes astral-sh#21693
ASYNC115: autofix to use full qualified anyio.lowlevel import
carljm
added a commit
that referenced
this pull request
Mar 25, 2026
* main: [ty] make `test-case` a dev-dependency (#24187) [ty] implement cycle normalization for more types to prevent too-many-cycle panics (#24061) [ty] Silence all diagnostics in unreachable code (#24179) [ty] Intern `InferableTypeVars` (#24161) Implement unnecessary-if (RUF050) (#24114) Recognize `Self` annotation and `self` assignment in SLF001 (#24144) Bump the npm version before publish (#24178) [ty] Disallow Self in metaclass and static methods (#23231) Use trusted publishing for NPM packages (#24171) [ty] Respect non-explicitly defined dataclass params (#24170) Add RUF072: warn when using operator on an f-string (#24162) [ty] Check return type of generator functions (#24026) Implement useless-finally (RUF-072) (#24165) [ty] Add test for a dataclass with a default field converter (#24169) [ty] Dataclass field converters (#23088) [flake8-bandit] Treat sys.executable as trusted input in S603 (#24106) [ty] Add support for `typing.Concatenate` (#23689) `ASYNC115`: autofix to use full qualified `anyio.lowlevel` import (#24166) [ty] Disallow read-only fields in TypedDict updates (#24128) Speed up diagnostic rendering (#24146)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The ASYNC115 autofix for
anyio.sleep(0)was generatingfrom anyio import lowlevel, butanyio.lowlevelis a submodule that requiresimport anyio.lowlevel. The fixed code would fail at runtime withAttributeError.This change makes the import strategy module-aware:
import anyio.lowlevel(submodule import)from trio import lowlevel(re-exported member, works fine)Added a test case covering the anyio-specific import path.
Fixes #21693