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
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 07:19 +0000
1from __future__ import annotations
3from ..abc import AsyncResource
4from ._tasks import CancelScope
7async def aclose_forcefully(resource: AsyncResource) -> None:
8 """
9 Close an asynchronous resource in a cancelled scope.
11 Doing this closes the resource without waiting on anything.
13 :param resource: the resource to close
15 """
16 with CancelScope() as scope:
17 scope.cancel()
18 await resource.aclose()