MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / thread_map

Function thread_map

pager_lib/tqdm/contrib/concurrent.py:54–69  ·  view source on GitHub ↗

Equivalent of `list(map(fn, *iterables))` driven by `concurrent.futures.ThreadPoolExecutor`. Parameters ---------- tqdm_class : optional `tqdm` class to use for bars [default: tqdm.auto.tqdm]. max_workers : int, optional Maximum number of workers to spawn;

(fn, *iterables, **tqdm_kwargs)

Source from the content-addressed store, hash-verified

52
53
54def thread_map(fn, *iterables, **tqdm_kwargs):
55 """
56 Equivalent of `list(map(fn, *iterables))`
57 driven by `concurrent.futures.ThreadPoolExecutor`.
58
59 Parameters
60 ----------
61 tqdm_class : optional
62 `tqdm` class to use for bars [default: tqdm.auto.tqdm].
63 max_workers : int, optional
64 Maximum number of workers to spawn; passed to
65 `concurrent.futures.ThreadPoolExecutor.__init__`.
66 [default: max(32, cpu_count() + 4)].
67 """
68 from concurrent.futures import ThreadPoolExecutor
69 return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
70
71
72def process_map(fn, *iterables, **tqdm_kwargs):

Callers

nothing calls this directly

Calls 1

_executor_mapFunction · 0.85

Tested by

no test coverage detected