"Jd| dZddgZddlmZddlmZddlmZddlmZ ddl m Z m Z m Z mZmZddlmZeejej fZed Zed Z dd lZd Zn #e$rd ZYnwxYwdZedede efdZ dde egefde edede efdZ dde egefde edede efdZ dde egefde edede efdZerexZZd SeZeZd S)abConvenient parallelization of higher order functions. This module provides two helper functions, with appropriate fallbacks on Python 2 and on systems lacking support for synchronization mechanisms: - map_multiprocess - map_multithread These helpers work like Python 3's map, with two differences: - They don't guarantee the order of processing of the elements of the iterable. - The underlying process/thread pools chop the iterable into a number of chunks, so that for very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. map_multiprocessmap_multithread)contextmanager)Poolpool)CallableIterableIteratorTypeVarUnion)DEFAULT_POOLSIZESTNFTirreturnc#K |V|j|j|jdS#|j|j|jwxYw)z>Return a context manager making sure the pool closes properly.N)closejoin terminaters O/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/parallel.pyclosingr.sy       s 7/A&funciterable chunksizec"t||S)zMake an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open is unavailable. )map)rrrs r _map_fallbackr;s tX  ctt5}|j|||cdddS#1swxYwYdS)zChop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. N)r ProcessPoolimap_unorderedrrrrs r_map_multiprocessr$Gs   >4"t"49==>>>>>>>>>>>>>>>>>>s ;??cttt5}|j|||cdddS#1swxYwYdS)zChop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. N)r ThreadPoolrr"r#s r_map_multithreadr'Us ,-- . .>$"t"49==>>>>>>>>>>>>>>>>>>sAAA)r)__doc____all__ contextlibrmultiprocessingrr!rmultiprocessing.dummyr&typingr r r r r pip._vendor.requests.adaptersrrrmultiprocessing.synchronize LACK_SEM_OPEN ImportErrorTIMEOUTrintrr$r'rrrrr5sg$ 0 1%%%%%%////// 444444??????????????:::::: TY '( GCLL GCLL&&&&MMMMM  $ 8D>    EF   A36  &.qk >A  a[    EF > > A36  >&.qk >>A > a[ > > > >EF > > A36  >&.qk >>A > a[ > > > >')66(&OOOsA%%A/.A/