zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
U
H=®dL ã@s&dZddgZddlmZddlmZddlmZddl    m
Z
ddl m Z ddl mZdd    lmZer¬dd
lmZmZmZmZmZdd lmZeejejfZed ƒZed ƒZz ddlZWnek
rÐdZYnXdZdZedd„ƒZddd„Zddd„Z ddd„Z!ese reZ"Z#ne Z"e!Z#dS)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_multiprocessÚmap_multithreadé)Úcontextmanager)ÚPool)ÚDEFAULT_POOLSIZE)ÚPY2©Úmap)ÚMYPY_CHECK_RUNNING)ÚCallableÚIterableÚIteratorÚUnionÚTypeVar©ÚpoolÚSÚTNTFi€„ccs*z
|VW5| ¡| ¡| ¡XdS)z>Return a context manager making sure the pool closes properly.N)ÚcloseÚjoinÚ    terminater©rúSD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/utils/parallel.pyÚclosing4s
 
récCs
t||ƒS)zÞMake 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.
    r)ÚfuncÚiterableÚ    chunksizerrrÚ _map_fallbackBsrc
Cs0ttƒƒ}| |||¡W5QR£SQRXdS)zÿChop 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Ú ProcessPoolÚimap_unordered©rrrrrrrÚ_map_multiprocessMs     r"c
Cs2tttƒƒ}| |||¡W5QR£SQRXdS)zþChop 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!rrrÚ_map_multithreadZs    r$)r)r)r)$Ú__doc__Ú__all__Ú
contextlibrÚmultiprocessingrrZmultiprocessing.dummyr#Zpip._vendor.requests.adaptersrZpip._vendor.sixrÚpip._vendor.six.movesr    Úpip._internal.utils.typingr
Útypingr r r rrrrrZmultiprocessing.synchronizeÚ ImportErrorZ LACK_SEM_OPENÚTIMEOUTrrr"r$rrrrrrÚ<module>s: