o
    iG                  9   @  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Zd dl	m
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  d dl!m"Z" d d	l#m$Z$m%Z% e&e'e( Z)e&e'e( Z*e&eZ+dddZ,dZ-e.dZ/dddZ0ej1ddidej2ddd ej3d!e4d"d#d$d%ej3d&e5d'd(d$d%ej3d)e4dd*d+ej3d,e5dd-d+ej3d.d$d/d0d1ej3d2d3d$d4ej6d$d5d6ej3d7d8d$d9d:ej3d;d<d$d=d:ej3d>e7d?d$d@dAej3dBde5dCdDej3dEe4e,edFdGd$dHej3dIe4e,edFdJd$dHej3dKe4e,e dFdLd$dHej3dMe5dNdOd$d%ej3dPe5dQdRd$d%ej3dSe7dTdUd$d%ej3dVe7dTdWd$d%ej3dXe8d$dYd$d%ej3dZe*dFd[d$d%ej3d\e+dFd]d$d%ej3d^ej6d$d5dd_d$d%ej3d`ej6d$d5ddad$d%ej3dbe)ddcd$d%ej3ddd$d$ded1ej3dfd$ddgd1ej3dhd$d$did1ej3djd$d$dkd1ej3dld$d$dmd1ej3dne4ddod+ej3dpe4dqdrd+ej3dse5ddtd+ej3due5dvdwd+ej3dxe5ddyd+ej3dze5d d{d$d%ej3d|e5d}d~d$d%ej3de5ddd+ej3de5d}dd$d%ej3de4ddd$d%ej3de4ddd$d%ej3de4ddd$d%ej3de5e5edd$d%ej3de5e5ej9dd$d%ej3de4ddd$d%ej3de4ddd$d%ej3ddd$dd:ej3dd$e0d/d$ddej3ddqd$ddej3dde5ddd+ej3dd$d/dd$ddddքZ:d"d'dddFdFdFdNdQdTdTd$dFdFd/dddd?ddedd$d$d$d$ddqddvdd d}dd}dddeej9dddddd/ddל0dddZ;dddZ<e=dkre:  dS dS )    )annotationsN)Callable)RawConfigParser)IOAnyget_args)ASGIApplication)
INTERFACESLIFESPAN
LOG_LEVELSLOGGING_CONFIGSSL_PROTOCOL_VERSIONConfigHTTPProtocolTypeInterfaceTypeLifespanTypeLoopFactoryTypeWSProtocolType)Server)ChangeReloadMultiprocess_typer   returnstrc                 C  s    dd dd t| D  dS )N[|c                 s  s    | ]	}|d kr|V  qdS )noneN ).0keyr   r   C/home/app/Keep/.python/lib/python3.10/site-packages/uvicorn/main.py	<genexpr>(   s    z%_metavar_from_type.<locals>.<genexpr>])joinr   )r   r   r   r    _metavar_from_type'   s    r$      uvicorn.errorctxclick.Contextparamclick.Parametervaluebool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})versionZpy_implementation
py_versionsystem)Zresilient_parsingclickZechoformatuvicorn__version__platformpython_implementationpython_versionr0   exit)r'   r)   r+   r   r   r    print_version0   s   
r9   Zauto_envvar_prefixZUVICORN)Zcontext_settingsappZUVICORN_APP)Z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;   r<   r=   z--fdz)Bind to socket from this file descriptor.z--reloadFzEnable auto-reload.)is_flagr<   r=   z--reload-dirreload_dirszRSet reload directories explicitly, instead of using the current working directory.)exists)multipler=   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.)rB   r=   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;   r<   r>   r=   z	--workersz~Number of worker processes. Defaults to the $WEB_CONCURRENCY environment variable if available, or 1. Not valid with --reload.)r<   r;   r=   z--loopautoz"Event loop factory implementation.)r;   metavarr<   r=   r>   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-headerszaEnable/Disable X-Forwarded-Proto, X-Forwarded-For to populate url scheme and 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--limit-max-requests-jitterzuMaximum jitter to add to limit_max_requests. Staggers worker restarts to avoid all workers restarting simultaneously.z--timeout-keep-alive   zYClose Keep-Alive connections if no new data is received within this timeout (in seconds).z--timeout-graceful-shutdownz8Maximum number of seconds to wait for graceful shutdown.z--timeout-worker-healthcheckzKMaximum number of seconds to wait for a worker to respond to a healthcheck.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.)r?   callbackZexpose_valueZis_eagerr=   z	--app-dirzuLook for APP in the specified directory, by adding this to the PYTHONPATH. Defaults to the current working directory.)r<   r>   r=   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.)r?   r<   r=   r>   hostportintudsfdloopLoopFactoryType | strhttpHTTPProtocolType | strwsWSProtocolType | str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limit_max_requests_jittertimeout_keep_alivetimeout_graceful_shutdown
int | Nonetimeout_worker_healthcheckssl_keyfilessl_certfilessl_keyfile_passwordssl_versionssl_cert_reqsssl_ca_certsssl_ciphers
use_colorsapp_dirfactoryc1           1      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|0d1|.d2|/ 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|0d1|.d2|/ d S )3NrN   rO   rQ   rR   rS   rU   rW   rY   rZ   r[   r]   r^   r_   re   rf   rg   rh   r`   ra   r@   rC   rD   rc   rd   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   ru   rv   rw   rx   ry   rz   r{   r|   rK   c                 S  s   g | ]}| d dqS ):   )split)r   headerr   r   r    
<listcomp>  s    zmain.<locals>.<listcomp>r}   r   r~   rM   )runr   )1r:   rN   rO   rQ   rR   rS   rU   rW   rY   rZ   r[   r]   r^   r_   r`   ra   r@   rC   rD   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   ru   rv   rw   rx   ry   rz   r{   r|   rK   r}   r~   rM   r   r   r   r    main>   s<    u	
 !"#$%&'()*+,-./01 !"#$%&'()*+,-./01r   )0rN   rO   rQ   rR   rS   rU   rW   rY   rZ   r[   r]   r^   r_   r`   ra   r@   rC   rD   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   ru   rv   rw   rx   ry   rz   r{   r|   rK   r}   r~   r   rM   *ASGIApplication | Callable[..., Any] | str
str | None/type[asyncio.Protocol] | HTTPProtocolType | str-type[asyncio.Protocol] | WSProtocolType | str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       0   5   	   C  sx  |.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.|-d/|/d0|0}1t|1d1}2|1js|1jd2krt| tst	
d3}3|3d4 t d2 zLz.|1jr|1 }4t|1|2j|4gd5  n|1jd2kr|1 }4t|1|2j|4gd5  n|2  W n	 ty   Y nw W |1jrtj|1jrt|1j n|1jrtj|1jr t|1j w w w |2js6|1js8|1jd2kr:t t d S d S d S d S )6Nr   rN   rO   rQ   rR   rS   rU   rW   rY   rZ   r[   r]   r^   r_   r`   ra   r@   rC   rD   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   ru   rv   rw   rx   ry   rz   r{   r|   rK   r}   r   rM   )configr   r&   zRYou must pass the application as an import string to enable 'reload' or 'workers'.)targetsockets)syspathinsertr   r   ra   rd   
isinstancer   logging	getLoggerwarningr8   Zshould_reloadZbind_socketr   r   r   KeyboardInterruptrQ   osrA   removestartedSTARTUP_FAILURE)5r:   rN   rO   rQ   rR   rS   rU   rW   rY   rZ   r[   r]   r^   r_   r`   ra   r@   rC   rD   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   ru   rv   rw   rx   ry   rz   r{   r|   rK   r}   r~   r   rM   r   serverloggersockr   r   r    r     s   4	
 !"#$%&'()*+,-./0
2



r   namec                 C  s8   | dkrt dt ddlm} |S tdt d|  )NServerStatezOuvicorn.main.ServerState is deprecated, use uvicorn.server.ServerState instead.r   )r   zmodule z has no attribute )warningswarnDeprecationWarninguvicorn.serverr   AttributeError__name__)r   r   r   r   r    __getattr__i  s   r   __main__)r   r   r   r   )r'   r(   r)   r*   r+   r,   r   r-   )dr:   r   rN   r   rO   rP   rQ   r   rR   rP   rS   rT   rU   rV   rW   rX   rY   rP   rZ   rP   r[   r\   r]   r\   r^   r,   r_   r   r`   r   ra   r,   r@   rb   rC   rb   rD   rb   rc   r\   rd   rP   re   r   rf   r   rg   r   rh   r,   ri   r,   rj   r,   rk   r,   rl   r   rm   r   rn   rP   ro   rP   rp   rP   rq   rP   rr   rP   rs   rt   ru   rP   rv   r   rw   r   rx   r   ry   rP   rz   rP   r{   r   r|   r   rK   rb   r}   r,   r~   r   rM   rt   r   r,   r   r-   )dr:   r   rN   r   rO   rP   rQ   r   rR   rt   rS   rT   rU   r   rW   r   rY   rP   rZ   rP   r[   r   r]   r   r^   r,   r_   r   r`   r   ra   r,   r@   r   rC   r   rD   r   rc   r\   rd   rt   re   r   rf   r   rg   r   rh   r,   ri   r,   rj   r,   rk   r,   rl   r   rm   r   rn   rt   ro   rP   rp   rt   rq   rP   rr   rP   rs   rt   ru   rP   rv   r   rw   r   rx   r   ry   rP   rz   rP   r{   r   r|   r   rK   r   r}   r   r~   r   r   r,   rM   rt   r   r-   )r   r   r   r   )>
__future__r   asyncior   r   r5   sslr   r   collections.abcr   configparserr   typingr   r   r   r1   r3   Zuvicorn._typesr   Zuvicorn.configr	   r
   r   r   r   r   r   r   r   r   r   r   r   Zuvicorn.supervisorsr   r   ZChoicelistkeysZLEVEL_CHOICESZLIFESPAN_CHOICESZINTERFACE_CHOICESr$   r   r   r   r9   commandargumentoptionr   rP   Pathr\   r,   	CERT_NONEr   r   r   r   r   r   r   r    <module>   s   4




	

	pk 


