o
    `^h B                  7   @  s  d dl mZ 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 d dlZd dl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mZmZm Z  d dl!m"Z"m#Z# d dl$m%Z%m&Z& e'e(e) Z*e'e(e) Z+e'e(e) Z,e'e(e) Z-e'd	d
 e) D Z.e'eZ/dZ0e1dZ2dddZ3ej4ddidej5dddej6de7ddd d!ej6d"e8d#d$d d!ej6d%e7dd&d'ej6d(e8dd)d'ej6d*d d+d,d-ej6d.d/d d0ej9d d1d2ej6d3d4d d5d6ej6d7d8d d9d6ej6d:e:d;d d<d=ej6d>de8d?d@ej6dAe.dBdCd d!ej6dDe+dBdEd d!ej6dFe,dBdGd d!ej6dHe8dIdJd d!ej6dKe8dLdMd d!ej6dNe:dOdPd d!ej6dQe:dOdRd d!ej6dSe;d dTd d!ej6dUe-dBdVd d!ej6dWe/dBdXd d!ej6dYej9d d1ddZd d!ej6d[ej9d d1dd\d d!ej6d]e*dd^d d!ej6d_d d d`d-ej6dad ddbd-ej6dcd d ddd-ej6ded d dfd-ej6dgd d dhd-ej6die7ddjd'ej6dke7dldmd'ej6dne8ddod'ej6dpe8dqdrd'ej6dse8ddtd'ej6due8dvdwd d!ej6dxe8ddyd'ej6dze7dd{d d!ej6d|e7dd}d d!ej6d~e7ddd d!ej6de8e8edd d!ej6de8e8ej<dd d!ej6de7ddd d!ej6de7ddd d!ej6ddd dd6ej6dd e3d+d ddej6ddld ddej6dde8ddd'ej6dd d+dd dddd̄Z=dd#dddBdBdBdIdLdOdOd dBdBd+dddd;ddedd d d d ddlddqddvddddeej<dddddd+dd͜.dddڄZ>e?dkre=  dS dS )    )annotationsN)RawConfigParser)IOAnyCallable)ASGIApplication)HTTP_PROTOCOLS
INTERFACESLIFESPAN
LOG_LEVELSLOGGING_CONFIGLOOP_SETUPSSSL_PROTOCOL_VERSIONWS_PROTOCOLSConfigHTTPProtocolTypeInterfaceTypeLifespanTypeLoopSetupTypeWSProtocolType)ServerServerState)ChangeReloadMultiprocessc                 C  s   g | ]}|d kr|qS )none ).0keyr   r   J/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/uvicorn/main.py
<listcomp>'       r      uvicorn.errorctxclick.Contextparamclick.ParametervalueboolreturnNonec                 C  s@   |r| j rd S tdjtjt t t	 d | 
  d S )NzKRunning uvicorn {version} with {py_implementation} {py_version} on {system})versionpy_implementation
py_versionsystem)resilient_parsingclickechoformatuvicorn__version__platformpython_implementationpython_versionr.   exit)r#   r%   r'   r   r   r   print_version/   s   
r9   auto_envvar_prefixUVICORN)context_settingsappUVICORN_APP)envvarz--hostz	127.0.0.1zBind socket to this host.T)typedefaulthelpshow_defaultz--porti@  zABind socket to this port. If 0, an available port will be picked.z--udszBind to a UNIX domain socket.)r@   rA   rB   z--fdz)Bind to socket from this file descriptor.z--reloadFzEnable auto-reload.)is_flagrA   rB   z--reload-dirreload_dirszRSet reload directories explicitly, instead of using the current working directory.)exists)multiplerB   r@   z--reload-includereload_includeszSet glob patterns to include while watching for files. Includes '*.py' by default; these defaults can be overridden with `--reload-exclude`. This option has no effect unless watchfiles is installed.)rG   rB   z--reload-excludereload_excludeszSet glob patterns to exclude while watching for files. Includes '.*, .py[cod], .sw.*, ~*' by default; these defaults can be overridden with `--reload-include`. This option has no effect unless watchfiles is installed.z--reload-delayg      ?zTDelay between previous and next check if application needs to be. Defaults to 0.25s.)r@   rA   rC   rB   z	--workersz~Number of worker processes. Defaults to the $WEB_CONCURRENCY environment variable if available, or 1. Not valid with --reload.)rA   r@   rB   z--loopautozEvent loop implementation.z--httpzHTTP protocol implementation.z--wsz"WebSocket protocol implementation.z--ws-max-sizei   z#WebSocket max size message in bytesz--ws-max-queue    z2The maximum length of the WebSocket message queue.z--ws-ping-intervalg      4@z#WebSocket ping interval in seconds.z--ws-ping-timeoutz"WebSocket ping timeout in seconds.z--ws-per-message-deflatez)WebSocket per-message-deflate compressionz
--lifespanzLifespan implementation.z--interfacez:Select ASGI3, ASGI2, or WSGI as the application interface.z
--env-filezEnvironment configuration file.z--log-configzBLogging configuration file. Supported formats: .ini, .json, .yaml.z--log-levelzLog level. [default: info]z--access-log/--no-access-logzEnable/Disable access log.z--use-colors/--no-use-colorsz!Enable/Disable colorized logging.z"--proxy-headers/--no-proxy-headerszdEnable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info.z"--server-header/--no-server-headerz%Enable/Disable default Server header.z--date-header/--no-date-headerz#Enable/Disable default Date header.z--forwarded-allow-ipszComma separated list of IP Addresses, IP Networks, or literals (e.g. UNIX Socket path) to trust with proxy headers. Defaults to the $FORWARDED_ALLOW_IPS environment variable if available, or '127.0.0.1'. The literal '*' means trust everything.z--root-path zLSet the ASGI 'root_path' for applications submounted below a given URL path.z--limit-concurrencyz^Maximum number of concurrent connections or tasks to allow, before issuing HTTP 503 responses.z	--backlogi   z0Maximum number of connections to hold in backlogz--limit-max-requestszEMaximum number of requests to service before terminating the process.z--timeout-keep-alive   zLClose Keep-Alive connections if no new data is received within this timeout.z--timeout-graceful-shutdownz8Maximum number of seconds to wait for graceful shutdown.z--ssl-keyfilezSSL key filez--ssl-certfilezSSL certificate filez--ssl-keyfile-passwordzSSL keyfile passwordz--ssl-versionz,SSL version to use (see stdlib ssl module's)z--ssl-cert-reqsz@Whether client certificate is required (see stdlib ssl module's)z--ssl-ca-certszCA certificates filez--ssl-ciphersTLSv1z(Ciphers to use (see stdlib ssl module's)z--headerheaderszASpecify custom default HTTP response headers as a Name:Value pairz	--versionz%Display the uvicorn version and exit.)rD   callbackexpose_valueis_eagerrB   z	--app-dirzuLook for APP in the specified directory, by adding this to the PYTHONPATH. Defaults to the current working directory.)rA   rC   rB   z--h11-max-incomplete-event-sizeh11_max_incomplete_event_sizezFFor h11, the maximum number of bytes to buffer of an incomplete event.z	--factoryzFTreat APP as an application factory, i.e. a () -> <ASGI app> callable.)rD   rA   rB   rC   strhostportintudsfdloopr   httpr   wsr   ws_max_sizews_max_queuews_ping_intervalfloatws_ping_timeoutws_per_message_deflatelifespanr   	interfacer   reload	list[str]reload_delayworkersenv_file
log_config	log_level
access_logproxy_headersserver_headerdate_headerforwarded_allow_ips	root_pathlimit_concurrencybackloglimit_max_requeststimeout_keep_alivetimeout_graceful_shutdown
int | Nonessl_keyfilessl_certfilessl_keyfile_passwordssl_versionssl_cert_reqsssl_ca_certsssl_ciphers
use_colorsapp_dirfactoryc/           /      C  s  t | fi d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d u r5tn|d|d|d|d|d|pGd d|pLd d|pd d|d|d|d|d|d|d|d|d|d | d!|!d"|"d#|#d$|$d%|%d&|&d'|'d(|(d)|)d*d+d, |*D d-|+d.|.d/|,d0|- d S d|d|d|d|d|d|d|d|d|d | d!|!d"|"d#|#d$|$d%|%d&|&d'|'d(|(d)|)d*d+d, |*D d-|+d.|.d/|,d0|- d S )1NrU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   ra   rb   rc   ri   rj   rk   rl   rd   re   rE   rH   rI   rg   rh   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rx   ry   rz   r{   r|   r}   r~   rO   c                 S  s   g | ]}| d dqS ):   )split)r   headerr   r   r   r     r    zmain.<locals>.<listcomp>r   r   r   rS   )runr   )/r=   rU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   ra   rb   rc   rd   re   rE   rH   rI   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rx   ry   rz   r{   r|   r}   r~   rO   r   r   rS   r   r   r   r   main=   s,    a	
 !"#$%&'()*+,-./ !"#$%&'()*+,-./r   ).rU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   ra   rb   rc   rd   re   rE   rH   rI   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rx   ry   rz   r{   r|   r}   r~   rO   r   r   r   rS   *ASGIApplication | Callable[..., Any] | str
str | None)type[asyncio.Protocol] | HTTPProtocolType'type[asyncio.Protocol] | WSProtocolTypefloat | Nonelist[str] | str | Nonestr | os.PathLike[str] | None7dict[str, Any] | str | RawConfigParser | IO[Any] | Nonestr | int | Nonelist[tuple[str, str]] | Nonebool | Nonec       .   3   	   C  sl  |,d urt jd|, t| fi d|d|d|d|d|d|d|d	|d
|	d|
d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d |d!| d"|!d#|"d$|#d%|$d&|%d'|&d(|'d)|(d*|)d+|*d,|+d-|-d.|.}/t|/d/}0|/js|/jd0krt| tst	
d1}1|1d2 t d0 zLz.|/jr|/ }2t|/|0j|2gd3  n|/jd0kr|/ }2t|/|0j|2gd3  n|0  W n	 ty   Y nw W |/jrtj|/jrt|/j n|/jrtj|/jrt|/j w w w |0js0|/js2|/jd0kr4t t d S d S d S d S )4Nr   rU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   ra   rb   rc   rd   re   rE   rH   rI   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rx   ry   rz   r{   r|   r}   r~   rO   r   r   rS   )configr   r"   zRYou must pass the application as an import string to enable 'reload' or 'workers'.)targetsockets)syspathinsertr   r   re   rh   
isinstancerT   logging	getLoggerwarningr8   should_reloadbind_socketr   r   r   KeyboardInterruptrX   osrF   removestartedSTARTUP_FAILURE)3r=   rU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   ra   rb   rc   rd   re   rE   rH   rI   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rx   ry   rz   r{   r|   r}   r~   rO   r   r   r   rS   r   serverloggersockr   r   r   r     s   2	
 !"#$%&'()*+,-.
0



r   __main__)r#   r$   r%   r&   r'   r(   r)   r*   )`r=   rT   rU   rT   rV   rW   rX   rT   rY   rW   rZ   r   r[   r   r\   r   r]   rW   r^   rW   r_   r`   ra   r`   rb   r(   rc   r   rd   r   re   r(   rE   rf   rH   rf   rI   rf   rg   r`   rh   rW   ri   rT   rj   rT   rk   rT   rl   r(   rm   r(   rn   r(   ro   r(   rp   rT   rq   rT   rr   rW   rs   rW   rt   rW   ru   rW   rv   rw   rx   rT   ry   rT   rz   rT   r{   rW   r|   rW   r}   rT   r~   rT   rO   rf   r   r(   r   rT   rS   rw   r   r(   r)   r*   )`r=   r   rU   rT   rV   rW   rX   r   rY   rw   rZ   r   r[   r   r\   r   r]   rW   r^   rW   r_   r   ra   r   rb   r(   rc   r   rd   r   re   r(   rE   r   rH   r   rI   r   rg   r`   rh   rw   ri   r   rj   r   rk   r   rl   r(   rm   r(   rn   r(   ro   r(   rp   r   rq   rT   rr   rw   rs   rW   rt   rw   ru   rW   rv   rw   rx   r   ry   r   rz   r   r{   rW   r|   rW   r}   r   r~   rT   rO   r   r   r   r   r   r   r(   rS   rw   r)   r*   )@
__future__r   asyncior   r   r5   sslr   configparserr   typingr   r   r   r0   r3   uvicorn._typesr   uvicorn.configr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   uvicorn.serverr   r   uvicorn.supervisorsr   r   ChoicelistkeysLEVEL_CHOICESHTTP_CHOICES
WS_CHOICESLIFESPAN_CHOICESLOOP_CHOICESINTERFACE_CHOICESr   r   r   r9   commandargumentoptionrT   rW   Pathr`   r(   	CERT_NONEr   r   __name__r   r   r   r   <module>   s   @



	

	lg

