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

6 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:12 +0000

1from ..abc import AsyncResource 

2from ._tasks import CancelScope 

3 

4 

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

6 """ 

7 Close an asynchronous resource in a cancelled scope. 

8 

9 Doing this closes the resource without waiting on anything. 

10 

11 :param resource: the resource to close 

12 

13 """ 

14 with CancelScope() as scope: 

15 scope.cancel() 

16 await resource.aclose()