JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr Yf)@sWddlZddlZddlZddlmZgZGdddeZGdddeZGdd d eZ Gd d d eZ Gd d d e Z Gdddej ZGddde ZeddeeDe_ejdkrGdddej ZGdddej ZGdddej ZGddde ZGddde ZGdd d e Zd!ed"ed#eiZeed!ZnNGd$ddej ZGd%dde Zd"eiZeed"Zd&d'ZejZd(d)Zd*d+Zd,d-Z dS).N)processc@seZdZdS) ProcessErrorN)__name__ __module__ __qualname__rrZ&d S)? BaseContextcCs/tj}|dkr'tdn|SdS)z(Returns the number of CPUs in the systemNzcannot determine number of cpus)os cpu_countNotImplementedError)selfZnumrrr r's  zBaseContext.cpu_countcCs3ddlm}|d|j}|j|S)zReturns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects. r) SyncManagerctx)Zmanagersr get_contextstart)rrmrrr Manager/s zBaseContext.ManagerTcCsddlm}||S)z1Returns two connection object connected by a piper)Pipe) connectionr)rZduplexrrrr r:szBaseContext.PipecCs#ddlm}|d|jS)z#Returns a non-recursive lock objectr)Lockr) synchronizerr)rrrrr r?szBaseContext.LockcCs#ddlm}|d|jS)zReturns a recursive lock objectr)RLockr)rrr)rrrrr rDszBaseContext.RLockNcCs&ddlm}||d|jS)zReturns a condition objectr) Conditionr)rrr)rlockrrrr rIszBaseContext.ConditionrcCs&ddlm}||d|jS)zReturns a semaphore objectr) Semaphorer)rrr)rvaluerrrr rNszBaseContext.SemaphorecCs&ddlm}||d|jS)z"Returns a bounded semaphore objectr)BoundedSemaphorer)rr!r)rr r!rrr r!SszBaseContext.BoundedSemaphorecCs#ddlm}|d|jS)zReturns an event objectr)Eventr)rr"r)rr"rrr r"XszBaseContext.EventcCs,ddlm}||||d|jS)zReturns a barrier objectr)Barrierr)rr#r)rZpartiesactionZtimeoutr#rrr r#]szBaseContext.BarrierrcCs&ddlm}||d|jS)zReturns a queue objectr)Queuer)queuesr%r)rmaxsizer%rrr r%bszBaseContext.QueuecCs&ddlm}||d|jS)zReturns a queue objectr) JoinableQueuer)r&r(r)rr'r(rrr r(gszBaseContext.JoinableQueuecCs#ddlm}|d|jS)zReturns a queue objectr) SimpleQueuer)r&r)r)rr)rrr r)lszBaseContext.SimpleQueuecCs/ddlm}|||||d|jS)zReturns a process pool objectr)Poolcontext)Zpoolr*r)rZ processesZ initializerZinitargsZmaxtasksperchildr*rrr r*qszBaseContext.PoolcGsddlm}|||S)zReturns a shared objectr)RawValue) sharedctypesr,)rtypecode_or_typeargsr,rrr r,xszBaseContext.RawValuecCsddlm}|||S)zReturns a shared arrayr)RawArray)r-r0)rr.size_or_initializerr0rrr r0}szBaseContext.RawArrayrcGs/ddlm}|||d|d|jS)z$Returns a synchronized shared objectr)Valuerr)r-r2r)rr.rr/r2rrr r2szBaseContext.ValuecCs/ddlm}|||d|d|jS)z#Returns a synchronized shared arrayr)Arrayrr)r-r3r)rr.r1rr3rrr r3szBaseContext.ArraycCs<tjdkr8ttddr8ddlm}|dS)zCheck whether this is a fake forked process in a frozen executable. If so then run code specified by commandline and exit. win32frozenFr)freeze_supportN)sysplatformgetattrspawnr6)rr6rrr r6s!zBaseContext.freeze_supportcCsddlm}|S)zZReturn package logger -- if it does not already exist then it is created. r) get_logger)utilr;)rr;rrr r;szBaseContext.get_loggercCsddlm}||S)z8Turn on logging and add a handler which prints to stderrr) log_to_stderr)r<r=)rlevelr=rrr r=szBaseContext.log_to_stderrcCsddlm}dS)zVInstall support for sending connections and sockets between processes r)rN)r)rrrrr allow_connection_picklingsz%BaseContext.allow_connection_picklingcCsddlm}||dS)zSets the path to a python.exe or pythonw.exe binary used to run child processes instead of sys.executable when using the 'spawn' start method. Useful for people embedding Python. r)set_executableN)r:rA)r executablerArrr rAszBaseContext.set_executablecCsddlm}||dS)zkSet list of module names to try to load in forkserver process. This is really just a hint. r)set_forkserver_preloadN) forkserverrC)rZ module_namesrCrrr rCsz"BaseContext.set_forkserver_preloadc CsQ|dkr|Syt|}Wn"tk rBtd|YnX|j|S)Nzcannot find context for %r)_concrete_contextsKeyError ValueError_check_available)rmethodrrrr rs   zBaseContext.get_contextFcCs|jS)N)_name)r allow_nonerrr get_start_methodszBaseContext.get_start_methodcCstddS)Nz+cannot set start method of concrete context)rG)rrIforcerrr set_start_methodszBaseContext.set_start_methodcCsdS)Nr)rrrr rHszBaseContext._check_available)'rrrrr r r staticmethodrZcurrent_processZactive_childrenrrrrrrrr!r"r#r%r(r)r*r,r0r2r3r6r;r=r@rArCrrLrNrHrrrr r sF                r c@s(eZdZdZeddZdS)ProcessNcCstjjj|S)N)_default_contextrrP_Popen) process_objrrr rRszProcess._Popen)rrr _start_methodrOrRrrrr rPs rPcsaeZdZeZddZdfddZdddZdd d Zd d ZS) DefaultContextcCs||_d|_dS)N)rQ_actual_context)rr+rrr __init__s zDefaultContext.__init__NcsB|dkr.|jdkr'|j|_|jStj|SdS)N)rVrQsuperr)rrI) __class__rr rs   zDefaultContext.get_contextFcCsW|jdk r"| r"td|dkrA|rAd|_dS|j||_dS)Nzcontext has already been set)rV RuntimeErrorr)rrIrMrrr rNs   zDefaultContext.set_start_methodcCs/|jdkr%|rdS|j|_|jjS)N)rVrQrJ)rrKrrr rLs  zDefaultContext.get_start_methodcCsJtjdkrdgSddlm}|jr<dddgSddgSdS)Nr4r:r) reductionforkrD)r7r8r?r[HAVE_SEND_HANDLE)rr[rrr get_all_start_methodss   z$DefaultContext.get_all_start_methods) rrrrPrWrrNrLr^rr)rYr rUs  rUccs%|]}|ddkr|VqdS)r_Nr).0xrrr srbr4c@s(eZdZdZeddZdS) ForkProcessr\cCsddlm}||S)Nr)Popen)Z popen_forkrd)rSrdrrr rRszForkProcess._PopenN)rrrrTrOrRrrrr rcs rcc@s(eZdZdZeddZdS) SpawnProcessr:cCsddlm}||S)Nr)rd)Zpopen_spawn_posixrd)rSrdrrr rRszSpawnProcess._PopenN)rrrrTrOrRrrrr re s rec@s(eZdZdZeddZdS)ForkServerProcessrDcCsddlm}||S)Nr)rd)Zpopen_forkserverrd)rSrdrrr rRszForkServerProcess._PopenN)rrrrTrOrRrrrr rfs rfc@seZdZdZeZdS) ForkContextr\N)rrrrJrcrPrrrr rgs rgc@seZdZdZeZdS) SpawnContextr:N)rrrrJrerPrrrr rhs rhc@s(eZdZdZeZddZdS)ForkServerContextrDcCs)ddlm}|js%tddS)Nr)r[z%forkserver start method not available)r?r[r]rG)rr[rrr rH&s z"ForkServerContext._check_availableN)rrrrJrfrPrHrrrr ri#s rir\r:rDc@s(eZdZdZeddZdS)rer:cCsddlm}||S)Nr)rd)Zpopen_spawn_win32rd)rSrdrrr rR6szSpawnProcess._PopenN)rrrrTrOrRrrrr re4s c@seZdZdZeZdS)rhr:N)rrrrJrerPrrrr rh;s cCst|t_dS)N)rErQrV)rIrrr _force_start_methodHsrjcCsttddS)Nspawning_popen)r9_tlsrrrr get_spawning_popenQsrmcCs |t_dS)N)rlrk)popenrrr set_spawning_popenTsrocCs,tdkr(tdt|jdS)NzF%s objects should only be shared between processes through inheritance)rmrZtyper)objrrr assert_spawningWsrr)!rr7Z threadingr?r__all__ Exceptionrr r r objectr Z BaseProcessrPrUlistdirr8rcrerfrgrhrirErQrjZlocalrlrmrorrrrrr s@   ("