-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Update the name of `ASYNC100` to match [upstream](https://flake8-async.readthedocs.io/en/latest/rules.html). Also update to the functionality to match upstream by supporting additional context managers from asyncio and anyio. Matching this [list](https://flake8-async.readthedocs.io/en/latest/glossary.html#timeout-context). Part of #12039. ## Test Plan Added the new context managers to the fixture.
- Loading branch information
1 parent
6fa4e32
commit 88abc6a
Showing
9 changed files
with
333 additions
and
153 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
16 changes: 8 additions & 8 deletions
16
...flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC100_ASYNC100.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs | ||
--- | ||
ASYNC100.py:5:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
ASYNC100.py:7:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
4 | async def func(): | ||
5 | with trio.fail_after(): | ||
6 | async def func(): | ||
7 | with trio.fail_after(): | ||
| _____^ | ||
6 | | ... | ||
8 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:15:5: ASYNC100 A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
ASYNC100.py:17:5: ASYNC100 A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
14 | async def func(): | ||
15 | with trio.move_on_after(): | ||
16 | async def func(): | ||
17 | with trio.move_on_after(): | ||
| _____^ | ||
16 | | ... | ||
18 | | ... | ||
| |___________^ ASYNC100 | ||
| |
74 changes: 74 additions & 0 deletions
74
...ync/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC100_ASYNC100.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_async/mod.rs | ||
--- | ||
ASYNC100.py:7:5: ASYNC100 A `with trio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
6 | async def func(): | ||
7 | with trio.fail_after(): | ||
| _____^ | ||
8 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:17:5: ASYNC100 A `with trio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
16 | async def func(): | ||
17 | with trio.move_on_after(): | ||
| _____^ | ||
18 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:33:5: ASYNC100 A `with anyio.move_on_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
32 | async def func(): | ||
33 | with anyio.move_on_after(): | ||
| _____^ | ||
34 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:38:5: ASYNC100 A `with anyio.fail_after(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
37 | async def func(): | ||
38 | with anyio.fail_after(): | ||
| _____^ | ||
39 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:43:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
42 | async def func(): | ||
43 | with anyio.CancelScope(): | ||
| _____^ | ||
44 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:48:5: ASYNC100 A `with anyio.CancelScope(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
47 | async def func(): | ||
48 | with anyio.CancelScope(): | ||
| _____^ | ||
49 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:53:5: ASYNC100 A `with asyncio.timeout(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
52 | async def func(): | ||
53 | with asyncio.timeout(): | ||
| _____^ | ||
54 | | ... | ||
| |___________^ ASYNC100 | ||
| | ||
|
||
ASYNC100.py:58:5: ASYNC100 A `with asyncio.timeout_at(...):` context does not contain any `await` statements. This makes it pointless, as the timeout can only be triggered by a checkpoint. | ||
| | ||
57 | async def func(): | ||
58 | with asyncio.timeout_at(): | ||
| _____^ | ||
59 | | ... | ||
| |___________^ ASYNC100 | ||
| |