1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
U
Þ=®dã@s´dZddlmZddlZddlZddlZddlmZddl    m
Z
ddl m Z ddlmZdd    lmZd
Zd d œd d„Zejdddœdd„ƒZedkr°ddlmZeddedddS)z]A small application that can be used to test a WSGI server and check
it for WSGI compliance.
é)Ú annotationsN)Úwrap)Úescapeé)Ú __version__)ÚRequest)ÚResponseaz <!doctype html>
<html lang=en>
<title>WSGI Information</title>
<style type="text/css">
  @import url(https://fonts.googleapis.com/css?family=Ubuntu);
 
  body       { font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
               'Verdana', sans-serif; background-color: white; color: #000;
               font-size: 15px; text-align: center; }
  div.box    { text-align: left; width: 45em; margin: auto; padding: 50px 0;
               background-color: white; }
  h1, h2     { font-family: 'Ubuntu', 'Lucida Grande', 'Lucida Sans Unicode',
               'Geneva', 'Verdana', sans-serif; font-weight: normal; }
  h1         { margin: 0 0 30px 0; }
  h2         { font-size: 1.4em; margin: 1em 0 0.5em 0; }
  table      { width: 100%%; border-collapse: collapse; border: 1px solid #AFC5C9 }
  table th   { background-color: #AFC1C4; color: white; font-size: 0.72em;
               font-weight: normal; width: 18em; vertical-align: top;
               padding: 0.5em 0 0.1em 0.5em; }
  table td   { border: 1px solid #AFC5C9; padding: 0.1em 0 0.1em 0.5em; }
  code       { font-family: 'Consolas', 'Monaco', 'Bitstream Vera Sans Mono',
               monospace; font-size: 0.7em; }
  ul li      { line-height: 1.5em; }
  ul.path    { font-size: 0.7em; margin: 0 -30px; padding: 8px 30px;
               list-style: none; background: #E8EFF0; }
  ul.path li { line-height: 1.6em; }
  li.virtual { color: #999; text-decoration: underline; }
  li.exp     { background: white; }
</style>
<div class="box">
  <h1>WSGI Information</h1>
  <p>
    This page displays all available information about the WSGI server and
    the underlying Python interpreter.
  <h2 id="python-interpreter">Python Interpreter</h2>
  <table>
    <tr>
      <th>Python Version
      <td>%(python_version)s
    <tr>
      <th>Platform
      <td>%(platform)s [%(os)s]
    <tr>
      <th>API Version
      <td>%(api_version)s
    <tr>
      <th>Byteorder
      <td>%(byteorder)s
    <tr>
      <th>Werkzeug Version
      <td>%(werkzeug_version)s
  </table>
  <h2 id="wsgi-environment">WSGI Environment</h2>
  <table>%(wsgi_env)s</table>
  <h2 id="installed-eggs">Installed Eggs</h2>
  <p>
    The following python packages were installed on the system as
    Python eggs:
  <ul>%(python_eggs)s</ul>
  <h2 id="sys-path">System Path</h2>
  <p>
    The following paths are the current contents of the load path.  The
    following entries are looked up for Python packages.  Note that not
    all items in this path are folders.  Gray and underlined items are
    entries pointing to invalid resources or used by custom import hooks
    such as the zip importer.
  <p>
    Items with a bright background were expanded for display from a relative
    path.  If you encounter such paths in the output you might want to check
    your setup as relative paths are usually problematic in multithreaded
    environments.
  <ul class="path">%(sys_path)s</ul>
</div>
z"t.Iterator[tuple[str, bool, bool]])Úreturnccsˆtjdkrdddœdd„}ndddœdd„}tj t ¡¡}tjD]@}tj ||pXtjj¡}|tj |¡ƒtj     |¡ ||kfVqBdS)NÚposixÚstr)Úxr    cSs0tj d¡}| |¡r,d|t|ƒd…›}|S)Nú~)ÚosÚpathÚ
expanduserÚ
startswithÚlen)r Úprefix©rúGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/testapp.pyÚstripas 
ziter_sys_path.<locals>.stripcSs|S©Nr©r rrrris)
rÚnamerÚabspathÚgetcwdÚsysÚjoinÚcurdirÚnormpathÚisdir)rÚcwdÚitemrrrrÚ iter_sys_path^s
 
r#rr)Úreqr    c Cs¸z ddl}Wntk
r$d}YnXt|jdd„d}g}|D]N}z
|j}Wnttfk
rjd}YnX| dt|j    ƒ›d    t|ƒ›d
¡q@g}t|j
  ¡d d„d}|D]>\}}    d   t ttt|    ƒƒƒƒ¡}    | d t|ƒ›d|    ›d¡q®g}
tƒD]d\} } } g}| r| d¡| r&| d¡|r>dd  |¡›dnd }|
 d|›dt| ƒ›¡qød  ttjƒ ¡¡ttjƒttjƒtjtjtd  |¡d  |¡d  |
¡dœ    }tt|ddS)aàSimple test application that dumps the environment.  You can use
    it to check if Werkzeug is working properly:
 
    .. sourcecode:: pycon
 
        >>> from werkzeug.serving import run_simple
        >>> from werkzeug.testapp import test_app
        >>> run_simple('localhost', 3000, test_app)
         * Running on http://localhost:3000/
 
    The application displays important information from the WSGI environment,
    the Python interpreter and the installed libraries.
    rNrcSs
|j ¡Sr)Ú project_nameÚlowerrrrrÚ<lambda>ˆóztest_app.<locals>.<lambda>)ÚkeyÚunknownz<li>z     <small>[z    ]</small>cSst|dƒ ¡S)Nr)Úreprr&rrrrr'•r(Úz<tr><th>z
<td><code>z</code>ÚvirtualÚexpz class="ú ú"z<liú>z<br>Ú
)    Úpython_versionÚplatformrÚ api_versionÚ    byteorderZwerkzeug_versionÚ python_eggsÚwsgi_envÚsys_pathz    text/html)Úmimetype)Ú pkg_resourcesÚ ImportErrorÚsortedÚ working_setÚversionÚ
ValueErrorÚAttributeErrorÚappendrr%ÚenvironÚitemsrrr r+r#rÚ
splitlinesr4rrr5r6Ú_werkzeug_versionrÚTEMPLATE)r$r;Úeggsr7Zeggr?r8Zsorted_environr)Úvaluer9r"r-ÚexpandedÚclass_ÚcontextrrrÚtest_apprsT 
þ
 
ÿ 
 
÷ rMÚ__main__)Ú
run_simpleÚ    localhostiˆT)Z use_reloader)Ú__doc__Ú
__future__rrrÚtypingÚtÚtextwraprZ
markupsaferr,rrFZwrappers.requestrZwrappers.responserrGr#Z applicationrMÚ__name__ZservingrOrrrrÚ<module>s       M?