1 from ..abc import AsyncResource

2 from ._tasks import CancelScope

3

4

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