HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc
a

g��e��@s�dZddgZddlmZddlmZddlmZddlmZ	ddl
mZmZm
Z
mZmZddlmZeejej	fZed	�Zed
�ZzddlZWney�dZYn0d
ZdZedd��Zddd�Zddd�Zddd�Zer�eZZneZeZdS)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��pool)�Callable�Iterable�Iterator�TypeVar�Union)�DEFAULT_POOLSIZE�S�TNTFi��ccsBz"|VW|��|��|��n|��|��|��0dS)z>Return a context manager making sure the pool closes properly.N)�close�joinZ	terminater�r�@/usr/lib/python3.9/site-packages/pip/_internal/utils/parallel.py�closing.s
�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.
    )�map)�func�iterable�	chunksizerrr�
_map_fallback<srcCs<tt���}|�|||�Wd�S1s.0YdS)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_multiprocessGs	rcCs>ttt���}|�|||�Wd�S1s00YdS)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�
ThreadPoolr
rrrrr�_map_multithreadTs	r )r)r)r)�__doc__�__all__�
contextlibrZmultiprocessingrrrZmultiprocessing.dummyr�typingrr	r
rrZpip._vendor.requests.adaptersr
rrZmultiprocessing.synchronize�ImportErrorZ
LACK_SEM_OPENZTIMEOUTrrrr rrrrrr�<module>s2