-
Notifications
You must be signed in to change notification settings - Fork 974
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Extract
get_assigned_value
to method
- Loading branch information
Showing
5 changed files
with
196 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,7 @@ async def func(): | |
|
||
def func(): | ||
trio.run(trio.sleep(0)) # TRIO115 | ||
|
||
x, y = 0, 2000 | ||
trio.sleep(x) | ||
trio.sleep(y) |
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
123 changes: 123 additions & 0 deletions
123
...flake8_trio/snapshots/ruff_linter__rules__flake8_trio__tests__TRIO115_TRIO115.py.snap.new
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,123 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_trio/mod.rs | ||
assertion_line: 26 | ||
--- | ||
TRIO115.py:6:11: TRIO115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | ||
| | ||
5 | async def func(): | ||
6 | await trio.sleep(0) # TRIO115 | ||
| ^^^^^^^^^^^^^ TRIO115 | ||
7 | await trio.sleep(1) # OK | ||
8 | await trio.sleep(0, 1) # OK | ||
| | ||
= help: Replace with `trio.lowlevel.checkpoint()` | ||
|
||
ℹ Fix | ||
3 3 | | ||
4 4 | | ||
5 5 | async def func(): | ||
6 |- await trio.sleep(0) # TRIO115 | ||
6 |+ await trio.lowlevel.checkpoint # TRIO115 | ||
7 7 | await trio.sleep(1) # OK | ||
8 8 | await trio.sleep(0, 1) # OK | ||
9 9 | await trio.sleep(...) # OK | ||
|
||
TRIO115.py:12:5: TRIO115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | ||
| | ||
10 | await trio.sleep() # OK | ||
11 | | ||
12 | trio.sleep(0) # TRIO115 | ||
| ^^^^^^^^^^^^^ TRIO115 | ||
13 | foo = 0 | ||
14 | trio.sleep(foo) # TRIO115 | ||
| | ||
= help: Replace with `trio.lowlevel.checkpoint()` | ||
|
||
ℹ Fix | ||
9 9 | await trio.sleep(...) # OK | ||
10 10 | await trio.sleep() # OK | ||
11 11 | | ||
12 |- trio.sleep(0) # TRIO115 | ||
12 |+ trio.lowlevel.checkpoint # TRIO115 | ||
13 13 | foo = 0 | ||
14 14 | trio.sleep(foo) # TRIO115 | ||
15 15 | trio.sleep(1) # OK | ||
|
||
TRIO115.py:14:5: TRIO115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | ||
| | ||
12 | trio.sleep(0) # TRIO115 | ||
13 | foo = 0 | ||
14 | trio.sleep(foo) # TRIO115 | ||
| ^^^^^^^^^^^^^^^ TRIO115 | ||
15 | trio.sleep(1) # OK | ||
16 | time.sleep(0) # OK | ||
| | ||
= help: Replace with `trio.lowlevel.checkpoint()` | ||
|
||
ℹ Fix | ||
11 11 | | ||
12 12 | trio.sleep(0) # TRIO115 | ||
13 13 | foo = 0 | ||
14 |- trio.sleep(foo) # TRIO115 | ||
14 |+ trio.lowlevel.checkpoint # TRIO115 | ||
15 15 | trio.sleep(1) # OK | ||
16 16 | time.sleep(0) # OK | ||
17 17 | | ||
|
||
TRIO115.py:18:5: TRIO115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | ||
| | ||
16 | time.sleep(0) # OK | ||
17 | | ||
18 | sleep(0) # TRIO115 | ||
| ^^^^^^^^ TRIO115 | ||
| | ||
= help: Replace with `trio.lowlevel.checkpoint()` | ||
|
||
ℹ Fix | ||
15 15 | trio.sleep(1) # OK | ||
16 16 | time.sleep(0) # OK | ||
17 17 | | ||
18 |- sleep(0) # TRIO115 | ||
18 |+ trio.lowlevel.checkpoint # TRIO115 | ||
19 19 | | ||
20 20 | | ||
21 21 | trio.sleep(0) # TRIO115 | ||
|
||
TRIO115.py:21:1: TRIO115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | ||
| | ||
21 | trio.sleep(0) # TRIO115 | ||
| ^^^^^^^^^^^^^ TRIO115 | ||
| | ||
= help: Replace with `trio.lowlevel.checkpoint()` | ||
|
||
ℹ Fix | ||
18 18 | sleep(0) # TRIO115 | ||
19 19 | | ||
20 20 | | ||
21 |-trio.sleep(0) # TRIO115 | ||
21 |+trio.lowlevel.checkpoint # TRIO115 | ||
22 22 | | ||
23 23 | | ||
24 24 | def func(): | ||
|
||
TRIO115.py:25:14: TRIO115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | ||
| | ||
24 | def func(): | ||
25 | trio.run(trio.sleep(0)) # TRIO115 | ||
| ^^^^^^^^^^^^^ TRIO115 | ||
26 | | ||
27 | x, y = 0, 2000 | ||
| | ||
= help: Replace with `trio.lowlevel.checkpoint()` | ||
|
||
ℹ Fix | ||
22 22 | | ||
23 23 | | ||
24 24 | def func(): | ||
25 |- trio.run(trio.sleep(0)) # TRIO115 | ||
25 |+ trio.run(trio.lowlevel.checkpoint) # TRIO115 | ||
26 26 | | ||
27 27 | x, y = 0, 2000 | ||
28 28 | trio.sleep(x) | ||
|
||
|
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