Coverage for /opt/homebrew/lib/python3.11/site-packages/anyio/_core/_resources.py: 50%
6 statements
« prev ^ index » next coverage.py v7.2.3, created at 2023-05-04 13:14 +0700
« prev ^ index » next coverage.py v7.2.3, created at 2023-05-04 13:14 +0700
1from ..abc import AsyncResource
2from ._tasks import CancelScope
5async def aclose_forcefully(resource: AsyncResource) -> None:
6 """
7 Close an asynchronous resource in a cancelled scope.
9 Doing this closes the resource without waiting on anything.
11 :param resource: the resource to close
13 """
14 with CancelScope() as scope:
15 scope.cancel()
16 await resource.aclose()