Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/anyio/_core/_resources.py: 57%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

7 statements  

1from __future__ import annotations 

2 

3from ..abc import AsyncResource 

4from ._tasks import CancelScope 

5 

6 

7async def aclose_forcefully(resource: AsyncResource) -> None: 

8 """ 

9 Close an asynchronous resource in a cancelled scope. 

10 

11 Doing this closes the resource without waiting on anything. 

12 

13 :param resource: the resource to close 

14 

15 """ 

16 with CancelScope() as scope: 

17 scope.cancel() 

18 await resource.aclose()