-
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.
- Loading branch information
1 parent
f1e0d9e
commit cdd9910
Showing
4 changed files
with
43 additions
and
53 deletions.
There are no files selected for viewing
9 changes: 6 additions & 3 deletions
9
crates/ruff_linter/resources/test/fixtures/flake8_trio/TRIO110.py
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,13 +1,16 @@ | ||
import trio | ||
|
||
async def foo(): | ||
|
||
async def func(): | ||
while True: | ||
await trio.sleep(10) | ||
|
||
async def foo(): | ||
|
||
async def func(): | ||
while True: | ||
await trio.sleep_until(10) | ||
|
||
async def foo(): | ||
|
||
async def func(): | ||
while True: | ||
trio.sleep(10) |
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
20 changes: 8 additions & 12 deletions
20
...les/flake8_trio/snapshots/ruff_linter__rules__flake8_trio__tests__TRIO110_TRIO110.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,26 +1,22 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_trio/mod.rs | ||
--- | ||
TRIO110.py:4:5: TRIO110 Use event instead of `while <condition>: await trio.sleep()` | ||
TRIO110.py:5:5: TRIO110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop | ||
| | ||
3 | async def foo(): | ||
4 | while True: | ||
4 | async def func(): | ||
5 | while True: | ||
| _____^ | ||
5 | | await trio.sleep(10) | ||
6 | | await trio.sleep(10) | ||
| |____________________________^ TRIO110 | ||
6 | | ||
7 | async def foo(): | ||
| | ||
|
||
TRIO110.py:8:5: TRIO110 Use event instead of `while <condition>: await trio.sleep()` | ||
TRIO110.py:10:5: TRIO110 Use `trio.Event` instead of awaiting `trio.sleep` in a `while` loop | ||
| | ||
7 | async def foo(): | ||
8 | while True: | ||
9 | async def func(): | ||
10 | while True: | ||
| _____^ | ||
9 | | await trio.sleep_until(10) | ||
11 | | await trio.sleep_until(10) | ||
| |__________________________________^ TRIO110 | ||
10 | | ||
11 | async def foo(): | ||
| | ||
|
||
|