B
    CeA              `   @   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Zd dlZd dl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jrd dl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Z*e+d	Z,ej-ej.e/dd
ddZ0ej1ddide2d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d d!ej3d"d#dd$ej6dd%d&ej3d'd(dd)d*ej3d+d,dd-d*ej3d.e7d/dd0d1ej3d2de5d3d4ej3d5e(d6d7ddej3d8e%d6d9ddej3d:e&d6d;ddej3d<e5d=d>ddej3d?e7d@dAddej3dBe7d@dCddej3dDe/ddEddej3dFe'd6dGddej3dHe)d6dIddej3dJej6dd%ddKddej3dLej6dd%ddMddej3dNe$ddOddej3dPdddQd!ej3dRdddSd!ej3dTdddUd!ej3dVdddWd!ej3dXdddYd!ej3dZe4dd[dej3d\e4d]d^dej3d_e5dd`dej3dae5dbdcdej3dde5ddedej3dfe5dgdhddej3die5ddjdej3dke4ddlddej3dme4ddnddej3doe4ddpddej3dqe5e5edrddej3dse5e5ej8dtddej3due4ddvddej3dwe4dxdyddej3dzd{dd|d*ej3d}de0ddd~dej3dd]dddej3dde5dddej3dddddde4e4e5e4e5eeee5e7e7e/eee/ej9e4 ej9e4 ej9e4 e7e5e4e4e4e/e/e/e/e4e4e5e5e5e5ej:e5 e4e4e4e5e5e4e4ej9e4 e/e4ej:e5 e/dd/ddZ;ddddd6d6d6d=d@d@dd6d6ddddd/ddeddddddd]ddbddgddddeej8ddxdddddd-ej<dej=e4f e4e5ej:e4 ej:e5 eej<ej>e j? ef ej<ej>e j? ef e5ej:e7 ej:e7 e/eee/ej:ej<ej9e4 e4f  ej:ej<ej9e4 e4f  ej:ej<ej9e4 e4f  e7ej:e5 ej:ej<e4ej@f  ej:ej<ejAe4ejBf e4f  ej:ej<e4e5f  e/e/e/e/ej:ej<ej9e4 e4f  e4ej:e5 e5ej:e5 e5ej:e5 ej:e4 ej:ej<e4ej@f  ej:e4 e5e5ej:e4 e4ej:ej9ejCe4e4f   ej:e/ ej:e4 e/ej:e5 dd/ddZDeEdkre;  dS )    N)HTTP_PROTOCOLS
INTERFACESLIFESPAN
LOG_LEVELSLOGGING_CONFIGLOOP_SETUPSSSL_PROTOCOL_VERSIONWS_PROTOCOLSConfigHTTPProtocolTypeInterfaceTypeLifespanTypeLoopSetupTypeWSProtocolType)ServerServerState)ChangeReloadMultiprocess)ASGIApplicationc             C   s   g | ]}|d kr|qS )none ).0keyr   r   `/var/www/downstreamdata.science/rtclock/rtclock-venv/lib/python3.7/site-packages/uvicorn/main.py
<listcomp>&   s    r      zuvicorn.error)ctxparamvaluereturnc             C   s>   |r
| j rd S tdtjt t t f  | 	  d S )Nz#Running uvicorn %s with %s %s on %s)
Zresilient_parsingclickZechouvicorn__version__platformpython_implementationpython_versionsystemexit)r   r   r   r   r   r   print_version.   s    
r(   Zauto_envvar_prefixZUVICORN)Zcontext_settingsappz--hostz	127.0.0.1zBind socket to this host.T)typedefaulthelpshow_defaultz--porti@  zBind socket to this port.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.)r1   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 implementation.z--httpzHTTP protocol implementation.z--wsz"WebSocket protocol implementation.z--ws-max-sizei   z#WebSocket max size message in bytesz--ws-ping-intervalg      4@zWebSocket ping intervalz--ws-ping-timeoutzWebSocket ping timeoutz--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 IPs to trust with proxy headers. Defaults to the $FORWARDED_ALLOW_IPS environment variable if available, or '127.0.0.1'.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.)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-   )/r)   hostportudsfdloophttpwsws_max_sizews_ping_intervalws_ping_timeoutws_per_message_deflatelifespan	interfacereloadr/   r2   r3   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ssl_keyfilessl_certfilessl_keyfile_passwordssl_versionssl_cert_reqsssl_ca_certsssl_ciphersr8   
use_colorsapp_dirr:   factoryr   c.       .   0   C   s   t | |||||||||	|
||||d kr*tn||||||p:d |p@d |pFd ||||||||||| |!|"|#|$|%|&|'|(dd |)D |*|-|+|,d. d S )Nc             S   s   g | ]}| d dqS ):   )split)r   headerr   r   r   r     s    zmain.<locals>.<listcomp>)-r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rK   rL   rM   rN   rG   rH   r/   r2   r3   rI   rJ   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r8   r`   rb   ra   r:   )runr   ).r)   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r/   r2   r3   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r8   r`   ra   r:   rb   r   r   r   main=   sb      _rh   )-r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r/   r2   r3   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r8   r`   ra   rb   r:   r   )/r)   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r/   r2   r3   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r8   r`   ra   rb   r:   r   c   -   2   /   C   sb  |+d k	rt jd|+ t| |||||||||	|
|||||||||||||||||||||| |!|"|#|$|%|&|'|(|)|*|,|-d-}.t|.d}/|.js|.jdkrt| tst	
d}0|0d t d |.jr|. }1t|.|/j|1gd  n4|.jdkr|. }1t|.|/j|1gd  n|/  |.jr8tj|.jr8t|.j |/js^|.js^|.jdkr^t t d S )Nr   ),r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r/   r2   r3   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r8   r`   rb   r:   )configrd   zuvicorn.errorzRYou must pass the application as an import string to enable 'reload' or 'workers'.)targetsockets)syspathinsertr
   r   rH   rJ   
isinstancestrlogging	getLoggerwarningr'   Zshould_reloadZbind_socketr   rg   r   r=   osr0   removestartedSTARTUP_FAILURE)2r)   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r/   r2   r3   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r8   r`   ra   rb   r:   ri   serverloggersockr   r   r   rg     s    3


rg   __main__)Fasynciorq   rt   r#   sslrl   typingr    r!   Zuvicorn.configr   r   r   r   r   r   r   r	   r
   r   r   r   r   r   Zuvicorn.serverr   r   Zuvicorn.supervisorsr   r   TYPE_CHECKINGZasgiref.typingr   ZChoicelistkeysZLEVEL_CHOICESZHTTP_CHOICESZ
WS_CHOICESZLIFESPAN_CHOICESZLOOP_CHOICESZINTERFACE_CHOICESrw   rr   ry   Context	Parameterboolr(   commandargumentoptionrp   intPathfloat	CERT_NONEListOptionalrh   UnionCallableTypeProtocolPathLikeDictAnyTuplerg   __name__r   r   r   r   <module>   s  @



n6 L
