JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbrў fu[c@sfdgZddlZddlZddlZddlZddlZddlmZmZm Z ddl m Z m Z dZ dZdZejZddZd d ZGd d d eZefed dZGdddeZGdddeZeZGdddeZGdddeZGdddeZGdddeZdS(uPooliN(uProcessu cpu_countu TimeoutError(uFinalizeudebugiicCstt|S(N(ulistumap(uargs((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyumapstar'sumapstarcCsttj|d|dS(Nii(ulistu itertoolsustarmap(uargs((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu starmapstar*su starmapstarcsD|EeZdZdZfddZddZddZS(uMaybeEncodingErroruVWraps possible unpickleable errors, so they can be safely sent through the socket.csAt||_t||_tt|j|j|jdS(N(urepruexcuvalueusuperuMaybeEncodingErroru__init__(uselfuexcuvalue(u __class__(u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu__init__5suMaybeEncodingError.__init__cCsd|j|jfS(Nu(Error sending result: '%s'. Reason: '%s'(uvalueuexc(uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu__str__:s uMaybeEncodingError.__str__cCsdt|S(Nu(ustr(uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu__repr__>suMaybeEncodingError.__repr__(u__name__u __module__u __qualname__u__doc__u__init__u__str__u__repr__(u __locals__((u __class__u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyuMaybeEncodingError1s uMaybeEncodingErrorc)Cs|j}|j}t|dr>|jj|jjn|dk rW||nd}xT|dks~|r||kry |}Wn#ttfk rt dPYnX|dkrt dPn|\} } } } } yd| | | f}Wn1t k r,}zd |f}WYdd}~XnXy|| | |fWn_t k r}z?t ||d}t d||| | d |ffWYdd}~XnX|d7}q`Wt d|dS( Nu_writeriu)worker got EOFError or IOError -- exitinguworker got sentinel -- exitingiu0Possible encoding error while sending result: %suworker exiting after %d tasksTF(uputugetuhasattru_writerucloseu_readeruNoneuEOFErroruIOErrorudebuguTrueu ExceptionuFalseuMaybeEncodingError(uinqueueuoutqueueu initializeruinitargsumaxtasksuputugetu completedutaskujobuiufuncuargsukwdsuresultueuwrapped((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyuworkerBs>     !    ,uworkercBs|EeZdZdZeZd7d7fd7ddZddZddZdd Z d d Z fid d Z d7ddZ d7ddZ d7d7d7ddZdddZdddZfid7d7ddZd7d7d7ddZd7d7d7ddZedd Zed!d"Zed#d$Zed%d&Zd'd(Zd)d*Zd+d,Zd-d.Zed/d0Zed1d2Zd3d4Z d5d6Z!d7S(8uPooluS Class which supports an async version of applying functions to arguments. cCs-|jtj|_i|_t|_||_||_||_ |dkr}y t }Wq}t k ryd}Yq}Xn|dkrt dn|dk rt| rtdn||_g|_|jtjdtjd|f|_d|j_t|j_|jjtjdtjd|j|j|j|j|jf|_d|j_t|j_|jjtjdtjd|j|j |jf|_!d|j!_t|j!_|j!jt"||j#d|j|j$|j|j|j|j|j!|jfdd|_%dS( Niu&Number of processes must be at least 1uinitializer must be a callableutargetuargsu exitpriorityiT(&u _setup_queuesuqueueuQueueu _taskqueueu_cacheuRUNu_stateu_maxtasksperchildu _initializeru _initargsuNoneu cpu_countuNotImplementedErroru ValueErrorucallableu TypeErroru _processesu_poolu_repopulate_poolu threadinguThreaduPoolu_handle_workersu_worker_handleruTrueudaemonustartu _handle_tasksu _quick_putu _outqueueu _task_handleru_handle_resultsu _quick_getu_result_handleruFinalizeu_terminate_poolu_inqueueu _terminate(uselfu processesu initializeruinitargsumaxtasksperchild((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu__init__rsX                              u Pool.__init__cCswd}xjttt|jD]M}|j|}|jdk r"td||jd}|j|=q"q"W|S(uCleanup after any worker processes which have exited due to reaching their specified lifetime. Returns True if any workers were cleaned up. ucleaning up worker %dFNT( uFalseureversedurangeulenu_pooluexitcodeuNoneudebugujoinuTrue(uselfucleaneduiuworker((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_join_exited_workerss"  uPool._join_exited_workersc Csxt|jt|jD]}|jdtd|j|j|j|j |j f}|jj ||j j dd|_ d|_|jtdqWdS(uBring the number of pool processes up to the specified number, for use after reaping workers which have exited. utargetuargsuProcessu PoolWorkeru added workerNT(urangeu _processesulenu_pooluProcessuworkeru_inqueueu _outqueueu _initializeru _initargsu_maxtasksperchilduappendunameureplaceuTrueudaemonustartudebug(uselfuiuw((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_repopulate_pools#   uPool._repopulate_poolcCs|jr|jndS(uEClean up any exited workers and start replacements for them. N(u_join_exited_workersu_repopulate_pool(uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_maintain_pools uPool._maintain_poolcCsPddlm}||_||_|jjj|_|jjj|_ dS(Ni(u SimpleQueue( uqueuesu SimpleQueueu_inqueueu _outqueueu_writerusendu _quick_putu_readerurecvu _quick_get(uselfu SimpleQueue((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu _setup_queuess   uPool._setup_queuescCs|j|||jS(u6 Equivalent of `func(*args, **kwds)`. (u apply_asyncuget(uselfufuncuargsukwds((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyuapplysu Pool.applycCs|j||t|jS(ux Apply `func` to each element in `iterable`, collecting the results in a list that is returned. (u _map_asyncumapstaruget(uselfufuncuiterableu chunksize((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyumapsuPool.mapcCs|j||t|jS(u Like `map()` method but the elements of the `iterable` are expected to be iterables as well and will be unpacked as arguments. Hence `func` and (a, b) becomes func(a, b). (u _map_asyncu starmapstaruget(uselfufuncuiterableu chunksize((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyustarmapsu Pool.starmapcCs|j||t|||S(u= Asynchronous version of `starmap()` method. (u _map_asyncu starmapstar(uselfufuncuiterableu chunksizeucallbackuerror_callback((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu starmap_asyncsuPool.starmap_asyncics|jtkrtdn|dkrrt|j|jjfddt|DjfSt j ||}t|j|jjfddt|DjfddDSdS(uP Equivalent of `map()` -- can be MUCH slower than `Pool.map()`. uPool not runningic3s0|]&\}}j||fifVqdS(N(u_job(u.0uiux(ufuncuresult(u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu suPool.imap..c3s0|]&\}}j|t|fifVqdS(N(u_jobumapstar(u.0uiux(uresult(u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu scss"|]}|D] }|Vq qdS(N((u.0uchunkuitem((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu sN( u_stateuRUNu ValueErroru IMapIteratoru_cacheu _taskqueueuputu enumerateu _set_lengthuPoolu _get_tasks(uselfufuncuiterableu chunksizeu task_batches((ufuncuresultu9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyuimaps u Pool.imapcs|jtkrtdn|dkrrt|j|jjfddt|DjfSt j ||}t|j|jjfddt|DjfddDSdS(uL Like `imap()` method but ordering of results is arbitrary. uPool not runningic3s0|]&\}}j||fifVqdS(N(u_job(u.0uiux(ufuncuresult(u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu su&Pool.imap_unordered..c3s0|]&\}}j|t|fifVqdS(N(u_jobumapstar(u.0uiux(uresult(u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu scss"|]}|D] }|Vq qdS(N((u.0uchunkuitem((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu sN( u_stateuRUNu ValueErroruIMapUnorderedIteratoru_cacheu _taskqueueuputu enumerateu _set_lengthuPoolu _get_tasks(uselfufuncuiterableu chunksizeu task_batches((ufuncuresultu9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyuimap_unordered s uPool.imap_unorderedcCsb|jtkrtdnt|j||}|jj|jd|||fgdf|S(u; Asynchronous version of `apply()` method. uPool not runningN( u_stateuRUNu ValueErroru ApplyResultu_cacheu _taskqueueuputu_jobuNone(uselfufuncuargsukwdsucallbackuerror_callbackuresult((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu apply_asyncs +uPool.apply_asynccCs|j||t|||S(u9 Asynchronous version of `map()` method. (u _map_asyncumapstar(uselfufuncuiterableu chunksizeucallbackuerror_callback((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu map_async(suPool.map_asyncc s|jtkrtdnt|ds<t|}n|d krtt|t|jd\}}|r|d7}qnt|dkrd}nt j |||}t |j |t||d||j jfddt|Dd fS( uY Helper function to implement map, starmap and their async counterparts. uPool not runningu__len__iiiuerror_callbackc3s0|]&\}}j||fifVqdS(N(u_job(u.0uiux(umapperuresult(u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu Dsu"Pool._map_async..N(u_stateuRUNu ValueErroruhasattrulistuNoneudivmodulenu_pooluPoolu _get_tasksu MapResultu_cacheu _taskqueueuputu enumerate( uselfufuncuiterableumapperu chunksizeucallbackuerror_callbackuextrau task_batches((umapperuresultu9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu _map_async0s  (  uPool._map_asynccCsotj}xB|jtks6|jrP|jtkrP|jtjdqW|j j dt ddS(Ng?uworker handler exiting( u threadingucurrent_threadu_stateuRUNu_cacheu TERMINATEu_maintain_poolutimeusleepu _taskqueueuputuNoneudebug(upooluthread((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_handle_workersHs  * uPool._handle_workerscCstj}xt|jdD]\}}d }xt|D]\}} |jratdPny|| Wq>tk r} zN| dd\} } y|| j | d | fWnt k rYnXWYdd} ~ Xq>Xq>W|rtd||dqqPqWtdy@td|j dtdx|D]} |dqBWWnt k rutdYnXtd dS( Niu'task handler found thread._state != RUNiudoing set_length()utask handler got sentinelu/task handler sending sentinel to result handleru(task handler sending sentinel to workersu/task handler got IOError when sending sentinelsutask handler exitingiF(u threadingucurrent_threaduiterugetuNoneu enumerateu_stateudebugu Exceptionu_setuFalseuKeyErroruputuIOError(u taskqueueuputuoutqueueupoolucacheuthreadutasksequ set_lengthuiutaskueujobuindup((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu _handle_tasksUs<           uPool._handle_taskscCstj}xy |}Wn&ttfk rDtddSYnX|jr\tdPn|dkrvtdPn|\}}}y||j||Wqtk rYqXqx|r^|jt kr^y |}Wn&ttfk rtddSYnX|dkrtdqn|\}}}y||j||Wqtk rZYqXqWt |drtdy5x.t dD] }|j j sPn|qWWqttfk rYqXntdt||jdS( Nu.result handler got EOFError/IOError -- exitingu,result handler found thread._state=TERMINATEuresult handler got sentinelu&result handler ignoring extra sentinelu_readeru"ensuring that outqueue is not fulli u7result handler exiting: len(cache)=%s, thread._state=%s(u threadingucurrent_threaduIOErroruEOFErrorudebugu_stateuNoneu_setuKeyErroru TERMINATEuhasattrurangeu_readerupollulen(uoutqueueugetucacheuthreadutaskujobuiuobj((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_handle_resultssV                 uPool._handle_resultsccsCt|}x0ttj||}|s1dS||fVqdS(N(uiterutupleu itertoolsuislice(ufuncuitusizeux((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu _get_taskss  uPool._get_taskscCstddS(Nu:pool objects cannot be passed between processes or pickled(uNotImplementedError(uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu __reduce__suPool.__reduce__cCs5td|jtkr1t|_t|j_ndS(Nu closing pool(udebugu_stateuRUNuCLOSEu_worker_handler(uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyucloses  u Pool.closecCs-tdt|_t|j_|jdS(Nuterminating pool(udebugu TERMINATEu_stateu_worker_handleru _terminate(uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu terminates   uPool.terminatecCsStd|jj|jj|jjx|jD]}|jq;WdS(Nu joining pool(udebugu_worker_handlerujoinu _task_handleru_result_handleru_pool(uselfup((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyujoins     u Pool.joincCsWtd|jjx9|jrR|jjrR|jjtjdqWdS(Nu7removing tasks from inqueue until task handler finishedi( udebugu_rlockuacquireuis_aliveu_readerupollurecvutimeusleep(uinqueueu task_handlerusize((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_help_stuff_finishs    uPool._help_stuff_finishc Cstdt|_t|_td|j||t|t|_|jdtdtj|k r~|j n|rt |ddrtdx-|D]"} | j dkr| j qqWntdtj|k r|j ntdtj|k r#|j n|rt |ddrtd x;|D]0} | j rMtd | j| j qMqMWndS( Nufinalizing poolu&helping task handler/workers to finishujoining worker handleriu terminateuterminating workersujoining task handlerujoining result handlerujoining pool workersucleaning up worker %d(udebugu TERMINATEu_stateu_help_stuff_finishulenuputuNoneu threadingucurrent_threadujoinuhasattruexitcodeu terminateuis_aliveupid( uclsu taskqueueuinqueueuoutqueueupooluworker_handleru task_handleruresult_handlerucacheup((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu_terminate_pools6                 uPool._terminate_poolcCs|S(N((uself((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu __enter__suPool.__enter__cCs|jdS(N(u terminate(uselfuexc_typeuexc_valuexc_tb((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyu__exit__su Pool.__exit__N("u__name__u __module__u __qualname__u__doc__uProcessuNoneu__init__u_join_exited_workersu_repopulate_poolu_maintain_poolu _setup_queuesuapplyumapustarmapu starmap_asyncuimapuimap_unorderedu apply_asyncu map_asyncu _map_asyncu staticmethodu_handle_workersu _handle_tasksu_handle_resultsu _get_tasksu __reduce__ucloseu terminateujoinu_help_stuff_finishu classmethodu_terminate_poolu __enter__u__exit__(u __locals__((u9/opt/alt/python33/lib64/python3.3/multiprocessing/pool.pyuPoollsB :       *:     . cBsb|EeZdZddZddZddZd ddZd d d Zd d Z d S(u ApplyResultcCsJtj|_tt|_||_||_||_|||j s.         *&%I