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

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 07:19 +0000

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()