MCPcopy
hub / github.com/opendevops-cn/opendevops / get

Method get

scripts/tornado_source_code/tornado/queues.py:225–252  ·  view source on GitHub ↗

Remove and return an item from the queue. Returns an awaitable which resolves once an item is available, or raises `tornado.util.TimeoutError` after a timeout. ``timeout`` may be a number denoting a time (on the same scale as `tornado.ioloop.IOLoop.time`, normally `

(self, timeout: Union[float, datetime.timedelta] = None)

Source from the content-addressed store, hash-verified

223 self.__put_internal(item)
224
225 def get(self, timeout: Union[float, datetime.timedelta] = None) -> Awaitable[_T]:
226 """Remove and return an item from the queue.
227
228 Returns an awaitable which resolves once an item is available, or raises
229 `tornado.util.TimeoutError` after a timeout.
230
231 ``timeout`` may be a number denoting a time (on the same
232 scale as `tornado.ioloop.IOLoop.time`, normally `time.time`), or a
233 `datetime.timedelta` object for a deadline relative to the
234 current time.
235
236 .. note::
237
238 The ``timeout`` argument of this method differs from that
239 of the standard library's `queue.Queue.get`. That method
240 interprets numeric values as relative timeouts; this one
241 interprets them as absolute deadlines and requires
242 ``timedelta`` objects for relative timeouts (consistent
243 with other timeouts in Tornado).
244
245 """
246 future = Future() # type: Future[_T]
247 try:
248 future.set_result(self.get_nowait())
249 except QueueEmpty:
250 self._getters.append(future)
251 _set_timeout(future, timeout)
252 return future
253
254 def get_nowait(self) -> _T:
255 """Remove and return an item from the queue without blocking.

Callers 15

test_repr_and_strMethod · 0.95
test_maxsizeMethod · 0.95
test_blocking_getMethod · 0.95
test_get_with_puttersMethod · 0.95
test_get_timeoutMethod · 0.95
test_put_with_gettersMethod · 0.95
test_put_timeoutMethod · 0.95

Calls 3

get_nowaitMethod · 0.95
_set_timeoutFunction · 0.85
appendMethod · 0.80

Tested by 15

test_repr_and_strMethod · 0.76
test_maxsizeMethod · 0.76
test_blocking_getMethod · 0.76
test_get_with_puttersMethod · 0.76
test_get_timeoutMethod · 0.76
test_put_with_gettersMethod · 0.76
test_put_timeoutMethod · 0.76