o
    4˜ŽjúG  ã                )   @   s  d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
mZmZ d dlmZ d dlmZ d dlmZmZmZ ddlmZ dd	lmZmZmZ dd
lmZ ddlmZ ddlm Z m!Z! ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z] ddl^m_Z_ ddl`maZa ddlbmcZcmdZd ddlemfZfmgZgmhZh ddlimjZjmkZkmlZl ddlmmnZnmoZompZpmqZqmrZr ddlsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZm€Z€m�Z� ddl‚mƒZƒm„Z„m…Z…m†Z†m‡Z‡mˆZˆm‰Z‰mŠZŠm‹Z‹ ddlŒm�Z� ddlŽm�Z�m�Z�m‘Z‘m’Z’m“Z“m”Z”m•Z•m–Z–m—Z—m˜Z˜m™Z™ ddlšm›Z›mœZœm�Z� dZže�r€d dlŸm Z  nzd dlŸm Z  W n e¡�y”   e¢Z Y nw ej£de]dd� ee¤ Z¥ddddde¦ddddœ	d e e	e  B d!e¤e¥B dB d"e§dB d#eee B dB d$ejeej B dB d%e dB d&e
d' dB d(e§d)e¨dB d*e¨dB d+ed,dfd-d.„Z©d/eªd0 d1e j«d,dfd2d3„Z¬ddddd4d5de¦deaeaj­edddd6dd7œd e e	e  B d!e¤e¥B dB d"e§dB d#eee B dB d$ejeej B dB d8e®d9e®d%e dB d&e
d' dB d(e§d:e¯e d;e¤d<ej°dB d=e¨d)e¨dB d*e¨dB d>e¨d1e j«dB d+ed,df(d?d@„Z±dAe²e¤ d,dfdBdC„Z³e´dDk�re³ejµdd… ƒ dS dS )Eé    N)ÚArgumentParser)Ú	AwaitableÚCallableÚIterabler   )Úsuppress)Úimport_module)ÚTYPE_CHECKINGÚAnyÚcasté   )ÚAbstractAccessLogger)ÚAppKeyÚ
RequestKeyÚResponseKey)Úaccess_logger)ÚPathLike)ÚApplicationÚCleanupError);ÚHTTPAcceptedÚHTTPBadGatewayÚHTTPBadRequestÚHTTPClientErrorÚHTTPConflictÚHTTPCreatedÚ	HTTPErrorÚHTTPExceptionÚHTTPExpectationFailedÚHTTPFailedDependencyÚHTTPForbiddenÚ	HTTPFoundÚHTTPGatewayTimeoutÚHTTPGoneÚHTTPInsufficientStorageÚHTTPInternalServerErrorÚHTTPLengthRequiredÚHTTPMethodNotAllowedÚHTTPMisdirectedRequestÚHTTPMoveÚHTTPMovedPermanentlyÚHTTPMultipleChoicesÚ!HTTPNetworkAuthenticationRequiredÚHTTPNoContentÚHTTPNonAuthoritativeInformationÚHTTPNotAcceptableÚHTTPNotExtendedÚHTTPNotFoundÚHTTPNotImplementedÚHTTPNotModifiedÚHTTPOkÚHTTPPartialContentÚHTTPPaymentRequiredÚHTTPPermanentRedirectÚHTTPPreconditionFailedÚHTTPPreconditionRequiredÚHTTPProxyAuthenticationRequiredÚHTTPRedirectionÚHTTPRequestEntityTooLargeÚHTTPRequestHeaderFieldsTooLargeÚHTTPRequestRangeNotSatisfiableÚHTTPRequestTimeoutÚHTTPRequestURITooLongÚHTTPResetContentÚHTTPSeeOtherÚHTTPServerErrorÚHTTPServiceUnavailableÚHTTPSuccessfulÚHTTPTemporaryRedirectÚHTTPTooManyRequestsÚHTTPUnauthorizedÚHTTPUnavailableForLegalReasonsÚHTTPUnprocessableEntityÚHTTPUnsupportedMediaTypeÚHTTPUpgradeRequiredÚHTTPUseProxyÚHTTPVariantAlsoNegotiatesÚHTTPVersionNotSupportedÚNotAppKeyWarning)ÚFileResponse)ÚAccessLogger)Ú
middlewareÚnormalize_path_middleware)ÚPayloadAccessErrorÚRequestHandlerÚRequestPayloadError)ÚBaseRequestÚ	FileFieldÚRequest)ÚContentCodingÚResponseÚStreamResponseÚjson_bytes_responseÚjson_response)ÚAbstractRouteDefÚRouteDefÚRouteTableDefÚ	StaticDefÚdeleteÚgetÚheadÚoptionsÚpatchÚpostÚputÚrouteÚstaticÚview)	Ú	AppRunnerÚ
BaseRunnerÚBaseSiteÚGracefulExitÚNamedPipeSiteÚServerRunnerÚSockSiteÚTCPSiteÚUnixSite)ÚServer)ÚAbstractResourceÚAbstractRouteÚDynamicResourceÚPlainResourceÚPrefixedSubAppResourceÚResourceÚResourceRouteÚStaticResourceÚUrlDispatcherÚUrlMappingMatchInfoÚView)ÚWebSocketReadyÚWebSocketResponseÚ	WSMsgType)ur   r   r   rN   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rO   rQ   rR   rS   rT   rU   rV   rW   rX   r   rY   rZ   r[   r\   r]   r   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rq   rr   rs   rt   rp   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r€   r�   r‚   rƒ   Úrun_app)Ú
SSLContextÚignoreT)ÚcategoryÚappendé€   )	ÚhostÚportÚpathÚsockÚssl_contextÚprintÚbacklogÚreuse_addressÚ
reuse_portÚapprŠ   r‹   rŒ   r�   rŽ   r�   ).Nr�   r‘   r’   ÚkwargsÚreturnc       	         Ë   sÐ  �t  | ¡r| I d H } tt| ƒ} t| fi |
¤Ž}| ¡ I d H  g }z¾|d urNt|tƒr:| t	|||||||	d�¡ n-|D ]}| t	|||||||	d�¡ q<n|d u rV|d u sZ|d urg| t	||||||	d�¡ |d ur�t|tt
jfƒr| t||||d�¡ n|D ]}| t||||d�¡ q�|d ur´t|tƒs¤| t||||d�¡ n|D ]}| t||||d�¡ q¦|D ]	}| ¡ I d H  q¶|rÖtdd„ |jD ƒƒ}|d d |¡¡ƒ 	 t  d	¡I d H  q×| ¡ I d H  w )
N)rŽ   r�   r‘   r’   )r‹   rŽ   r�   r‘   r’   )rŽ   r�   c                 s   s   � | ]}t |jƒV  qd S )N)ÚstrÚname)Ú.0Ús© rš   úH/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiohttp/web.pyÚ	<genexpr>—  s   € z_run_app.<locals>.<genexpr>z6======== Running on {} ========
(Press CTRL+C to quit)z, Ti  )ÚasyncioÚiscoroutiner
   r   rl   ÚsetupÚ
isinstancer–   rˆ   rs   Úosr   rt   r   rr   ÚstartÚsortedÚsitesÚformatÚjoinÚsleepÚcleanup)r“   rŠ   r‹   rŒ   r�   rŽ   r�   r�   r‘   r’   r”   Úrunnerr¤   ÚhÚpr™   ÚsiteÚnamesrš   rš   r›   Ú_run_app)  s¾   €



ùÿùÿÿúÿüÿ	üÿ	
üÿ	üÿþÿr®   Ú	to_cancelzasyncio.Task[Any]Úloopc                 C   sj   | sd S | D ]}|  ¡  q| tj| ddiŽ¡ | D ]}| ¡ r!q| ¡ d ur2| d| ¡ |dœ¡ qd S )NÚreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)ÚmessageÚ	exceptionÚtask)ÚcancelÚrun_until_completer�   ÚgatherÚ	cancelledr³   Úcall_exception_handler)r¯   r°   r´   rš   rš   r›   Ú_cancel_tasks¤  s"   
ýÿ€ürº   g      N@g     ÀR@F)rŠ   r‹   rŒ   r�   Úshutdown_timeoutÚkeepalive_timeoutrŽ   r�   r�   Úaccess_log_classÚaccess_log_formatÚ
access_logÚhandle_signalsr‘   r’   Úhandler_cancellationr°   r»   r¼   r½   r¾   r¿   rÀ   rÁ   c                K   sà  |du rt  ¡ }| ¡ r*|r*|jdkr*|jtjkr| tj¡ | 	¡ s*| 
t ¡ ¡ | t| fi d|“d|“d|“d|“d|“d|“d	|“d
|“d|	“d|
“d|“d|“d|“d|“d|“d|“|¤Ž¡}z’zt  |¡ | |¡ W n ttfy}   Y nw W zd| ¡ s¸| ¡  tt jƒ� | |¡ W d  ƒ n41 s�w   Y  W tt  |¡|ƒ | | ¡ ¡ | ¡  dS W tt  |¡|ƒ | | ¡ ¡ | ¡  dS W tt  |¡|ƒ | | ¡ ¡ | ¡  dS tt  |¡|ƒ | | ¡ ¡ | ¡  w zc| ¡ �s2| ¡  tt jƒ� | |¡ W d  ƒ n31 �sw   Y  W tt  |¡|ƒ | | ¡ ¡ | ¡  w W tt  |¡|ƒ | | ¡ ¡ | ¡  w W tt  |¡|ƒ | | ¡ ¡ | ¡  w tt  |¡|ƒ | | ¡ ¡ | ¡  w )zRun an app locallyNzaiohttp.accessrŠ   r‹   rŒ   r�   r»   r¼   rŽ   r�   r�   r½   r¾   r¿   rÀ   r‘   r’   rÁ   )r�   Únew_event_loopÚ	get_debugr—   ÚlevelÚloggingÚNOTSETÚsetLevelÚDEBUGÚhasHandlersÚ
addHandlerÚStreamHandlerÚcreate_taskr®   Úset_event_loopr¶   ro   ÚKeyboardInterruptÚdonerµ   r   ÚCancelledErrorrº   Ú	all_tasksÚshutdown_asyncgensÚclose)r“   rŠ   r‹   rŒ   r�   r»   r¼   rŽ   r�   r�   r½   r¾   r¿   rÀ   r‘   r’   rÁ   r°   r”   Ú	main_taskrš   rš   r›   r„   ¼  s¸   ÿþýüûúùø	÷
öõôóòñðîÿ
ÿ€	ÿùûþ
ð
	 ÿ
ù
û
þ
r„   Úargvc              
   C   s˜  t ddd�}|jdddd� |jdd	d
d d� |jdddtdd� |jdddd� | | ¡\}}|j d¡\}}}|r=|sB| d¡ | d¡rL| d¡ zt|ƒ}W n t	yo } z| d|› d|› �¡ W Y d }~nd }~ww zt
||ƒ}	W n ty‹   | d|›d|›�¡ Y nw |jd ur›ttdƒs›| d¡ tjtjd� |jr¯|jd u r¯d  }
}n|jp³d }
|j}|	|ƒ}t||
||jd!� |jd"d#� d S )$Nzaiohttp.web Application serverzaiohttp.web)ÚdescriptionÚprogÚ
entry_funczvCallable returning the `aiohttp.web.Application` instance to run. Should be specified in the 'module:function' syntax.z
entry-func)ÚhelpÚmetavarz-Hz
--hostnamez0TCP/IP hostname to serve on (default: localhost))rÙ   Údefaultz-Pz--portz.TCP/IP port to serve on (default: %(default)r)i�  )rÙ   ÚtyperÛ   z-Uz--pathz_Unix file system path to serve on. Can be combined with hostname to serve on both Unix and TCP.)rÙ   ú:z,'entry-func' not in 'module:function' syntaxÚ.z#relative module names not supportedzunable to import z: zmodule z has no attribute ÚAF_UNIXz=file system paths not supported by your operating environment)rÄ   Ú	localhost)rŠ   r‹   rŒ   zStopped
)r²   )r   Úadd_argumentÚintÚparse_known_argsrØ   Ú	partitionÚerrorÚ
startswithr   ÚImportErrorÚgetattrÚAttributeErrorrŒ   ÚhasattrÚsocketrÅ   ÚbasicConfigrÈ   Úhostnamer‹   r„   Úexit)rÕ   Ú
arg_parserÚargsÚ
extra_argvÚmod_strÚ_Úfunc_strÚmoduleÚexÚfuncrŠ   r‹   r“   rš   rš   r›   Úmain  sn   ÿúüûý


"€ÿÿÿ

rø   Ú__main__)¶r�   rÅ   r¡   rë   ÚsysÚwarningsÚargparser   Úcollections.abcr   r   r   ÚTypingIterableÚ
contextlibr   Ú	importlibr   Útypingr   r	   r
   Úabcr   Úhelpersr   r   r   Úlogr   Útypedefsr   Úweb_appr   r   Úweb_exceptionsr   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   Úweb_fileresponserO   Úweb_logrP   Úweb_middlewaresrQ   rR   Úweb_protocolrS   rT   rU   Úweb_requestrV   rW   rX   Úweb_responserY   rZ   r[   r\   r]   Úweb_routedefr^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   Ú
web_runnerrl   rm   rn   ro   rp   rq   rr   rs   rt   Ú
web_serverru   Úweb_urldispatcherrv   rw   rx   ry   rz   r{   r|   r}   r~   r   r€   Úweb_wsr�   r‚   rƒ   Ú__all__Ússlr…   rç   ÚobjectÚfilterwarningsr–   ÚHostSequencer�   râ   Úboolr®   ÚsetÚAbstractEventLooprº   Ú
LOG_FORMATÚfloatrÜ   ÚLoggerr„   Úlistrø   Ú__name__rÕ   rš   rš   rš   r›   Ú<module>   s   ô=@,4 ÿõ
ÿ
ýüûúù
ø	÷
öõô
ó{ÿÿ
þí
ÿ
ýüûúùø	÷

öõôóòñðïîíì
ëQ
Cÿ