Viewing File: /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/base_events.cpython-35.opt-2.pyc



]
@sddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lmZd
gZdZdZeeefZd
dZ ddZ!ddZ"ddZ#ddZ$ddZ%dddej&ddddddZ'dd Z(Gd!d"d"ej)Z*Gd#d
d
ej+Z,dS)$N)compat)
coroutines)events)futures)tasks)	coroutine)logger
BaseEventLoopdg?cCsH|j}tj|r:t|jtjr:t|jSt|SdS)N)		_callbackinspectZismethod
isinstance__self__rTaskreprstr)handlecbr0/opt/alt/python35/lib64/python3.5/base_events.py_format_handle:s	$
rcCs4|tjkrdS|tjkr&dSt|SdS)Nz<pipe>z<stdout>)
subprocessPIPESTDOUTr)fdrrr_format_pipeCs
rcCs`ttdstdn>y|jtjtjdWntk
r[tdYnXdS)NSO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket
ValueError
setsockopt
SOL_SOCKETrOSError)sockrrr_set_reuseportLs
r%cCs|jtj@tjkS)N)typerSOCK_STREAM)r$rrr_is_stream_socketWsr(cCs|jtj@tjkS)N)r&r
SOCK_DGRAM)r$rrr_is_dgram_socket^sr*cCsttdsdS|dtjtjhks:|dkr>dS|tjkrYtj}n|tjkrttj}ndS|dkrd}nwt|tr|dkrd}nSt|tr|dkrd}n/yt	|}Wnt
tfk
rdSYnX|tjkrAtj
g}ttdrJ|jtjn	|g}t|trh|jd}d|krxdSxP|D]H}y-tj|||||d||ffSWqtk
rYqXqWdS)N	inet_ptonrAF_INET6Zidna%)rrIPPROTO_TCPIPPROTO_UDPr'r)rbytesrint	TypeErrorr 	AF_UNSPECAF_INETappendr.decoder+r#)hostportfamilyr&protoZafsafrrr_ipaddr_infoesH					

	r>r;r&r<flagsc
Cs|dd\}}t|||||}|dk	rZ|j}	|	j|g|	S|j||d|d|d|d|SdS)Nr;r&r<r?)r>
create_future
set_resultgetaddrinfo)
addressr;r&r<r?loopr9r:infofutrrr_ensure_resolvedsrHcCs=|j}t|tr,t|tr,dS|jjdS)N)
_exceptionr
BaseException	Exception_loopstop)rGexcrrr_run_until_complete_cbs
	rOc@sjeZdZddZddZddZddZd	d
ZddZe	d
dZ
dS)ServercCs(||_||_d|_g|_dS)Nr)rLsockets
_active_count_waiters)selfrErQrrr__init__s			zServer.__init__cCsd|jj|jfS)Nz<%s sockets=%r>)	__class____name__rQ)rTrrr__repr__szServer.__repr__cCs|jd7_dS)Nr)rR)rTrrr_attachszServer._attachcCs;|jd8_|jdkr7|jdkr7|jdS)Nrr)rRrQ_wakeup)rTrrr_detachszServer._detachcCs`|j}|dkrdSd|_x|D]}|jj|q)W|jdkr\|jdS)Nr)rQrLZ
_stop_servingrRrZ)rTrQr$rrrcloses		
zServer.closecCs@|j}d|_x'|D]}|js|j|qWdS)N)rSdonerB)rTwaiterswaiterrrrrZs
		
zServer._wakeupccsN|jdks|jdkr"dS|jj}|jj||EdHdS)N)rQrSrLrAr7)rTr_rrrwait_closeds
zServer.wait_closedN)rW
__module____qualname__rUrXrYr[r\rZrr`rrrrrPs
rPc@seZdZddZddZddZddZd	d
ZddZd
dd
dd
ddZ	d
dddd
dd
dd
ddZ
d
d
d
ddZd
d
ddZd
d
ddZ
ed
ddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zed)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zejrd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPdQdPdRdPdSdPdTdUZ*dPdVdWZ+ed
d
dXd
dOdPdRdPdSdPdYd
dZd
dd
d[d\Z,edd]d^Z-ed
d
dOdPdRdPdSdPd_d
d`d
dad
dYd
dbdcZ.edddeZ/ed
d
dOe0j1dSe0j2dYd
dfdgdXd
d_d
d`d
dhdiZ3edXd
djdkZ4edldmZ5edndoZ6dpdqZ7edre8j9dse8j9dte8j9duddvdwdxdPdydzZ:edre8j9dse8j9dte8j9duddvddxdPd{d|Z;d}d~Z<ddZ=ddZ>ddZ?ddZ@ddZAddZBddZCddZDddZEddZFd
S)r
cCsd|_d|_d|_tj|_g|_d|_d|_d|_	t
jdj|_
d|_|jtjjottjjdd|_d|_d|_d|_ttdrtj|_n	d|_d|_dS)NrF	monotonicZPYTHONASYNCIODEBUGg?get_asyncgen_hooks) _timer_cancelled_count_closed	_stoppingcollectionsdeque_ready
_scheduled_default_executorZ
_internal_fds
_thread_idtimeget_clock_infoZ
resolution_clock_resolution_exception_handler	set_debugsysr?ignore_environmentboolosenvirongetslow_callback_duration_current_handle
_task_factory_coroutine_wrapper_setrweakrefWeakSet
_asyncgens_asyncgens_shutdown_called)rTrrrrUs(													zBaseEventLoop.__init__cCs,d|jj|j|j|jfS)Nz"<%s running=%s closed=%s debug=%s>)rVrW
is_running	is_closed	get_debug)rTrrrrXszBaseEventLoop.__repr__cCstjd|S)NrE)rFuture)rTrrrrAszBaseEventLoop.create_futurecCsZ|j|jdkrDtj|d|}|jrV|jd=n|j||}|S)NrEr)
_check_closedr{rr_source_traceback)rTcoroZtaskrrrcreate_tasks
	
zBaseEventLoop.create_taskcCs2|dk	r%t|r%td||_dS)Nz'task factory must be a callable or None)callabler4r{)rTfactoryrrrset_task_factory#s
zBaseEventLoop.set_task_factorycCs|jS)N)r{)rTrrrget_task_factory1szBaseEventLoop.get_task_factoryNextraservercCs
tdS)N)NotImplementedError)rTr$protocolr_rrrrr_make_socket_transport5sz$BaseEventLoop._make_socket_transportserver_sideFserver_hostnamec	Cs
tdS)N)r)	rTZrawsockr
sslcontextr_rrrrrrr_make_ssl_transport:sz!BaseEventLoop._make_ssl_transportcCs
tdS)N)r)rTr$rrDr_rrrr_make_datagram_transport@sz&BaseEventLoop._make_datagram_transportcCs
tdS)N)r)rTpiperr_rrrr_make_read_pipe_transportEsz'BaseEventLoop._make_read_pipe_transportcCs
tdS)N)r)rTrrr_rrrr_make_write_pipe_transportJsz(BaseEventLoop._make_write_pipe_transportc	
Ks
tdS)N)r)
rTrargsshellstdinstdoutstderrbufsizerkwargsrrr_make_subprocess_transportOsz(BaseEventLoop._make_subprocess_transportcCs
tdS)N)r)rTrrr_write_to_selfVszBaseEventLoop._write_to_selfcCs
tdS)N)r)rT
event_listrrr_process_events_szBaseEventLoop._process_eventscCs|jrtddS)NzEvent loop is closed)rfRuntimeError)rTrrrrcs	zBaseEventLoop._check_closedcCs=|jj||js9|j|j|jdS)N)rdiscardrracloser)rTagenrrr_asyncgen_finalizer_hookgsz&BaseEventLoop._asyncgen_finalizer_hookcCs<|jr(tjdj|td||jj|dS)NzNasynchronous generator {!r} was scheduled after loop.shutdown_asyncgens() callsource)rwarningswarnformatResourceWarningradd)rTrrrr_asyncgen_firstiter_hookos	
z&BaseEventLoop._asyncgen_firstiter_hookccsd|_|jdks(t|jr,dSt|j}|jjtjdd|Dddd|}|EdH}xTt||D]C\}}t|t	r|j
ddj|d|d	|iqWdS)
NTcSsg|]}|jqSr)r).0Zagrrr
<listcomp>s	z4BaseEventLoop.shutdown_asyncgens.<locals>.<listcomp>Zreturn_exceptionsrEmessagez?an error occurred during closing of asynchronous generator {!r}	exceptionZasyncgen)rrlenlistclearrgatherziprrKcall_exception_handlerr)rTZ
closing_agensZ
shutdown_cororesultsresultrrrrshutdown_asyncgensxs"	
		z BaseEventLoop.shutdown_asyncgenscCs|j|jr"tdtjdk	r@td|j|jtj|_	|j
dk	rtj}tj
d|jd|jz,tj|x|j|jrPqWWdd|_d|_	tjd|jd|j
dk	r
tj
|XdS)Nz"This event loop is already runningz7Cannot run the event loop while another loop is runningZ	firstiter	finalizerF)rrrrZ_get_running_loop_set_coroutine_wrapper_debug	threading	get_identrmrrsrdZset_asyncgen_hooksrrZ_set_running_loop	_run_oncerg)rTZold_agen_hooksrrrrun_forevers0
	


				

zBaseEventLoop.run_forevercCs|jtj|}tj|d|}|r>d|_|jtzIy|jWn4|r|j	r|j
r|jYnXWd|jtX|j	st
d|jS)NrEFz+Event loop stopped before Future completed.)rrZisfuturerZ
ensure_futureZ_log_destroy_pendingadd_done_callbackrOrr]	cancelledrZremove_done_callbackrr)rTfutureZnew_taskrrrrun_until_completes 
	

z BaseEventLoop.run_until_completecCs
d|_dS)NT)rg)rTrrrrMszBaseEventLoop.stopcCs|jrtd|jr%dS|jr>tjd|d|_|jj|jj|j	}|dk	rd|_	|j
dddS)Nz!Cannot close a running event loopzClose %rTwaitF)rrrfrr	debugrjrrkrlshutdown)rTexecutorrrrr\s			

		zBaseEventLoop.closecCs|jS)N)rf)rTrrrrszBaseEventLoop.is_closedcCs:|js6tjd|t|js6|jdS)Nzunclosed event loop %r)rrrrrr\)rTrrr__del__szBaseEventLoop.__del__cCs
|jdk	S)N)rm)rTrrrrszBaseEventLoop.is_runningcCs
tjS)N)rnrc)rTrrrrnszBaseEventLoop.timecGs6|j|j|||}|jr2|jd=|S)Nrr)call_atrnr)rTdelaycallbackrtimerrrr
call_laters	
zBaseEventLoop.call_latercGsx|j|jr-|j|j|dtj||||}|jrX|jd=tj|j	|d|_	|S)NrrTr)
rr
_check_thread_check_callbackrZTimerHandlerheapqheappushrk)rTwhenrrrrrrr#s
	
	
	zBaseEventLoop.call_atcGsV|j|jr-|j|j|d|j||}|jrR|jd=|S)N	call_soonrr)rrrr
_call_soonr)rTrrrrrrr3s

	
	
zBaseEventLoop.call_sooncCs[tj|stj|r3tdj|t|sWtdj||dS)Nz#coroutines cannot be used with {}()z0a callable object was expected by {}(), got {!r})rZiscoroutineZiscoroutinefunctionr4rr)rTrmethodrrrrFszBaseEventLoop._check_callbackcCs<tj|||}|jr(|jd=|jj||S)Nrr)rZHandlerrjr7)rTrrrrrrrQs
	
zBaseEventLoop._call_sooncCs>|jdkrdStj}||jkr:tddS)NzMNon-thread-safe operation invoked on an event loop other than the current one)rmrrr)rTZ	thread_idrrrrXs	zBaseEventLoop._check_threadcGsV|j|jr#|j|d|j||}|jrH|jd=|j|S)Ncall_soon_threadsaferr)rrrrrr)rTrrrrrrris
		

z"BaseEventLoop.call_soon_threadsafecGs{|j|jr#|j|d|dkr\|j}|dkr\tjj}||_tj|j||d|S)Nrun_in_executorrE)	rrrrl
concurrentrThreadPoolExecutorZwrap_futuresubmit)rTrfuncrrrrrts
			zBaseEventLoop.run_in_executorcCs
||_dS)N)rl)rTrrrrset_default_executorsz"BaseEventLoop.set_default_executorcCsd||fg}|r*|jd||rA|jd||rX|jd||ro|jd|dj|}tjd||j}tj||||||}	|j|}
d||
d	|	f}|
|jkrtj|n
tj||	S)
Nz%s:%rz	family=%rztype=%rzproto=%rzflags=%rz, zGet address info %sz(Getting address info %s took %.3f ms: %rg@@)	r7joinr	rrnrrCryrF)rTr9r:r;r&r<r?msgt0Zaddrinfodtrrr_getaddrinfo_debugs(
z BaseEventLoop._getaddrinfo_debugr;rr&r<r?c	CsW|jr.|jd|j||||||S|jdtj||||||SdS)N)rrrrrC)rTr9r:r;r&r<r?rrrrCs
	zBaseEventLoop.getaddrinfocCs|jdtj||S)N)rrgetnameinfo)rTZsockaddrr?rrrrszBaseEventLoop.getnameinfosslr$
local_addrc#s#|
dk	r|rtd|
dkrI|rI|sCtd|}
|dk	sa|dk	r|dk	rytdt||fd|dtjd|d|d|}|g}|	dk	rt|	d|dtjd|d|d|}
|j|
nd}
tj|d|EdH|j}|s:td	|
dk	rd|
j}|sdtd	g}xU|D]\}}}}}y
tjd|d|d|}|j	d
|
dk	rax|D]\}}}}}y|j
|PWqtk
rI}z9t|jdj||j
j}|j|WYdd}~XqXqW|jd}wq|jr}tjd|||j||EdHWnhtk
r}z(|dk	r|j|j|WYdd}~Xqq|dk	r|jYqqXPqqWt|d
kr"|dqt|dtfdd|Dr[|dtdjdjdd|Dn9|dkrtdt|stdj||j||||
EdH\}}|jr|jd}tjd|||||||fS)Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a hostz8host/port and sock can not be specified at the same timer;r&r<r?rEz!getaddrinfo() returned empty listFz2error while attempting to bind on address {!r}: {}zconnect %r to %rrrc3s!|]}t|kVqdS)N)r)rrN)modelrr	<genexpr>sz2BaseEventLoop.create_connection.<locals>.<genexpr>zMultiple exceptions: {}z, css|]}t|VqdS)N)r)rrNrrrrsz5host and port was not specified and no sock specifiedz&A Stream Socket was expected, got {!r}rz%r connected to %s:%r: (%r, %r))r rHrr'r7rrrr#setblockingbinderrnorstrerrorlowerr\rr	rsock_connectrrallrr(_create_connection_transportget_extra_info)rTprotocol_factoryr9r:rr;r<r?r$rrf1fsf2infosZladdr_infos
exceptionsr&ZcnamerD_laddrrN	transportrr)rrcreate_connections		

$
	



	%			zBaseEventLoop.create_connectionc
	cs|jd|}|j}|rjt|tr=dn|}|j||||d|d|}	n|j|||}	y
|EdHWn|	jYnX|	|fS)NFrr)rrArrurrr\)
rTr$rrrrrr_rrrrrr+s
	

z*BaseEventLoop._create_connection_transport
reuse_address
reuse_portallow_broadcastc#sT|
dk	rt|
s-tdj|
s]s]|s]|s]|s]|s]|s]|	rtddd|d|d|d|d|d	|	}d
jdd|jD}td
j||
jdd}
nps|dkrtd||fdff}ntj}xdfdffD]\}}|dk	rDt	|d|dt
jd|d|d|EdH}|stdxS|D]K\}}}}}||f}||krddg||<||||<qWqDWfdd|jD}|s.tdg}|dkr^t
jdko[tjdk}xV|D]D\\}}\}}d}
d}
yt
j
d|dt
jd|}
|r|
jt
jt
jd|rt|
|	r|
jt
jt
jd|
jdr|
j|r<|j|
|EdH|}
Wnhtk
r}z(|
dk	rh|
j|j|WYdd}~Xqe|
dk	r|
jYqeXPqeW|d|}|j}|j|
||
|}|jr%rtjd||ntjd||y
|EdHWn|jYnX||fS)Nz#A UDP Socket was expected, got {!r}rremote_addrr;r<r?rrrz, css-|]#\}}|rdj||VqdS)z{}={}N)r)rkvrrrrWsz9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>zNsocket modifier keyword arguments can not be used when sock is specified. ({})Frzunexpected address familyrr&rEz!getaddrinfo() returned empty listcsNg|]D\}}r(|ddkp;o;|ddks||fqS)rNrr)rkeyZ	addr_pair)rrrrrxs		z:BaseEventLoop.create_datagram_endpoint.<locals>.<listcomp>zcan not get address informationposixcygwinz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))NN) r*r rdictritemsrrhOrderedDictrHrr)r#rvnamersplatformr!r"SO_REUSEADDRr%SO_BROADCASTrrr\r7rArrr	rFr)rTrrrr;r<r?rrrr$ZoptsZproblemsZr_addrZaddr_pairs_infoZ
addr_infosidxaddrrZfamrZprorDrrZ
local_addressZremote_addressrNrr_rr)rrrcreate_datagram_endpointCs	
	%"	






				


z&BaseEventLoop.create_datagram_endpointc
csQt||fd|dtjd|d|EdH}|sMtdj||S)Nr;r&r?rEz%getaddrinfo({!r}) returned empty list)rHrr'r#r)rTr9r:r;r?rrrr_create_server_getaddrinfos	z(BaseEventLoop._create_server_getaddrinfobacklogrc #sdt|trtd|dk	s3dk	r|dk	rKtdttdd}|	dkrtjdkotj	dk}	g}|dkrdg}
n4t|t
st|tjr|g}
n|}
fdd	|
D}t
j|d
EdH}ttjj|}d}zWxJ|D]B}|\}}}}}ytj|||}Wn=tjk
rjrtjd|||d
dw=YnX|j||	r|jtjtjd|
rt|||kr!ttdr!|jtjtjdy|j|Wq=t k
r~}z*t |j!d||j"j#fWYdd}~Xq=Xq=Wd}Wd|sx|D]}|j$qWXnB|dkrtdt%|stdj&||g}t'|}xA|D]9}|j(||j)dj*|||||q
Wjr`tj+d||S)Nz*ssl argument must be an SSLContext or Nonez8host/port and sock can not be specified at the same timer.rrrr-c	s.g|]$}j|ddqS)r;r?)r)rr9)r;r?r:rTrrrs	z/BaseEventLoop.create_server.<locals>.<listcomp>rEFz:create_server() failed to create socket.socket(%r, %r, %r)exc_infoTIPPROTO_IPV6z0error while attempting to bind on address %r: %sz)Neither host/port nor sock were specifiedz&A Stream Socket was expected, got {!r}z
%r is serving),rrur4r getattrrrvrrsr
rrhIterablerrset	itertoolschain
from_iterableerrorrr	warningr7r!r"rr%rrIPV6_V6ONLYrr#rrrr\r(rrPlistenrZ_start_servingrF)rTrr9r:r;r?r$rrrrr.rQZhostsrrZ	completedresr=socktyper<	canonnamesaerrrr)r;r?r:rTr
create_servers	

		

0

	


	zBaseEventLoop.create_serverccst|s!tdj||j|||dddEdH\}}|jrx|jd}tjd|||||fS)Nz&A Stream Socket was expected, got {!r}r-rTrz%r handled: (%r, %r))r(r rrrrr	r)rTrr$rrrrrrconnect_accepted_socket.s
#	z%BaseEventLoop.connect_accepted_socketccs~|}|j}|j|||}y
|EdHWn|jYnX|jrttjd|j||||fS)Nz Read pipe %r connected: (%r, %r))rArr\rr	rfileno)rTrrrr_rrrrconnect_read_pipeEs	

		zBaseEventLoop.connect_read_pipeccs~|}|j}|j|||}y
|EdHWn|jYnX|jrttjd|j||||fS)Nz!Write pipe %r connected: (%r, %r))rArr\rr	rr()rTrrrr_rrrrconnect_write_pipeVs	

		z BaseEventLoop.connect_write_pipecCs|g}|dk	r,|jdt||dk	ra|tjkra|jdt|nF|dk	r|jdt||dk	r|jdt|tjdj|dS)Nzstdin=%szstdout=stderr=%sz	stdout=%sz	stderr=%s )r7rrrr	rr)rTrrrrrFrrr_log_subprocessgs	zBaseEventLoop._log_subprocessrrruniversal_newlinesrTrc
	kst|ttfs!td|r3td|sEtd|dkr]td|}
|jrd|}|j|||||j|
|d|||||	EdH}|jrtjd||||
fS)	Nzcmd must be a stringz universal_newlines must be Falsezshell must be Truerzbufsize must be 0zrun shell command %rTz%s: %r)	rr2rr rr,rr	rF)
rTrcmdrrrr-rrrr	debug_logrrrrsubprocess_shellts"		
#	zBaseEventLoop.subprocess_shellc	os	|rtd|r$td|dkr<td|f|	}x<|D]4}t|ttfsPtdt|jqPW|}
|jrd|}|j|||||j	|
|d|||||
EdH}|jrt
jd||||
fS)	Nz universal_newlines must be Falsezshell must be Falserzbufsize must be 0z8program arguments must be a bytes or text string, not %szexecute program %rFz%s: %r)r rrr2r4r&rWrr,rr	rF)rTrZprogramrrrr-rrrrZ
popen_argsargrr/rrrrsubprocess_execs*

		
	zBaseEventLoop.subprocess_execcCs|jS)N)rq)rTrrrget_exception_handlersz#BaseEventLoop.get_exception_handlercCs;|dk	r.t|r.tdj|||_dS)Nz/A callable object or None is expected, got {!r})rr4rrq)rThandlerrrrset_exception_handlers	z#BaseEventLoop.set_exception_handlerc	Cs|jd}|sd}|jd}|dk	rQt|||jf}nd}d|kr|jdk	r|jjr|jj|d<|g}xt|D]}|d
krq||}|dkrdjtj|}d}||j	7}nI|dkr=djtj|}d	}||j	7}nt
|}|jd
j||qWt
jdj|d|dS)Nrz!Unhandled exception in event looprFZsource_tracebackZhandle_tracebackr-z+Object created at (most recent call last):
z+Handle created at (most recent call last):
z{}: {}
r>rr)rxr&
__traceback__rzrsortedr	tracebackformat_listrstriprr7rr	r)	rTcontextrrrZ	log_linesrvaluetbrrrdefault_exception_handlers6
	
z'BaseEventLoop.default_exception_handlercCs|jdkrKy|j|Wqtk
rGtjdddYqXny|j||Wnptk
r}zPy#|jddd|d|iWn%tk
rtjdddYnXWYdd}~XnXdS)	Nz&Exception in default exception handlerrTrz$Unhandled error in exception handlerrr<zeException in default exception handler while handling an unexpected error in custom exception handler)rqr?rKr	r)rTr<rNrrrrs"

z$BaseEventLoop.call_exception_handlercCs!|jr
dS|jj|dS)N)
_cancelledrjr7)rTrrrr
_add_callbacks	zBaseEventLoop._add_callbackcCs|j||jdS)N)rAr)rTrrrr_add_callback_signalsafe's
z&BaseEventLoop._add_callback_signalsafecCs|jr|jd7_dS)Nr)rkre)rTrrrr_timer_handle_cancelled,s	z%BaseEventLoop._timer_handle_cancelledcCslt|j}|tkr|j|tkrg}x3|jD](}|jrYd|_q>|j|q>Wtj|||_d|_nJxG|jr|jdjr|jd8_tj	|j}d|_qWd}|j
s|jrd}n2|jr)|jdj}t
d||j}|jr|dkr|j}|jj|}|j|}|dkrtj}	n	tj}	t|}
|dkrtj|	d|d|
q+|
rtj|	d|d|d|
q+|dkr+tj|	d|d|dn|jj|}|j||j|j}xU|jr|jd}|j|krtPtj	|j}d|_|j
j|qNWt|j
}xt|D]}
|j
j}|jrq|jrTz[||_|j}|j|j|}||jkrCtjd	t||Wdd|_Xq|jqWd}dS)
NFrrg?zpoll took %.3f ms: %s eventsg@@z$poll %.3f ms took %.3f ms: %s eventsz"poll %.3f ms took %.3f ms: timeoutzExecuting %s took %.3f seconds) rrk_MIN_SCHEDULED_TIMER_HANDLESre%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr@r7rheapifyheappoprjrgZ_whenmaxrnr	_selectorselectloggingINFODEBUGr	logrrprangepopleftrzZ_runryrr)rTZsched_countZ
new_scheduledrtimeoutrrrrlevelZneventend_timeZntodoirrrr1s
		
	
					

				
	
zBaseEventLoop._run_oncecCsytj}tj}Wntk
r.dSYnXt|}|j|krNdStj}|}|r|d|fkrtj	d|t
q||d|_n<|d|fkrtj	d|t
n|dd|_dS)Nz[loop.set_debug(True): cannot set debug coroutine wrapper; another wrapper is already set %rTzWloop.set_debug(False): cannot unset debug coroutine wrapper; another wrapper was set %rF)rsset_coroutine_wrapperget_coroutine_wrapperAttributeErrorrur|rZ
debug_wrapperrrRuntimeWarning)rTenabledZset_wrapperZget_wrapperwrapperZcurrent_wrapperrrrrs.	

			

z$BaseEventLoop._set_coroutine_wrappercCs|jS)N)r)rTrrrrszBaseEventLoop.get_debugcCs&||_|jr"|j|dS)N)rrr)rTrYrrrrrs	zBaseEventLoop.set_debug)GrWrarbrUrXrArrrrrrrrrrrrrrrrrrrMr\rrZPY34rrrnrrrrrrrrrrrCrrrrrrr5
AI_PASSIVEr&r'r)r*r,rrr0r2r3r5r?rrArBrCrrrrrrrrrr
s!		%		!		u				_
	,2c!)-rhconcurrent.futuresrrr
rrKrvrrrrnr9rsrr}r-rrrrrrrNr	__all__rDrEBrokenPipeErrorConnectionResetErrorConnectionAbortedErrorZ_FATAL_ERROR_IGNORErrr%r(r*r>r'rHrOZAbstractServerrPZAbstractEventLoopr
rrrr<module>sJ			=

/
Back to Directory File Manager