/usr/local/lib/python3.6/site-packages/werkzeug/middleware/__pycache__
NameSizeModeActions
dispatcher.cpython-36.pyc26960644editdlrm
http_proxy.cpython-36.pyc68030644editdlrm
lint.cpython-36.pyc127090644editdlrm
profiler.cpython-36.pyc48040644editdlrm
proxy_fix.cpython-36.pyc61030644editdlrm
shared_data.cpython-36.pyc98600644editdlrm
__init__.cpython-36.pyc6550644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/werkzeug/middleware/__pycache__/profiler.cpython-36.pyc (4804B)
3 _TBg# @sdZddlZddlZddlZddlZddlmZyddl m Z Wn e k r`ddl m Z YnXej rddlmZddlmZddlmZGdd d ZdS) a9 Application Profiler ==================== This module provides a middleware that profiles each request with the :mod:`cProfile` module. This can help identify bottlenecks in your code that may be slowing down your application. .. autoclass:: ProfilerMiddleware :copyright: 2007 Pallets :license: BSD-3-Clause N)Stats)Profile) StartResponse)WSGIApplication)WSGIEnvironmentc @steZdZdZejdfddfdejeej eej ej ee e fej eedddd Zd d ej ed d dZdS)ProfilerMiddlewareaWrap a WSGI application and profile the execution of each request. Responses are buffered so that timings are more exact. If ``stream`` is given, :class:`pstats.Stats` are written to it after each request. If ``profile_dir`` is given, :mod:`cProfile` data files are saved to that directory, one file per request. The filename can be customized by passing ``filename_format``. If it is a string, it will be formatted using :meth:`str.format` with the following fields available: - ``{method}`` - The request method; GET, POST, etc. - ``{path}`` - The request path or 'root' should one not exist. - ``{elapsed}`` - The elapsed time of the request. - ``{time}`` - The time of the request. If it is a callable, it will be called with the WSGI ``environ`` dict and should return a filename. :param app: The WSGI application to wrap. :param stream: Write stats to this stream. Disable with ``None``. :param sort_by: A tuple of columns to sort stats by. See :meth:`pstats.Stats.sort_stats`. :param restrictions: A tuple of restrictions to filter stats by. See :meth:`pstats.Stats.print_stats`. :param profile_dir: Save profile data files to this directory. :param filename_format: Format string for profile data file names, or a callable returning a name. See explanation above. .. code-block:: python from werkzeug.middleware.profiler import ProfilerMiddleware app = ProfilerMiddleware(app) .. versionchanged:: 0.15 Stats are written even if ``profile_dir`` is given, and can be disable by passing ``stream=None``. .. versionadded:: 0.15 Added ``filename_format``. .. versionadded:: 0.9 Added ``restrictions`` and ``profile_dir``. timecallsNz/{method}.{path}.{elapsed:.0f}ms.{time:.0f}.profr)appstreamsort_by restrictions profile_dirfilename_formatreturncCs(||_||_||_||_||_||_dS)N)_app_stream_sort_by _restrictions _profile_dir_filename_format)selfr r r r rrr@/tmp/pip-build-0s3hx122/Werkzeug/werkzeug/middleware/profiler.py__init__Ms zProfilerMiddleware.__init__rr)environstart_responserc sLgdfdd ddfdd }t}tj}|j|dj}tj|}jdk rtjrzj}n6jjddjd j d d pd |d tjd }t j jj|}|j |j dk rFt|j d} | jjtddj djdd} td| j d| jjtdddj d|gS)Ncs|||jS)N)append)statusheadersexc_info) response_bodyrrrcatching_start_responsebs z.catching_start_response)rcs4jtjd}j|t|dr0|jdS)Nrclose)rtcastextendhasattrr#)Zapp_iter)r"rr!rrrrunappfs   z+ProfilerMiddleware.__call__..runappREQUEST_METHODZ PATH_INFO/.rootg@@)methodpathelapsedr)r -P)filezPATH:  )N)rrZruncalljoinrcallablerformatstripreplaceosr/Z dump_statsrrZ sort_statsrprintgetZ print_statsr) rrrr(profilestartbodyr0filenamestatsZ path_infor)r"rr!rrr__call__]s6             zProfilerMiddleware.__call__)rr )__name__ __module__ __qualname____doc__sysstdoutr$ZIOstrIterableUnionintfloatOptionalrbytesrCrrrrrs,4 r)rGos.pathr;rHrZtypingr$ZpstatsrZcProfiler ImportErrorr>Z TYPE_CHECKINGZ_typeshed.wsgirrrrrrrr s