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

Method wait_for

pymongo/_asyncio_lock.py:263–275  ·  view source on GitHub ↗

Wait until a predicate becomes true. The predicate should be a callable whose result will be interpreted as a boolean value. The method will repeatedly wait() until it evaluates to true. The final predicate value is the return value.

(self, predicate: Any)

Source from the content-addressed store, hash-verified

261 raise
262
263 async def wait_for(self, predicate: Any) -> Coroutine[Any, Any, Any]:
264 """Wait until a predicate becomes true.
265
266 The predicate should be a callable whose result will be
267 interpreted as a boolean value. The method will repeatedly
268 wait() until it evaluates to true. The final predicate value is
269 the return value.
270 """
271 result = predicate()
272 while not result:
273 await self.wait()
274 result = predicate()
275 return result
276
277 def notify(self, n: int = 1) -> None:
278 """By default, wake up one task waiting on this condition, if any.

Callers 14

waitMethod · 0.80
async_barrier_waitFunction · 0.80
waitMethod · 0.80
c1Method · 0.80
test_timeout_in_blockMethod · 0.80
funcMethod · 0.80
consumerMethod · 0.80
test_cancelled_wakeupMethod · 0.80
async_socket_sendallFunction · 0.80

Calls 2

waitMethod · 0.95
predicateFunction · 0.50

Tested by 9

waitMethod · 0.64
waitMethod · 0.64
c1Method · 0.64
test_timeout_in_blockMethod · 0.64
funcMethod · 0.64
consumerMethod · 0.64
test_cancelled_wakeupMethod · 0.64