Skip to content

Commit ea669fb

Browse files
committed
Assign trio110
1 parent 5bafeaa commit ea669fb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## Future
55
- Added TRIO109: Async definitions should not have a `timeout` parameter. Use `trio.[fail/move_on]_[at/after]`
6-
- Added TRIO301: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`.
6+
- Added TRIO110: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`.
77

88
## 22.7.6
99
- Extend TRIO102 to also check inside `except BaseException` and `except trio.Cancelled`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ pip install flake8-trio
3232
- **TRIO108**: Early return from async function must have at least one checkpoint on every code path before it, unless an exception is raised.
3333
Checkpoints are `await`, `async with` `async for`.
3434
- **TRIO109**: Async function definition with a `timeout` parameter - use `trio.[fail/move_on]_[after/at]` instead
35-
- **TRIO301**: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`.
35+
- **TRIO110**: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`.

flake8_trio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,17 @@ def check_109(self, args: ast.arguments):
200200
self.error(TRIO109, arg.lineno, arg.col_offset)
201201

202202
def visit_While(self, node: ast.While):
203-
self.check_for_301(node)
203+
self.check_for_110(node)
204204
self.generic_visit(node)
205205

206-
def check_for_301(self, node: ast.While):
206+
def check_for_110(self, node: ast.While):
207207
if (
208208
len(node.body) == 1
209209
and isinstance(node.body[0], ast.Expr)
210210
and isinstance(node.body[0].value, ast.Await)
211211
and get_trio_scope(node.body[0].value.value, "sleep", "sleep_until")
212212
):
213-
self.error(TRIO301, node.lineno, node.col_offset)
213+
self.error(TRIO110, node.lineno, node.col_offset)
214214

215215

216216
def critical_except(node: ast.ExceptHandler) -> Optional[Tuple[int, int, str]]:
@@ -653,4 +653,4 @@ def run(self) -> Iterable[Error]:
653653
TRIO107 = "TRIO107: Async functions must have at least one checkpoint on every code path, unless an exception is raised"
654654
TRIO108 = "TRIO108: Early return from async function must have at least one checkpoint on every code path before it."
655655
TRIO109 = "TRIO109: Async function definition with a `timeout` parameter - use `trio.[fail/move_on]_[after/at]` instead"
656-
TRIO301 = "TRIO301: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`."
656+
TRIO110 = "TRIO110: `while <condition>: await trio.sleep()` should be replaced by a `trio.Event`."

0 commit comments

Comments
 (0)