MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / get

Method get

site-packages/queue.py:153–182  ·  view source on GitHub ↗

Remove and return an item from the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until an item is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises the Empty exception if

(self, block=True, timeout=None)

Source from the content-addressed store, hash-verified

151 self.not_empty.notify()
152
153 def get(self, block=True, timeout=None):
154 '''Remove and return an item from the queue.
155
156 If optional args 'block' is true and 'timeout' is None (the default),
157 block if necessary until an item is available. If 'timeout' is
158 a non-negative number, it blocks at most 'timeout' seconds and raises
159 the Empty exception if no item was available within that time.
160 Otherwise ('block' is false), return an item if one is immediately
161 available, else raise the Empty exception ('timeout' is ignored
162 in that case).
163 '''
164 with self.not_empty:
165 if not block:
166 if not self._qsize():
167 raise Empty
168 elif timeout is None:
169 while not self._qsize():
170 self.not_empty.wait()
171 elif timeout < 0:
172 raise ValueError("'timeout' must be a non-negative number")
173 else:
174 endtime = time() + timeout
175 while not self._qsize():
176 remaining = endtime - time()
177 if remaining <= 0.0:
178 raise Empty
179 self.not_empty.wait(remaining)
180 item = self._get()
181 self.not_full.notify()
182 return item
183
184 def put_nowait(self, item):
185 ''&#x27;Put an item into the queue without blocking.

Callers 15

get_nowaitMethod · 0.95
load_moduleMethod · 0.45
load_moduleMethod · 0.45
load_moduleMethod · 0.45
broadcast_addressMethod · 0.45
hostmaskMethod · 0.45
mainFunction · 0.45
distro.pyFile · 0.45
normalizeMethod · 0.45
versionMethod · 0.45
os_release_attrMethod · 0.45

Calls 2

_qsizeMethod · 0.95
_getMethod · 0.95

Tested by

no test coverage detected