/usr/local/lib/python3.6/site-packages/werkzeug/__pycache__
NameSizeModeActions
datastructures.cpython-36.pyc1077480644editdlrm
exceptions.cpython-36.pyc306390644editdlrm
filesystem.cpython-36.pyc20250644editdlrm
formparser.cpython-36.pyc138140644editdlrm
http.cpython-36.pyc379050644editdlrm
local.cpython-36.pyc226910644editdlrm
routing.cpython-36.pyc729310644editdlrm
security.cpython-36.pyc80400644editdlrm
serving.cpython-36.pyc304780644editdlrm
test.cpython-36.pyc389610644editdlrm
testapp.cpython-36.pyc95490644editdlrm
urls.cpython-36.pyc364140644editdlrm
useragents.cpython-36.pyc74170644editdlrm
user_agent.cpython-36.pyc17200644editdlrm
utils.cpython-36.pyc329600644editdlrm
wsgi.cpython-36.pyc301020644editdlrm
_internal.cpython-36.pyc182680644editdlrm
_reloader.cpython-36.pyc118990644editdlrm
__init__.cpython-36.pyc3100644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/werkzeug/__pycache__/serving.cpython-36.pyc (30478B)
3 _TBg.@sZdZddlZddlZddlZddlZddlZddlZddlZddlZ ddl Z ddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZy ddlZWn*ek rGdddZeZYnXdZejdkr@y e dWnek r>dZYnXe!edZ"e"rXej#Z#nGdddZ#y ej$Z%Wne&k rdZ%YnXdZ'ej(dk oe!edZ)e j*e j+de j,e-e j*e-fdfZ.e j/rddl0Z1ddl2m3Z3ddl2m4Z4ddl5m6Z6dd l7m8Z8Gd!d"d"ej9Z:Gd#d$d$eZ;e-e-e-d%d&d'Zdd0d1d2Z?d[e-e j*e-e j*e@dd3d4d5ZAd\e j*eBeCd6d7d8ZDe-e@ejEd9d:d;ZFe-e@ejEe j+e j,e-e@fe-fd<d=d>ZGejEe-d?d@dAZHGdBdCdCeZIGdDdEdEejJeIZKGdFdGdGe#eIZLd]e-e@dHeCe@e j*e jMe;eCe j*e.e j*e@eIdI dJdKZNeCd0dLdMZOd^e-e@dHeCeCeCe j*e jPe-e j*e jPe-e@e-eCe@e j*e jMe;e j*e jQe-e j+e-e j,e-e-fffeCe j*e.ddOdPdQZRe jSe jSddRdSdTZTdd0dUdVZUeVdWkrVeUdS)_aA 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 N)datetime) timedelta)timezone)BaseHTTPRequestHandler) HTTPServer)_log)_wsgi_encoding_dance)InternalServerError) uri_to_iri) url_parse) url_unquotec@seZdZeejdddZdS) _SslDummy)namereturncCs tddS)NzUSSL is unavailable because this Python runtime was not compiled with SSL/TLS support.) RuntimeError)selfrr4/tmp/pip-build-0s3hx122/Werkzeug/werkzeug/serving.py __getattr__)sz_SslDummy.__getattr__N)__name__ __module__ __qualname__strtAnyrrrrrr(srTntcoloramaFforkc@s eZdZdS) ForkingMixInN)rrrrrrrr?srWindowsfromfdzssl.SSLContextzte.Literal['adhoc'])WSGIApplication)WSGIEnvironment)RSAPrivateKeyWithSerialization) Certificatec@sReZdZdZejeddddZedddZ e dd d Z e e d d d Z dS)DechunkedInputz8An input stream that handles Transfer-Encoding 'chunked'N)rfilercCs||_d|_d|_dS)NFr)_rfile_done_len)rr(rrr__init__\szDechunkedInput.__init__)rcCsdS)NTr)rrrrreadableaszDechunkedInput.readablecCsdy"|jjjd}t|jd}Wn,tk rN}ztd|WYdd}~XnX|dkr`td|S)Nlatin1zInvalid chunk headerrz!Negative chunk length not allowed)r)readlinedecodeintstrip ValueErrorOSError)rliner+errrread_chunk_lendszDechunkedInput.read_chunk_len)bufrcCsd}x|j r|t|kr|jdkr.|j|_|jdkr>d|_|jdkrtt||j}||t|kr|jjt||||d<|jt||8_t|}n.|jj|||||<|j|8_||7}|jdkr|jj}|dkrtdqW|S)NrT   z!Missing chunk terminating newline)r:r;r<) r*lenr+r8minr)readr0r5)rr9r?n terminatorrrrreadintons(        zDechunkedInput.readinto)rrr__doc__rZIObytesr,boolr-r2r8 bytearrayrBrrrrr'Ys  r'cs:eZdZUdZdeedddZddddZd dd d Z d dd d Z d dddZ d*e e jdd dddZd dddZd+ee jed dddZedfdd ZedddZedddZd,e jeefe jeefd dd d!Zee jd d"d#d$Zee jd d"d%d&Zeee jd d'd(d)ZZS)-WSGIRequestHandlerz3A request handler that implements WSGI dispatching.BaseWSGIServer)rcCsddlm}d|S)Nr) __version__z Werkzeug/)rI)rrIrrrserver_versions z!WSGIRequestHandler.server_versionr$c stj}ddfdd }jjdkr,dnd}js>d_ntjtrVjdf_|j rx|jrxd|j|j}n|j}t |}d|j t j jj jjd |jjjd t|t|jtjtjjjjjdtjjd jd }xljjD]^\}}|jjd d}|jdd }|d kr\d|}||kr\||d|}|||<qW|jdd jjdkrd|d<t|d|d<|jr|jr|j|d<y*jj dd}|dk rt!j"||d<Wn8t#k rjj$ddYnt%k rYnX|S)!N)rcstjddddj_dS)NzeThe 'environ['werkzeug.server.shutdown']' function is deprecated and will be removed in Werkzeug 2.1.) stacklevelT)warningswarnservershutdown_signalr)rrrshutdown_serversz8WSGIRequestHandler.make_environ..shutdown_serverhttphttpsr/rFrJ)z wsgi.versionzwsgi.url_schemez wsgi.inputz wsgi.errorszwsgi.multithreadzwsgi.multiprocessz wsgi.run_oncezwerkzeug.server.shutdownzwerkzeug.socketZSERVER_SOFTWAREREQUEST_METHODZ SCRIPT_NAMEZ PATH_INFO QUERY_STRINGZ REQUEST_URIZRAW_URI REMOTE_ADDRZ REMOTE_PORTZ SERVER_NAMEZ SERVER_PORTZSERVER_PROTOCOL-_z CONTENT_TYPECONTENT_LENGTHZHTTP_,ZHTTP_TRANSFER_ENCODINGchunkedTzwsgi.input_terminatedz wsgi.inputZ HTTP_HOST) binary_formZSSL_CLIENT_CERTerrorz&Cannot fetch SSL peer certificate info)rUr)rr)r\r])&r pathrP ssl_contextclient_address isinstancerschemenetlocr r(sysstderr multithread multiprocess connectionrKcommandr queryaddress_string port_integerserver_addressrequest_versionheadersitemsupperreplacegetr3lowerr' getpeercertsslDER_cert_to_PEM_certr4logAttributeError) r request_urlrRZ url_schemeZ path_infoenvironkeyvalueZ peer_certr)rr make_environsn           zWSGIRequestHandler.make_environNcsXjjddjjdkr&jjdj_ddddtddfdd dfdd d dd fd d }y|j j Wnt t j fk r}zj|WYdd}~Xntk rRj jrddlm}|dd}y dkrdd|tWntk r:YnXj jdd|jYnXdS)NZExpectrJz 100-continuesHTTP/1.1 100 Continue )datarc sPdk stddk s tddkr"yjdd\}}Wntk rdd}}YnXt|}j||t}x.D]&\}}j|||j}|j|qWd|kp҈ddkp|dkp|dksd _ jd d d |krjdj d|krjdj j t |ts6tdjj|jjdS)Nzwrite() before start_responserrJzcontent-lengthrWHEAD0T ConnectioncloserPServerdateDatezapplications must write bytes)rr)AssertionErrorsplitr4r2 send_responsesetZ send_headerrxaddclose_connectionversion_stringZdate_time_stringZ end_headersrerDwfilewriteflush)rZcode_strmsgcodeZ header_keysrr)r headers_sent headers_setr status_sent status_setrrrs<        z*WSGIRequestHandler.run_wsgi..writec s@|r(zr|dj|dWdd}Xn r4td||S)NrrLzHeaders already set)with_tracebackr)statusrsexc_info)rrrrrrstart_response*sz3WSGIRequestHandler.run_wsgi..start_responser#)apprc sJ|}z&x|D] }|qWs.dWdt|drD|jXdS)Nr)hasattrr)rZapplication_iterr)rrrrrrexecute8s     z,WSGIRequestHandler.run_wsgi..executer)get_current_tracebackT)Zignore_system_exceptionsrazError on request: %s)N)rsrwrxr3rrrrrDrPrConnectionErrorsockettimeoutconnection_dropped Exceptionpassthrough_errorsZ debug.tbtoolsrr r| plaintext)rrr7r tracebackr)rrrrrrrrrrun_wsgis6 $    zWSGIRequestHandler.run_wsgicCsytj|Wnvttjfk r@}z|j|WYdd}~XnFtk r}z*|jjdk rrt |rr|j d|nWYdd}~XnX|jj r|j dS)z/Handles a request ignoring dropped connections.NzSSL error occurred: %s) rhandlerrrrrrPrc is_ssl_error log_errorrQinitiate_shutdown)rr7rrrrXszWSGIRequestHandler.handlecCs0tr$ttdtj}tjtj|d|j_dS)NSIGKILLT) is_running_from_reloadergetattrsignalSIGTERMoskillgetpidrP_BaseServer__shutdown_request)rsigrrrrfsz$WSGIRequestHandler.initiate_shutdown)rarrcCsdS)z`Called if the connection was closed by the client. By default nothing happens. Nr)rrarrrrrnsz%WSGIRequestHandler.connection_droppedcCs.|jj|_|jsd|_n|jr*|jdS)zHandle a single HTTP request.TN)r(r0Zraw_requestlinerZ parse_requestr)rrrrhandle_one_requestus  z%WSGIRequestHandler.handle_one_request)rmessagercCsf|j||dkr.||jkr*|j|dnd}|jdkrb|jd|d|d}|jj|jddS)z3Send the response header and log the response code.NrrJzHTTP/0.9 z ascii) log_request responsesrrZprotocol_versionrrencode)rrrhdrrrrr}s   z WSGIRequestHandler.send_responsecstjjS)N)superrr3)r) __class__rrrsz!WSGIRequestHandler.version_stringcCs*t|ddr|jdS|js dS|jdS)NrrYzr)rrrd)rrrrros   z!WSGIRequestHandler.address_stringcCs |jdS)Nr)rd)rrrrrpszWSGIRequestHandler.port_integerrZ)rsizercCsy&t|j}|jd|d|j}Wntk r@|j}YnXt|}tr|ddkrft|d}np|dkrpnf|dkrt|d}nR|ddkrt|d }n:|d krt|d }n&|dd krt|dd }n t|dd}|j dd|||dS)Nrr1boldZ200Z304cyan3greenZ404yellow4redmagentainfoz "%s" %s %s) r rbrmrrr}Z requestliner_log_add_style _ansi_styler|)rrrrbrrrrrs*          zWSGIRequestHandler.log_request)formatargsrcGs|jd|f|dS)Nra)r|)rrrrrrrszWSGIRequestHandler.log_errorcGs|jd|f|dS)Nr)r|)rrrrrr log_messageszWSGIRequestHandler.log_message)typerrrcGs.t||jd|jd|df|dS)Nz - - [z]  )rroZlog_date_time_string)rrrrrrrr|szWSGIRequestHandler.log)N)N)rZrZ)rrrrCrPpropertyrrKrrrr BaseExceptionrOptionalrrr2rrrorpUnionrrrrr| __classcell__rr)rrrGs( Z\   rG)rstylesrcGs>ddddddd}x |D]}d||d |}qW|d S) Nr !#$)rrrrrrz[mzr)rrcodesstylerrrrs rr&r%)cnrc Cs:y@ddlm}ddlm}ddlm}ddlm}ddlm }Wnt k r^t ddYnX|}|j dd |d }|dkrd }|j |j|jd |j|j|g}|}|jj|j|j|jj|jjtjtjjtjtjtd dj|j|j gddj|j!|j"|gddj#||j$|} | |fS)Nr)x509)NameOID)default_backend)hashes)rsazs  zBaseWSGIServer.serve_forever)requestrdrcs|jrtj||S)N)rr handle_error)rrArd)rrrrBszBaseWSGIServer.handle_error)NFNN)r<)rrrrCrjrk LISTEN_QUEUErequest_queue_sizerr2rrTyperGrE_TSSLContextArgr,rr|floatr>rTuplerBrrr)rrrHs(, rHc@seZdZdZdZdZdS)ThreadedWSGIServerz"A WSGI server that does threading.TN)rrrrCrjdaemon_threadsrrrrrIsrIc @sLeZdZdZdZd eedeejej e e eje ejedd dd Z dS) ForkingWSGIServerz A WSGI server that does forking.T(NFr#) rrr processesr4rrcr5rc Cs.ts tdtj||||||||||_dS)Nz'Your platform does not support forking.)can_forkr4rHr, max_children) rrrrrMr4rrcr5rrrr,s zForkingWSGIServer.__init__)rLNFNN)rrrrCrkrr2rrrErGrErFr,rrrrrKs*rKr#) rrrthreadedrMrequest_handlerrrcr5rc Csj|r|dkrtdnP|r0t|||||||dS|dkrPt||||||||dSt|||||||dSdS)ztCreate a new server instance that is either threaded, or forks or just processes one request after another. rz5cannot have a multithreaded and multi process server.)r5N)r4rIrKrH) rrrrPrMrQrrcr5rrr make_servers"  rRcCstjjddkS)zwChecks if the application is running from within the Werkzeug reloader subprocess. .. versionadded:: 0.10 ZWERKZEUG_RUN_MAINtrue)rrrwrrrrr)srauto)hostnamer application use_reloader use_debugger use_evalex extra_filesexclude_patternsreloader_interval reloader_typerPrMrQ static_filesrrcrc sxttstd|r,ddlm}||| rFddlm}|| tjddfdd dd f d d }|rntsNd krt rt d t }t |}tj|tj }|jtjtjd|j||jdt rt|jtjd<|jt|n4|j|tkrNtjt|}tdd|tj|ddlm }|||||| dn|dS)aStart a WSGI application. Optional features include a reloader, multithreading and fork support. This function has a command-line interface too:: python -m werkzeug.serving --help .. versionchanged:: 2.0 Added ``exclude_patterns`` parameter. .. versionadded:: 0.5 `static_files` was added to simplify serving of static files as well as `passthrough_errors`. .. versionadded:: 0.6 support for SSL was added. .. versionadded:: 0.8 Added support for automatically loading a SSL context from certificate file and private key. .. versionadded:: 0.9 Added command-line interface. .. versionadded:: 0.10 Improved the reloader and added support for changing the backend through the `reloader_type` parameter. See :ref:`reloader` for more information. .. versionchanged:: 0.15 Bind to a Unix socket by passing a path that starts with ``unix://`` as the ``hostname``. :param hostname: The host to bind to, for example ``'localhost'``. If the value is a path that starts with ``unix://`` it will bind to a Unix socket instead of a TCP socket.. :param port: The port for the server. eg: ``8080`` :param application: the WSGI application to execute :param use_reloader: should the server automatically restart the python process if modules were changed? :param use_debugger: should the werkzeug debugging system be used? :param use_evalex: should the exception evaluation feature be enabled? :param extra_files: a list of files the reloader should watch additionally to the modules. For example configuration files. :param exclude_patterns: List of :mod:`fnmatch` patterns to ignore when running the reloader. For example, ignore cache files that shouldn't reload when updated. :param reloader_interval: the interval for the reloader in seconds. :param reloader_type: the type of reloader to use. The default is auto detection. Valid values are ``'stat'`` and ``'watchdog'``. See :ref:`reloader` for more information. :param threaded: should the process handle each request in a separate thread? :param processes: if greater than 1 then handle each request in a new process up to this maximum number of concurrent processes. :param request_handler: optional parameter that can be used to replace the default one. You can use this to replace it with a different :class:`~BaseHTTPServer.BaseHTTPRequestHandler` subclass. :param static_files: a list or dict of paths for static files. This works exactly like :class:`SharedDataMiddleware`, it's actually just wrapping the application in that middleware before serving. :param passthrough_errors: set this to `True` to disable the error catching. This means that the server will die on errors but it can be useful to hook debuggers in (pdb etc.) :param ssl_context: an SSL context for the connection. Either an :class:`ssl.SSLContext`, a tuple in the form ``(cert_file, pkey_file)``, the string ``'adhoc'`` if the server should automatically create one, or ``None`` to disable SSL (which is the default). zport must be an integerr)DebuggedApplication)SharedDataMiddlewareN)sockrcsd}|jtkrtddnxdkr:td|ttj}n"dkrXtd|ttj}n}d|krpd|d }tdd dkrd nd ||jd dS)Nzp * Running on all addresses. WARNING: This is a development server. Do not use it in a production deployment.rz' * Running on %s (Press CTRL+C to quit)z0.0.0.0warningz::r []z0 * Running on %s://%s:%d/ (Press CTRL+C to quit)rSrTr)r&r(rr3rr$r!r1)raZall_addresses_messageZdisplay_hostname)rUrcrr log_startups$      zrun_simple..log_startup)rcshyttjd}Wnttfk r.d}YnXt|d }|dkr\|j|jdS)NWERKZEUG_SERVER_FD)r5)r2rr LookupErrorr4rRrr>)r5Zsrv) rVrUrerrrMrQrcrPrrinners"  zrun_simple..innerrzsCannot bind to a random port with enabled reloader if the Python interpreter does not support socket opening by fd.Trfrz Unlinking %s)run_with_reloader)rZr[intervalr])!rer2rdebugr_Zmiddleware.shared_datar`rrcan_open_by_fdr4r%r.r* setsockopt SOL_SOCKET SO_REUSEADDRbindset_inheritablerfilenorrlistenrCrr(rrrr9 _reloaderri)rUrrVrWrXrYrZr[r\r]rPrMrQr^rrcr_r`rhr7rqr2_rwrr) rVrUrerrrMrQrcrPr run_simple2sL]     "            rv)rkwargsrcOs*ddlm}tjdtdd|||dS)zRun a process with the reloader. This is not a public API, do not use this function. .. deprecated:: 2.0 Will be removed in Werkzeug 2.1. r)rizp'run_with_reloader' is a private API, it will no longer be accessible in Werkzeug 2.1. Use 'run_simple' instead.rL)rMN)rtrirNrODeprecationWarning)rrwrurrrris  ricCsddl}ddlm}tdd|jddd }|jd d d d d|jddddd|jddddd|jddd|j}d\}}|jr|jjd\}}}t |pdt |pd||j |j |j ddS)z:A simple command-line interface for :py:func:`run_simple`.rNr) import_stringrbz:This CLI is deprecated and will be removed in version 2.1.z;Run the given WSGI application with the development server.F) descriptionZ allow_abbrevz-bz--bindaddressz+The hostname:port the app should listen on.)desthelpz-dz--debug store_truez7Show the interactive debugger for unhandled exceptions.)actionr}z-rz--reloadz%Reload the process if modules change.rVz8Application to import and serve, in the form module:app.)r}r z 127.0.0.1i)rUrrVrWrX)NN)argparseutilsryrArgumentParser add_argument parse_argsr{ partitionrvr2rVreloadrk)rryparserrrUrr[rrrmainsB    r__main__)N)r&r%)NN)NN)N)FrNFNN) FFTNNrrTFrNNFN)WrCiorplatformrr socketserverrhZtypingrrNrrrrZ http.serverrrZ _internalrr exceptionsr urlsr r r rzrrrr __import__rrNrr#r(r}rCsystemrlrrrHrrFZ TYPE_CHECKINGZtyping_extensionsteZ_typeshed.wsgir#r$Z-cryptography.hazmat.primitives.asymmetric.rsar%Zcryptography.x509r& RawIOBaser'rGrrrrr2rrrEr AddressFamilyr%r.r3rHThreadingMixInrIrKrErRrIterableDictrvrrirrrrrr s                   "    >, -* "R, p:/