U C^ @sdZddlmZddlmZddlmZzddlm Z WnBe k rzzddl m Z Wne k rtddZ YnXYnXddl Z d d giZ d d gZd dZdd Zdd ZdS)z, Thin wrappers around `concurrent.futures`. )absolute_import)tqdm)deepcopy) cpu_countcCsdS)Nrrr9/tmp/pip-install-6_kvzl1k/tqdm/tqdm/contrib/concurrent.pyr srNz github.com/Z casperdcl thread_map process_mapc Ost|}|dt|d|dt}|dtdtd}t|d}tj dd d krr|j |j | fd |f|*}t ||j|f|f|W5QRSQRXdS) z Implementation of `thread_map` and `process_map`. Parameters ---------- tqdm_class : [default: tqdm.auto.tqdm]. totalr tqdm_class max_workers r)r N))Z initializerZinitargs)r setdefaultlenpop tqdm_autominrdictsys version_infoupdateZset_lockZget_locklistmap) Z PoolExecutorfn iterables tqdm_kwargskwargsr r pool_kwargsexrrr _executor_maps   r#cOsddlm}t||f||S)z Equivalent of `list(map(fn, *iterables))` driven by `concurrent.futures.ThreadPoolExecutor`. Parameters ---------- tqdm_class : [default: tqdm.auto.tqdm]. r)ThreadPoolExecutor)concurrent.futuresr$r#)rrrr$rrrr )s cOsddlm}t||f||S)z Equivalent of `list(map(fn, *iterables))` driven by `concurrent.futures.ProcessPoolExecutor`. Parameters ---------- tqdm_class : [default: tqdm.auto.tqdm]. r)ProcessPoolExecutor)r%r&r#)rrrr&rrrr 6s )__doc__ __future__rZ tqdm.autorrcopyrosr ImportErrormultiprocessingr __author____all__r#r r rrrrs