Open jakkdl opened 2 months ago
The other rules that could be relevant are:
open_nursery
/create_task_group
async def foo(): # should not give ASYNC910
async with trio.open_nursery() as nursery():
nursery.start_soon(bar)
tl;dr, ASYNC100 also needs changing
Hrm, neither of these statements are cancellation sources
my_nursery = await trio.open_nursery()
async with my_nursery:
...
So it's not just async with trio.open_nursery()
that needs to be checked against.
Both of those cases are definitely less common, but far from unheard of. The former is an easy fix, the latter is a bit more tricky but we're already type-tracking nurseries for other reasons so shouldn't be too bad.
https://github.com/python-trio/flake8-async/blob/225f15a98db4bb8ce4600127fd0fe90bc5c9c04b/tests/eval_files/async102.py#L117-L125
TODO:
async with open_nursery(...)
, andasync with anyio.create_task_group(...)
as not being checkpoints. (also affects other rules)[nursery_name].cancel_scope.[deadline/shield]