o
    [hW&                  o   @   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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 Zee Zee Zee
 Zedd e D Zee	Ze dZ dd	 Z!e" e#d
ej$de%ddddej$de&ddddej$de%dddej$de&dddej$ddddddej$dddddej$dd dd!d"ej$d#e'd$dd%d&ej$d'de&d(d)ej$d*ed+d,ddej$d-ed+d.ddej$d/ed+d0ddej$d1ed+d2ddej$d3ed+d4ddej$d5ej(dd6dd7ddej$d8ej(dd6dd9ddej$d:edd;ddej$d<ddd=dej$d>ddd?dej$d@dddAdej$dBe%ddCdej$dDe%dEdFdej$dGe&ddHdej$dIe&dJdKdej$dLe&ddMdej$dNe&dOdPddej$dQe%ddRddej$dSe%ddTddej$dUe%ddVddej$dWe&edXddej$dYe&ej)dZddej$d[e%dd\ddej$d]e%d^d_ddej$d`daddbd"ej$dcde!dddddeej$dfdgdhddidjej$dkdddlddmdne%doe&dpe%dqe&dre%dse%dte%due%dve%dwe*dxe*d ej+e% dye'dze&d{e%d|e%d}e%d~e*de*de%de%de&de&de&de&de%de%de%de&de&de%de%daej+e% de*dge%de*fHddZ,dd Z-e.dkrPe,  dS dS )    N)	HTTP_PROTOCOLS
INTERFACESLIFESPAN
LOG_LEVELSLOGGING_CONFIGLOOP_SETUPSSSL_PROTOCOL_VERSIONWS_PROTOCOLSConfig)ServerServerState)ChangeReloadMultiprocessc                 C   s   g | ]}|d kr|qS )none ).0keyr   r   s/home/ubuntu/experiments/live_experiments/Pythonexperiments/Otree/venv/lib/python3.10/site-packages/uvicorn/main.py
<listcomp>       r   uvicorn.errorc                 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)ctxparamvaluer   r   r   print_version"   s   
	r"   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--debugFzEnable debug mode.)is_flagr%   r&   Zhiddenz--reloadzEnable auto-reload.)r(   r%   r&   z--reload-dirreload_dirszRSet reload directories explicitly, instead of using the current working directory.)Zmultipler&   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
--lifespanzLifespan implementation.z--interfacez:Select ASGI3, ASGI2, or WSGI as the application interface.z
--env-file)existsz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--forwarded-allow-ipszComma seperated 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--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-dirapp_dir.zuLook for APP in the specified directory, by adding this to the PYTHONPATH. Defaults to the current working directory.)r%   r'   r&   z	--factoryzFTreat APP as an application factory, i.e. a () -> <ASGI app> callable.)r(   r%   r&   r'   hostportudsfdloophttpwslifespan	interfacedebugreloadreload_delayworkersenv_file
log_config	log_level
access_logproxy_headersforwarded_allow_ips	root_pathlimit_concurrencybackloglimit_max_requeststimeout_keep_alivessl_keyfilessl_certfilessl_keyfile_passwordssl_versionssl_cert_reqsssl_ca_certsssl_ciphers
use_colorsfactoryc%           &      C   s  t jd|# i d| d|d|d|d|d|d|d	|d
|d|d|d u r-tn|d|d|d|	d|
d|d|rC|nd i d|d|d|d|d|d|d|d|d|d|d|d|d|d |d!|d"| d#d$d% |!D |"|$d&}%td'i |% d S )(Nr   r#   r3   r4   r5   r6   r7   r8   r9   r:   r@   rA   rB   rC   r;   r<   r=   r)   r>   r?   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   r/   c                 S   s   g | ]}| d dqS ):   )split)r   headerr   r   r   r   f  r   zmain.<locals>.<listcomp>)rR   rS   r   )syspathinsertr   run)&r#   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r)   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   r/   rR   r1   rS   kwargsr   r   r   main1   s     	
 !"#&r]   c                 K   s   t | fi |}t|d}|js|jdkr)t| ts)td}|d t	
d |jr?| }t||j|gd}|  d S |jdkrW| }t||j|gd}|  d S |  d S )N)configrU   r   zRYou must pass the application as an import string to enable 'reload' or 'workers'.)targetZsockets)r
   r   r=   r?   
isinstancestrlogging	getLoggerwarningrX   r   Zshould_reloadZbind_socketr   r[   r   )r#   r\   r^   serverloggersockZ
supervisorr   r   r   r[   m  s"   



r[   __main__)/rb   r   sslrX   typingr   r   Zuvicorn.configr   r   r   r   r   r   r   r	   r
   Zuvicorn.serverr   r   Zuvicorn.supervisorsr   r   ZChoicekeysZLEVEL_CHOICESZHTTP_CHOICESZ
WS_CHOICESZLIFESPAN_CHOICESZLOOP_CHOICESZINTERFACE_CHOICESrc   rf   r"   commandargumentoptionra   intfloatPath	CERT_NONEboolListr]   r[   __name__r   r   r   r   <module>   s   ,





	
 !"#$%XR

