MCPcopy Index your code
hub / github.com/python/cpython / add

Method add

Lib/test/test_asyncio/test_tasks.py:3593–3601  ·  view source on GitHub ↗

Wait 0.05 second and return a + b.

(self, a, b, fail=False, cancel=False)

Source from the content-addressed store, hash-verified

3591 self.set_event_loop(self.loop) # Will cleanup properly
3592
3593 async def add(self, a, b, fail=False, cancel=False):
3594 """Wait 0.05 second and return a + b."""
3595 await asyncio.sleep(0.05)
3596 if fail:
3597 raise RuntimeError("Fail!")
3598 if cancel:
3599 asyncio.current_task(self.loop).cancel()
3600 await asyncio.sleep(0)
3601 return a + b
3602
3603 def target(self, fail=False, cancel=False, timeout=None,
3604 advance_coro=False):

Callers 5

targetMethod · 0.95
data_receivedMethod · 0.45
mainMethod · 0.45
sleeperMethod · 0.45
try_async_iteratorMethod · 0.45

Calls 2

sleepMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected