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

Method _guarded_task_generation

Lib/multiprocessing/pool.py:385–394  ·  view source on GitHub ↗

Provides a generator of tasks for imap and imap_unordered with appropriate handling for iterables which throw exceptions during iteration.

(self, result_job, func, iterable)

Source from the content-addressed store, hash-verified

383 callback, error_callback)
384
385 def _guarded_task_generation(self, result_job, func, iterable):
386 '''Provides a generator of tasks for imap and imap_unordered with
387 appropriate handling for iterables which throw exceptions during
388 iteration.'''
389 try:
390 i = -1
391 for i, x in enumerate(iterable):
392 yield (result_job, i, func, (x,), {})
393 except Exception as e:
394 yield (result_job, i+1, _helper_reraises_exception, (e,), {})
395
396 def imap(self, func, iterable, chunksize=1):
397 '''

Callers 3

imapMethod · 0.95
imap_unorderedMethod · 0.95
_map_asyncMethod · 0.95

Calls 1

enumerateFunction · 0.85

Tested by

no test coverage detected