a
    ~g                     @  st  U d Z 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
ZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ z"ddlZeejej fZ!de"d< W n2 e#y*   G dd dZ$e$ ZeejfZ!Y n0 dZ%ej&dkrbze'd W n e#y`   dZ%Y n0 e(edZ)e)rzej*Z*nG dd dZ*z
ej+Z,W n e-y   dZ,Y n0 dZ.ej/ej0de1e2ej/e2 f ej3d f  Z4ej5rddl6m7Z7 ddl6m8Z8 dd l9m:Z: dd!l;m<Z< G d"d# d#ej=Z>G d$d% d%eZ?d&d&d&d'd(d)Z@d`d*d+d,d-d.ZAdad&d*d*d/d0d1d2ZBdd3d4d5ZCdbd&d*d6dd7d8d9ZDdcd:d;d<d=d>ZEd&d?d@dAdBdCZFd&d?d@dDdEdFdGZGd@d&dHdIdJZHG dKdL dLeZIG dMdN dNejJeIZKG dOdP dPe*eIZLddd&d?dQd;d?dRd;dSd6dLdT
dUdVZMd;d3dWdXZNded&d?dQd;d;d;dZdZd?d&d;d?dRd[d;dSd\d]d^d_ZOdS )fa  A WSGI and HTTP server for use **during development only**. This
server is convenient to use, but is not designed to be particularly
stable, secure, or efficient. Use a dedicate WSGI server and HTTP
server when deploying to production.

It provides features like interactive debugging and code reloading. Use
``run_simple`` to start the server. Put this in a ``run.py`` script:

.. code-block:: python

    from myapp import create_app
    from werkzeug import run_simple
    )annotationsN)datetime)	timedelta)timezone)BaseHTTPRequestHandler)
HTTPServer)unquote)urlsplit   _log)_wsgi_encoding_dance)InternalServerError)
uri_to_iriztuple[type[Exception], ...]connection_dropped_errorsc                   @  s   e Zd ZdddddZdS )	_SslDummystrt.Anynamereturnc                 C  s   t dd S )NzUSSL is unavailable because this Python runtime was not compiled with SSL/TLS support.)RuntimeErrorselfr    r   U/var/www/html/emsaiapi.evdpl.com/venv/lib/python3.9/site-packages/werkzeug/serving.py__getattr__1   s    z_SslDummy.__getattr__N)__name__
__module____qualname__r   r   r   r   r   r   0   s   r   TntZcoloramaFforkc                   @  s   e Zd ZdS )ForkingMixInN)r   r   r   r   r   r   r   r"   H   s   r"      zssl.SSLContextadhoc)WSGIApplication)WSGIEnvironment)RSAPrivateKeyWithSerialization)Certificatec                   @  sL   e Zd ZdZdddddZddd	d
ZddddZdddddZdS )DechunkedInputz8An input stream that handles Transfer-Encoding 'chunked'zt.IO[bytes]None)rfiler   c                 C  s   || _ d| _d| _d S )NFr   )_rfile_done_len)r   r+   r   r   r   __init__c   s    zDechunkedInput.__init__boolr   c                 C  s   dS )NTr   r   r   r   r   readableh   s    zDechunkedInput.readableintc              
   C  sf   z"| j  d}t| d}W n. tyP } ztd|W Y d }~n
d }~0 0 |dk rbtd|S )Nlatin1   zInvalid chunk headerr   z!Negative chunk length not allowed)r,   readlinedecoder4   strip
ValueErrorOSError)r   liner.   er   r   r   read_chunk_lenk   s     zDechunkedInput.read_chunk_len	bytearray)bufr   c                 C  s   d}| j s|t|k r| jdkr*|  | _| jdkr:d| _ | jdkrtt|| j}|| t|kr| jt|| ||d < |  jt|| 8  _t|}n.| j||||| < |  j|8  _||7 }| jdkr| j }|dvrtdq|S )Nr   T)   
   
   z!Missing chunk terminating newline)	r-   lenr.   r>   minr,   readr7   r;   )r   r@   rF   n
terminatorr   r   r   readintou   s(    







zDechunkedInput.readintoN)r   r   r   __doc__r/   r3   r>   rI   r   r   r   r   r)   `   s
   
r)   c                      s   e Zd ZU dZded< eddddZddd	d
ZddddZdd fddZ	d3ddddddZ
ddd fddZddddZddddZedd  g ed!ed"d#D Zd$eed%< d4d'd'dd(d)d*Zdddd+d,d-Zdddd+d.d/Zddddd0d1d2Z  ZS )5WSGIRequestHandlerz3A request handler that implements WSGI dispatching.BaseWSGIServerserverr   r1   c                 C  s   | j jS N)rM   _server_versionr2   r   r   r   server_version   s    z!WSGIRequestHandler.server_versionr&   c                 C  s
  t | j}| jjd u rdnd}| js,d| _nt| jtrD| jdf| _|jsd|jrdd|j |j }n|j}t	|}d|| j
tj| jj| jjd| j| j| jdt|t|jt| jt| j|  |  | jjd t| jjd	 | jd
}| j D ]h\}}d|v rq| dd}|dd}|dvrPd| }||v rP||  d| }|||< q|dd  dkrd|d< t|d |d< |jr|jr|j|d< z*| jj dd}|d urt!"||d< W n4 t#y   | j$dd Y n t%y   Y n0 |S )Nhttphttps)<local>r   r   /)r
   r   F r
   )zwsgi.versionzwsgi.url_scheme
wsgi.inputzwsgi.errorszwsgi.multithreadzwsgi.multiprocesszwsgi.run_oncezwerkzeug.socketZSERVER_SOFTWAREREQUEST_METHODZSCRIPT_NAMEZ	PATH_INFOZQUERY_STRINGZREQUEST_URIZRAW_URIREMOTE_ADDRZREMOTE_PORTZSERVER_NAMEZSERVER_PORTZSERVER_PROTOCOL_-z
)ZCONTENT_TYPEZCONTENT_LENGTHZHTTP_,ZHTTP_TRANSFER_ENCODINGchunkedTzwsgi.input_terminatedrV   Z	HTTP_HOST)Zbinary_formZSSL_CLIENT_CERTerrorz&Cannot fetch SSL peer certificate info)&r	   pathrM   ssl_contextclient_address
isinstancer   schemeZnetlocr   r+   sysstderrmultithreadmultiprocess
connectionrP   commandr   Zqueryaddress_stringport_integerserver_addressrequest_versionheadersitemsupperreplacegetr9   lowerr)   ZgetpeercertsslZDER_cert_to_PEM_certr:   logAttributeError)r   Zrequest_urlZ
url_schemeZ	path_infoenvironkeyvalueZ	peer_certr   r   r   make_environ   sn    








zWSGIRequestHandler.make_environr*   c                   s  j dd  dkr&jd   _d d d d d ddd fd	d
dfdd	ddd fdd}z|jj	 W n t
y } z| W Y d }~nd }~0  ty } zjjr d ur
 r
d_z d u rd d |t  W n ty>   Y n0 ddlm} || }jdd|  W Y d }~n
d }~0 0 d S )NZExpectrU   z100-continues   HTTP/1.1 100 Continue

Fbytesr*   )datar   c                   s~  d usJ dd us J dd u rz d d\}}W n tyb   d }}Y n0 t|}|| t }D ]"\}}|| ||  qd|v sd dksd|  krdk sn |d	v sjd
krd dd dd 	  t
| tsJ d| rp rRjtt| dd    jd j|   rpjd j  d S )Nzwrite() before start_responser
   rU   zcontent-lengthrW   ZHEADd      >   i0     HTTP/1.1TzTransfer-Encodingr\   Z
Connectionclosezapplications must write bytes   rB   )splitr:   r4   Zsend_responsesetZsend_headeraddrr   protocol_versionZend_headersra   rz   wfilewritehexrD   encodeflush)r{   Zcode_strmsgcodeZheader_keysrw   rx   )chunk_responserv   headers_sentheaders_setr   status_sent
status_setr   r   r     sP    


	 z*WSGIRequestHandler.run_wsgi.<locals>.writec                   sD   |r,z r|d  |d W d }q8d }0 nr8td| |S )Nr
   r   zHeaders already set)with_tracebackAssertionError)Zstatusrm   exc_info)r   r   r   r   r   r   start_response<  s    z3WSGIRequestHandler.run_wsgi.<locals>.start_responser%   )appr   c              
     sJ  | }z|D ]}| qs*d  r:j d W t }|jtj d}d}|jddrj	d}|t
|7 }|d7 }|r|dks|d	kr\qq\|  t|d
r|  nt }|jtj d}d}|jddr(j	d}|t
|7 }|d7 }|r(|dks(|d	krܐq(q|  t|d
rD|  0 d S )N    s   0

r   g{Gz?)timeouti r
   l    d(	 i  r   )r   r   	selectorsZDefaultSelectorregisterrg   Z
EVENT_READZselectr+   rF   rD   r   hasattr)r   Zapplication_iterr{   ZselectorZ
total_sizeZtotal_reads)r   rv   r   r   r   r   r   r   executeJ  sD    



z,WSGIRequestHandler.run_wsgi.<locals>.executeTr
   )DebugTracebackr]   zError on request:
)N)rm   rq   rr   r9   r   r   ry   rv   rM   r   r   connection_dropped	Exceptionpassthrough_errorsZclose_connectionr   Zdebug.tbtoolsr   Zrender_traceback_textrt   )r   r   r=   r   r   r   )	r   rv   r   r   r   r   r   r   r   r   run_wsgi   s<     9' 
zWSGIRequestHandler.run_wsgic              
     s   zt    W nz ttjfyB } z| | W Y d}~nPd}~0  ty } z0| jjdurrt	|rr| 
d| n W Y d}~n
d}~0 0 dS )z/Handles a request ignoring dropped connections.NzSSL error occurred: %s)superhandleConnectionErrorsocketr   r   r   rM   r_   is_ssl_error	log_error)r   r=   	__class__r   r   r     s    zWSGIRequestHandler.handleNBaseExceptionzWSGIEnvironment | None)r]   rv   r   c                 C  s   dS )z`Called if the connection was closed by the client.  By default
        nothing happens.
        Nr   )r   r]   rv   r   r   r   r     s    z%WSGIRequestHandler.connection_droppedr   r   c                   s   | dr| jS tt |S )NZdo_)
startswithr   getattrr   r   r   r   r   r     s    
zWSGIRequestHandler.__getattr__c                 C  s*   t | dd r| jd S | js dS | jd S )Nrv   rX   rS   r   )r   rv   r`   r2   r   r   r   ri     s
    
z!WSGIRequestHandler.address_stringr4   c                 C  s
   | j d S )Nr
   )r`   r2   r   r   r   rj     s    zWSGIRequestHandler.port_integerc                 C  s   i | ]}|d |dqS )z\xZ02xr   ).0cr   r   r   
<dictcomp>  r   zWSGIRequestHandler.<dictcomp>          z\\\rZ   z	int | str)r   sizer   c                 C  s   z&t | j}| j d| d| j }W n ty>   | j}Y n0 || j}t|}|d dkrlt	|d}np|dkrvnf|dkrt	|d}nR|d dkrt	|d	}n:|d
krt	|d}n&|d dkrt	|dd}nt	|dd}| 
dd||| d S )N r   1boldZ200Z304cyan3greenZ404yellow4redmagentainfoz
"%s" %s %s)r   r^   rh   rl   ru   Zrequestline	translate_control_char_tabler   _ansi_stylert   )r   r   r   r^   r   r   r   r   log_request  s*    
zWSGIRequestHandler.log_request)formatargsr   c                 G  s   | j d|g|R   d S )Nr]   rt   r   r   r   r   r   r   r     s    zWSGIRequestHandler.log_errorc                 G  s   | j d|g|R   d S )Nr   r   r   r   r   r   log_message  s    zWSGIRequestHandler.log_messagetypemessager   r   c                 G  s<   |   dd}t|| d|   d| dg|R   d S )N%z%%z - - [z] 
)ri   rp   r   Zlog_date_time_string)r   r   r   r   ri   r   r   r   rt     s    zWSGIRequestHandler.log)N)rZ   rZ   )r   r   r   rJ   __annotations__propertyrP   ry   r   r   r   r   ri   rj   r   	maketransranger   ordr   r   r   rt   __classcell__r   r   r   r   rK      s*   
Q  	rK   r   )rx   stylesr   c                 G  sB   t s| S ddddddd}|D ]}d||  d	|  } q|  d
S )Nr
      r   !   #   $   )r   r   r   r   r   r   z[mz[0m)_log_add_style)rx   r   ZcodesZstyler   r   r   r     s    	r   z
str | Nonez2tuple[Certificate, RSAPrivateKeyWithSerialization])cnr   c           
      C  sF  z@ddl m} ddlm} ddlm} ddlm} ddlm	} W n t
y\   tdd Y n0 | }|jdd	|d
}| d u rd} |||jd||j| g}| }| ||| | ttjttjtdd j||j gddj|!|"| |"d|  gdd#||$ |}	|	|fS )Nr   )x509)default_backend)hashes)rsa)NameOIDz<Using ad-hoc certificates requires the cryptography library.i  i   )Zpublic_exponentZkey_sizebackend*zDummy Certificateim  )ZdaysF)Zcriticalz*.)%Zcryptographyr   Zcryptography.hazmat.backendsr   cryptography.hazmat.primitivesr   Z)cryptography.hazmat.primitives.asymmetricr   Zcryptography.x509.oidr   ImportError	TypeErrorZgenerate_private_keyZNameZNameAttributeZORGANIZATION_NAMEZCOMMON_NAMEZCertificateBuilderZsubject_nameZissuer_nameZ
public_keyZserial_numberZrandom_serial_numberZnot_valid_beforedtZnowr   ZutcZnot_valid_afterr   add_extensionZExtendedKeyUsageZOID_SERVER_AUTHZSubjectAlternativeNameZDNSNameZsignZSHA256)
r   r   r   r   r   r   r   pkeyZsubjectcertr   r   r   generate_adhoc_ssl_pair  s\    
	
r   ztuple[str, str])	base_pathhostr   r   c           	      C  s   |dur|}t |d\}}ddlm} |  d}|  d}t|d$}|||jj W d   n1 sn0    Y  t|d2}||j|jj|j	j
| d W d   n1 s0    Y  ||fS )	a  Creates an SSL key for development.  This should be used instead of
    the ``'adhoc'`` key which generates a new cert on each server start.
    It accepts a path for where it should store the key and cert and
    either a host or CN.  If a host is given it will use the CN
    ``*.host/CN=host``.

    For more information see :func:`run_simple`.

    .. versionadded:: 0.9

    :param base_path: the path to the certificate and key.  The extension
                      ``.crt`` is added for the certificate, ``.key`` is
                      added for the key.
    :param host: the name of the host.  This can be used as an alternative
                 for the `cn`.
    :param cn: the `CN` to use.
    N)r   r   serializationz.crtz.keywbencodingr   Zencryption_algorithm)r   r   r   openr   public_bytesEncodingPEMprivate_bytesPrivateFormatTraditionalOpenSSLNoEncryption)	r   r   r   r   r   r   	cert_file	pkey_filefr   r   r   make_ssl_devcert)  s"    

2"r   r1   c            
      C  s   ddl } ddl}t \}}ddlm} | \}}| \}}| tj| | tj| t	||
|jj t	||j|jj|jj| d t| t| t||}	|	S )z:Generates an adhoc SSL context for the development server.r   Nr   r   )atexittempfiler   r   r   Zmkstempr   osremover   r   r   r   r   r   r   r   r   load_ssl_context)
r   r   r   r   r   Zcert_handler   Zpkey_handler   ctxr   r   r   generate_adhoc_ssl_contextU  s*    
	


r  
int | None)r   r   protocolr   c                 C  s(   |du rt j}t |}|| | |S )a  Loads SSL context from cert/private key files and optional protocol.
    Many parameters are directly taken from the API of
    :py:class:`ssl.SSLContext`.

    :param cert_file: Path of the certificate to use.
    :param pkey_file: Path of the private key to use. If not given, the key
                      will be obtained from the certificate file.
    :param protocol: A ``PROTOCOL`` constant from the :mod:`ssl` module.
        Defaults to :data:`ssl.PROTOCOL_TLS_SERVER`.
    N)rs   ZPROTOCOL_TLS_SERVERZ
SSLContextZload_cert_chain)r   r   r  r  r   r   r   r  s  s
    
r  zException | Noner0   )r]   r   c                 C  s(   | du rt tt d } t| tjS )z?Checks if the given error (or the current one) is an SSL error.Nr
   )tcastr   rc   r   ra   rs   ZSSLError)r]   r   r   r   r     s    r   r4   zsocket.AddressFamily)r   portr   c                 C  s.   |  drtjS d| v r(ttdr(tjS tjS )zUReturn ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on
    the host and port.zunix://:AF_INET6)r   r   AF_UNIXr   r  AF_INET)r   r	  r   r   r   select_address_family  s
    
r  tuple[str, int] | str)r   r	  familyr   c                 C  sb   |t krtj| dd S zt| ||tjtj}W n tj	yT   | |f Y S 0 |d d S )zVReturn a fully qualified socket address that can be passed to
    :func:`socket.bind`.://r   r      )
af_unixr   r^   abspath	partitionr   ZgetaddrinfoSOCK_STREAMZIPPROTO_TCPZgaierror)r   r	  r  resr   r   r   get_sockaddr  s    r  )r  r   c              	   C  s   | t jkrdnd}t  | t jb}z||df W n2 tyf   | t jkrPdnd Y W  d   S 0 | d W  d   S 1 s0    Y  dS )zGet the IP address of an external interface. Used when binding to
    0.0.0.0 or ::1 to show a more useful URL.

    :meta private:
    zfd31:f903:5ab5:1::1z10.253.155.219i2  z::1	127.0.0.1Nr   )r   r  Z
SOCK_DGRAMZconnectr;   getsockname)r  r   sr   r   r   get_interface_ip  s    &r  c                
      s   e Zd ZdZdZdZeZdZd ddddd	d
ddd fddZ	dddddddZ
d!ddd fddZdddd fddZddddZ  ZS )"rL   zuA WSGI server that that handles one request at a time.

    Use :func:`make_server` to create a server instance.
    FTNr   r4   r%   type[WSGIRequestHandler] | Noner0   _TSSLContextArg | Noner  r*   )r   r	  r   handlerr   r_   fdr   c              
     s   |d u rt }dt|vr*| js$| jr*d|_|| _|| _|| _|| _t	|| | _
}t|t||}	|tkr|d u rtt|	}	tj|	rt|	 t j|	|dd |d u rtz|   |   W n tyT }
 zv|   t|
jtjd |
jtj kr6td| dtjd tj!dkr6|d	kr6td
tjd t"d W Y d }
~
n&d }
~
0  t#yp   |    Y n0 n&|   t$%||t$j&| _$| j$' | _(|tkr| j(d | _|d urt)|t*rt+| }n|dkrt, }|j-| j$dd| _$|| _.nd | _.dd l/}d|j01d | _2d S )Nr   r   F)Zbind_and_activate)filezPort zp is in use by another program. Either identify and stop that program, or start the server with a different port.darwini  zoOn macOS, try disabling the 'AirPlay Receiver' service from System Preferences -> General -> AirDrop & Handoff.r
   r$   T)Zserver_sider   z	Werkzeug/Zwerkzeug)3rK   varsre   rf   r   r   r	  r   r   r  address_familyr  r4   r  r  r  r   r   r^   existsunlinkr   r/   Zserver_bindZserver_activater;   server_closeprintstrerrorrc   rd   errnoZ
EADDRINUSEplatformexitr   r   Zfromfdr  r  rk   ra   tupler  r  Zwrap_socketr_   importlib.metadatametadataversionrO   )r   r   r	  r   r  r   r_   r   r$  rk   r=   	importlibr   r   r   r/     sv    








zBaseWSGIServer.__init__r   r   c                 G  s   t ||g|R   d S rN   r   )r   r   r   r   r   r   r   rt   .  s    zBaseWSGIServer.log      ?float)poll_intervalr   c                   sB   z2zt  j|d W n ty&   Y n0 W |   n
|   0 d S )N)r4  )r   serve_foreverKeyboardInterruptr'  )r   r4  r   r   r   r5  1  s
    zBaseWSGIServer.serve_foreverr  )requestr`   r   c                   s   | j r t ||S rN   )r   r   handle_error)r   r7  r`   r   r   r   r8  9  s    zBaseWSGIServer.handle_errorr1   c                 C  s   d}t |dd}|g}| jtkr4|d| j  n| jdu rBdnd}| j}| jdv r|d	| j d
 | jdkrd}ttj}nd}ttj	}|d| d| d| j
  d|v rd| d}|d| d| d| j
  tdd| dS )z<Show information about the address when starting the server.zvWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.r   r   z * Running on NrQ   rR   >   z::0.0.0.0z * Running on all addresses ()r9  r  z[::1]r  r
  []r   r   )r   r$  r  appendr   r_   r  r   r  r  r	  r   join)r   Zdev_warningZmessagesrb   Zdisplay_hostnameZ	localhostr   r   r   log_startupA  s(    



zBaseWSGIServer.log_startup)NFNN)r2  )r   r   r   rJ   re   rf   LISTEN_QUEUEZrequest_queue_sizeZallow_reuse_addressr/   rt   r5  r8  r?  r   r   r   r   r   rL     s       "grL   c                   @  s   e Zd ZdZdZdZdS )ThreadedWSGIServerzA WSGI server that handles concurrent requests in separate
    threads.

    Use :func:`make_server` to create a server instance.
    TN)r   r   r   rJ   re   Zdaemon_threadsr   r   r   r   rA  d  s   rA  c                      s<   e Zd ZdZdZdddddd	d
dddd	 fddZ  ZS )ForkingWSGIServerzA WSGI server that handles concurrent requests in separate forked
    processes.

    Use :func:`make_server` to create a server instance.
    T(   NFr   r4   r%   r  r0   r  r  r*   )	r   r	  r   	processesr  r   r_   r   r   c	           	   	     s.   t stdt ||||||| || _d S )Nz'Your platform does not support forking.)can_forkr:   r   r/   Zmax_children)	r   r   r	  r   rD  r  r   r_   r   r   r   r   r/   x  s    zForkingWSGIServer.__init__)rC  NFNN)r   r   r   rJ   rf   r/   r   r   r   r   r   rB  o  s        rB  r%   r  r  )
r   r	  r   threadedrD  request_handlerr   r_   r   r   c	           	   
   C  sd   |r|dkrt d|r.t| ||||||dS |dkrNt| |||||||dS t| ||||||dS )a6  Create an appropriate WSGI server instance based on the value of
    ``threaded`` and ``processes``.

    This is called from :func:`run_simple`, but can be used separately
    to have access to the server object, such as to run it in a separate
    thread.

    See :func:`run_simple` for parameter docs.
    r
   z4Cannot have a multi-thread and multi-process server.r   )r:   rA  rB  rL   )	r   r	  r   rF  rD  rG  r   r_   r   r   r   r   make_server  s(    rI  c                   C  s   t jddkS )zqCheck if the server is running as a subprocess within the
    Werkzeug reloader.

    .. versionadded:: 0.10
    ZWERKZEUG_RUN_MAINtrue)r   rv   rq   r   r   r   r   is_running_from_reloader  s    rK  autozt.Iterable[str] | Nonez'dict[str, str | tuple[str, str]] | Noner*   )hostnamer	  applicationuse_reloaderuse_debugger
use_evalexextra_filesexclude_patternsreloader_intervalreloader_typerF  rD  rG  static_filesr   r_   r   c                 C  s  t |tstd|r,ddlm} |||}|rTddlm} |||d}|j|  t	 s`d}ntt
jd }t| |||
|||||d	}|jd	 t| t
jd< t	 s|  td
tdd |rddlm} z ||j||||	d W |  n
|  0 n|  dS )a  Start a development server for a WSGI application. Various
    optional features can be enabled.

    .. warning::

        Do not use the development server when deploying to production.
        It is intended for use only during local development. It is not
        designed to be particularly efficient, stable, or secure.

    :param hostname: The host to bind to, for example ``'localhost'``.
        Can be a domain, IPv4 or IPv6 address, or file path starting
        with ``unix://`` for a Unix socket.
    :param port: The port to bind to, for example ``8080``. Using ``0``
        tells the OS to pick a random free port.
    :param application: The WSGI application to run.
    :param use_reloader: Use a reloader process to restart the server
        process when files are changed.
    :param use_debugger: Use Werkzeug's debugger, which will show
        formatted tracebacks on unhandled exceptions.
    :param use_evalex: Make the debugger interactive. A Python terminal
        can be opened for any frame in the traceback. Some protection is
        provided by requiring a PIN, but this should never be enabled
        on a publicly visible server.
    :param extra_files: The reloader will watch these files for changes
        in addition to Python modules. For example, watch a
        configuration file.
    :param exclude_patterns: The reloader will ignore changes to any
        files matching these :mod:`fnmatch` patterns. For example,
        ignore cache files.
    :param reloader_interval: How often the reloader tries to check for
        changes.
    :param reloader_type: The reloader to use. The ``'stat'`` reloader
        is built in, but may require significant CPU to watch files. The
        ``'watchdog'`` reloader is much more efficient but requires
        installing the ``watchdog`` package first.
    :param threaded: Handle concurrent requests using threads. Cannot be
        used with ``processes``.
    :param processes: Handle concurrent requests using up to this number
        of processes. Cannot be used with ``threaded``.
    :param request_handler: Use a different
        :class:`~BaseHTTPServer.BaseHTTPRequestHandler` subclass to
        handle requests.
    :param static_files: A dict mapping URL prefixes to directories to
        serve static files from using
        :class:`~werkzeug.middleware.SharedDataMiddleware`.
    :param passthrough_errors: Don't catch unhandled exceptions at the
        server level, let the server crash instead. If ``use_debugger``
        is enabled, the debugger will still catch such errors.
    :param ssl_context: Configure TLS to serve over HTTPS. Can be an
        :class:`ssl.SSLContext` object, a ``(cert_file, key_file)``
        tuple to create a typical context, or the string ``'adhoc'`` to
        generate a temporary self-signed certificate.

    .. versionchanged:: 2.1
        Instructions are shown for dealing with an "address already in
        use" error.

    .. versionchanged:: 2.1
        Running on ``0.0.0.0`` or ``::`` shows the loopback IP in
        addition to a real IP.

    .. versionchanged:: 2.1
        The command-line interface was removed.

    .. versionchanged:: 2.0
        Running on ``0.0.0.0`` or ``::`` shows a real IP address that
        was bound as well as a warning not to run the development server
        in production.

    .. versionchanged:: 2.0
        The ``exclude_patterns`` parameter was added.

    .. versionchanged:: 0.15
        Bind to a Unix socket by passing a ``hostname`` that starts with
        ``unix://``.

    .. versionchanged:: 0.10
        Improved the reloader and added support for changing the backend
        through the ``reloader_type`` parameter.

    .. versionchanged:: 0.9
        A command-line interface was added.

    .. versionchanged:: 0.8
        ``ssl_context`` can be a tuple of paths to the certificate and
        private key files.

    .. versionchanged:: 0.6
        The ``ssl_context`` parameter was added.

    .. versionchanged:: 0.5
       The ``static_files`` and ``passthrough_errors`` parameters were
       added.
    zport must be an integerr
   )SharedDataMiddleware)DebuggedApplication)ZevalexNZWERKZEUG_SERVER_FDrH  Tr   zPress CTRL+C to quitr   )run_with_reloader)rR  rS  ZintervalrU  )ra   r4   r   Zmiddleware.shared_datarW  debugrX  Ztrusted_hostsr=  rK  r   rv   rI  r   set_inheritabler   filenor?  r   r   Z	_reloaderrY  r5  r'  )rM  r	  rN  rO  rP  rQ  rR  rS  rT  rU  rF  rD  rG  rV  r   r_   rW  rX  r   ZsrvrY  r   r   r   
run_simple  sP    p

r]  )N)NN)NN)N)Fr
   NFNN)FFTNNr
   rL  Fr
   NNFN)PrJ   
__future__r   r*  ior   r   r   Zsocketserverrc   typingr  r   r   r   r   Zhttp.serverr   r   Zurllib.parser   r	   Z	_internalr   r   
exceptionsr   Zurlsr   rs   r   r   ZSSLEOFErrorr   r   r   r   r   r   
__import__r   rE  r"   r  r  ru   r@  OptionalUnionr-  r   LiteralZ_TSSLContextArgTYPE_CHECKINGZ_typeshed.wsgir%   r&   Z-cryptography.hazmat.primitives.asymmetric.rsar'   Zcryptography.x509r(   	RawIOBaser)   rK   r   r   r   r  r  r   r  r  r  rL   ZThreadingMixInrA  rB  rI  rK  r]  r   r   r   r   <module>   s   



">  I 2 , 
 )      "-             