MCPcopy Create free account
hub / github.com/tox-dev/filelock / _CancellationObservedTask

Class _CancellationObservedTask

tests/async_lock/test_executor.py:70–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69
70class _CancellationObservedTask(asyncio.Task[_T]): # pragma: needs fcntl
71 def __init__(
72 self,
73 coroutine: Coroutine[None, None, _T],
74 cancellation_seen: threading.Event,
75 *,
76 loop: asyncio.AbstractEventLoop,
77 ) -> None:
78 self._cancellation_seen = cancellation_seen
79 super().__init__(coroutine, loop=loop)
80
81 def cancel(
82 self,
83 msg: object | None = None, # simplint: ignore[imprecise-annotation] # Task.cancel accepts arbitrary payloads
84 ) -> bool:
85 # Task.cancel accepts arbitrary payloads; object is the narrowest accurate type for its public contract.
86 self._cancellation_seen.set()
87 return super().cancel(msg)
88
89
90@NEEDS_FCNTL

Callers 2

start_acquireFunction · 0.85
start_contextFunction · 0.85

Calls

no outgoing calls

Tested by 2

start_acquireFunction · 0.68
start_contextFunction · 0.68