MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _Task

Class _Task

pymongo/_asyncio_task.py:27–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26# TODO (https://jira.mongodb.org/browse/PYTHON-4981): Revisit once the underlying cause of the swallowed cancellations is uncovered
27class _Task(asyncio.Task[Any]):
28 def __init__(self, coro: Coroutine[Any, Any, Any], *, name: Optional[str] = None) -> None:
29 super().__init__(coro, name=name)
30 self._cancel_requests = 0
31 asyncio._register_task(self)
32
33 def cancel(self, msg: Optional[str] = None) -> bool:
34 self._cancel_requests += 1
35 return super().cancel(msg=msg)
36
37 def uncancel(self) -> int:
38 if self._cancel_requests > 0:
39 self._cancel_requests -= 1
40 return self._cancel_requests
41
42 def cancelling(self) -> int:
43 return self._cancel_requests
44
45
46def create_task(coro: Coroutine[Any, Any, Any], *, name: Optional[str] = None) -> asyncio.Task[Any]:

Callers 1

create_taskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected