ok

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/parallel.pyc

�
x�_c@s�dZddgZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZer�dd
lmZmZmZmZmZddlmZeejejfZed�Zed
�ZnyddlZWnek
reZnXeZdZed��Z dd�Z!dd�Z"dd�Z#esferse!Z$Z%ne"Z$e#Z%dS(sbConvenient 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.
tmap_multiprocesstmap_multithreadi����(tcontextmanager(tPool(tDEFAULT_POOLSIZE(tPY2(tmap(tMYPY_CHECK_RUNNING(tCallabletIterabletIteratortUniontTypeVar(tpooltStTNi��ccs/z	|VWd|j�|j�|j�XdS(s>Return a context manager making sure the pool closes properly.N(tclosetjoint	terminate(R
((sM/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/parallel.pytclosing4s
	

icCs
t||�S(s�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(tfunctiterablet	chunksize((sM/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/parallel.pyt
_map_fallbackBscCs/tt���}|j|||�SWdQXdS(s�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(RtProcessPooltimap_unordered(RRRR
((sM/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/parallel.pyt_map_multiprocessMs	cCs2ttt���}|j|||�SWdQXdS(s�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(Rt
ThreadPoolRR(RRRR
((sM/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/parallel.pyt_map_multithreadZs	(&t__doc__t__all__t
contextlibRtmultiprocessingRRtmultiprocessing.dummyRtpip._vendor.requests.adaptersRtpip._vendor.sixRtpip._vendor.six.movesRtpip._internal.utils.typingRttypingRR	R
RRR
RRtmultiprocessing.synchronizetImportErrortTruet
LACK_SEM_OPENtFalsetTIMEOUTRRRRRR(((sM/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/parallel.pyt<module>s8(






Zerion Mini Shell 1.0