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

Method feed

Lib/test/test_queue.py:840–849  ·  view source on GitHub ↗
(self, q, seq, rnd, sentinel)

Source from the content-addressed store, hash-verified

838 self.q = self.type2test()
839
840 def feed(self, q, seq, rnd, sentinel):
841 while True:
842 try:
843 val = seq.pop()
844 except IndexError:
845 q.put(sentinel)
846 return
847 q.put(val)
848 if rnd.random() > 0.5:
849 time.sleep(rnd.random() * 1e-3)
850
851 def consume(self, q, results, sentinel):
852 while True:

Calls 4

popMethod · 0.45
putMethod · 0.45
randomMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected