• Home
  • Raw
  • Download

Lines Matching +full:get +full:- +full:item

1 :mod:`queue` --- A synchronized queue class
9 --------------
11 The :mod:`queue` module implements multi-producer, multi-consumer queues.
17 which the entries are retrieved. In a :abbr:`FIFO (first-in, first-out)`
19 :abbr:`LIFO (last-in, first-out)` queue, the most recently added entry is
29 :abbr:`FIFO (first-in, first-out)` queue type, :class:`SimpleQueue`, whose
37 Constructor for a :abbr:`FIFO (first-in, first-out)` queue. *maxsize* is
45 Constructor for a :abbr:`LIFO (last-in, first-out)` queue. *maxsize* is
64 that ignores the data item and only compares the priority number::
72 item: Any=field(compare=False)
76 Constructor for an unbounded :abbr:`FIFO (first-in, first-out)` queue.
84 Exception raised when non-blocking :meth:`~Queue.get` (or
91 Exception raised when non-blocking :meth:`~Queue.put` (or
99 -------------
108 guarantee that a subsequent get() will not block, nor will qsize() < maxsize
117 guarantee that a subsequent call to get() will not block.
123 returns ``True`` it doesn't guarantee that a subsequent call to get()
128 .. method:: Queue.put(item, block=True, timeout=None)
130 Put *item* into the queue. If optional args *block* is true and *timeout* is
134 Otherwise (*block* is false), put an item on the queue if a free slot is
139 .. method:: Queue.put_nowait(item)
141 Equivalent to ``put(item, block=False)``.
144 .. method:: Queue.get(block=True, timeout=None)
146 Remove and return an item from the queue. If optional args *block* is true and
147 *timeout* is ``None`` (the default), block if necessary until an item is available.
149 raises the :exc:`Empty` exception if no item was available within that time.
150 Otherwise (*block* is false), return an item if one is immediately available,
161 Equivalent to ``get(False)``.
170 threads. For each :meth:`get` used to fetch a task, a subsequent call to
174 processed (meaning that a :meth:`task_done` call was received for every item
185 The count of unfinished tasks goes up whenever an item is added to the queue.
187 indicate that the item was retrieved and all work on it is complete. When the
200 item = q.get()
201 print(f'Working on {item}')
202 print(f'Finished {item}')
205 # Turn-on the worker thread.
209 for item in range(30):
210 q.put(item)
218 -------------------
225 guarantee that a subsequent get() will not block.
231 returns ``False`` it doesn't guarantee that a subsequent call to get()
235 .. method:: SimpleQueue.put(item, block=True, timeout=None)
237 Put *item* into the queue. The method never blocks and always succeeds
238 (except for potential low-level errors such as failure to allocate memory).
242 .. impl-detail::
244 ``put()`` or ``get()`` call can be interrupted by another ``put()``
250 .. method:: SimpleQueue.put_nowait(item)
252 Equivalent to ``put(item, block=False)``, provided for compatibility with
256 .. method:: SimpleQueue.get(block=True, timeout=None)
258 Remove and return an item from the queue. If optional args *block* is true and
259 *timeout* is ``None`` (the default), block if necessary until an item is available.
261 raises the :exc:`Empty` exception if no item was available within that time.
262 Otherwise (*block* is false), return an item if one is immediately available,
268 Equivalent to ``get(False)``.
274 A queue class for use in a multi-processing (rather than multi-threading)