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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
U
ß=®d¸ƒã@sÜddlmZddlZddlZddlZddlZddlZddlZddlZddl    Z
ddl m Z ddl mZddlZddlmZddlmZddlmZddlmZd    d
lmZd    d lmZd    d lmZe
jrÒd    d lmZGdd„dej ƒZ!dd„Z"dd„Z#dd„Z$dd„Z%ddd„Z&dd„Z'ej(dgdde'ddd Z)Gd!d"„d"ƒZ*ej+e*dd#Z,d$d%„Z-Gd&d'„d'ej.ƒZ/d(d)d*d*d+œd,d-„Z0ej(d.d/gd0d1dde0d2Z1d(d)d3d4d+œd5d6„Z2ej(d7gd8de2d9Z3d(d)d*d*d+œd:d;„Z4ej(d<d=gej5ddd>d?dde4d@Z6GdAdB„dBe/ƒZ7dCdD„Z8dŽdEd3dFœdGdH„Z9dIdJ„Z:GdKdL„dLej;ƒZ<dMdN„Z=GdOdP„dPej5ƒZ>ej?dQdRdSej@dTdUdVdWdXej@dYdZd[d\dXej@d]e<ƒd^dd_ej@d`ej5ddddae=ddbdcej@ddddedXej@dfddgdXej@dhddidXej@djde>ƒdkejAjB›dldmej@dnde>ƒdoejAjB›dldme,dpdq„ƒƒƒƒƒƒƒƒƒƒƒZCeCjD Ede3¡ej?drdsdSe-dtduœdvdw„ƒƒZFej?dxdydSej@dzd{e Gd|¡d}d~dej@d€ddd‚e-dƒd3dtd„œd…d†„ƒƒƒƒZHe7d‡dˆd‰ZIdtduœdŠd‹„ZJeKdŒkrØeJƒdS)é)Ú annotationsN)Úupdate_wrapper)Ú
itemgetter)ÚParameterSource)Ú
run_simple)Úis_running_from_reloader)Ú import_stringé)Ú current_app)Úget_debug_flag)Úget_load_dotenv©ÚFlaskc@seZdZdZdS)ÚNoAppExceptionz3Raised if an application cannot be found or loaded.N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__©rrú@d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\flask/cli.pyrsrcs:ddlm‰dD]"}t||dƒ}t|ˆƒr|Sq‡fdd„|j ¡Dƒ}t|ƒdkr`|dSt|ƒdkr†td|j›d    |j›d
ƒ‚d D]}t||dƒ}t     
|¡rŠz|ƒ}t|ˆƒrÀ|WSWqŠt k
r}z6t |ƒsà‚td |›d |j›d|j›d|›d    ƒ|‚W5d}~XYqŠXqŠtd|j›d    |j›dƒ‚dS)zwGiven a module instance this tries to find the best possible
    application in the module or raises an exception.
    r    r )ÚappZ applicationNcsg|]}t|ˆƒr|‘qSr)Ú
isinstance)Ú.0Úvr rrÚ
<listcomp>.s
z!find_best_app.<locals>.<listcomp>rz0Detected multiple Flask applications in module 'z'. Use 'z":name' to specify the correct one.)Ú
create_appZmake_appzDetected factory 'z ' in module 'z1', but could not call it without arguments. Use 'ú:z(args)' to specify arguments.z7Failed to find Flask application or factory in module 'z:name' to specify one.) ÚrÚgetattrrÚ__dict__ÚvaluesÚlenrrÚinspectÚ
isfunctionÚ    TypeErrorÚ_called_with_wrong_args)ÚmoduleÚ    attr_namerÚmatchesZ app_factoryÚerr rÚ find_best_app s<  
 
  ÿ 
 
 ÿûÿr*cCsDt ¡d}z.|dk    r4|jj|jkr,W¢dS|j}qW¢dS~XdS)zéCheck whether calling a function raised a ``TypeError`` because
    the call failed or because something in the factory raised the
    error.
 
    :param f: The function that was called.
    :return: ``True`` if the call failed.
    éNFT)ÚsysÚexc_infoÚtb_frameÚf_codeÚ__code__Útb_next)ÚfÚtbrrrr%Us r%c
 
CsÞddlm}ztj| ¡ddj}Wn&tk
rJtd|›dƒd‚YnXt|tj    ƒrh|j
}g}i}nt|tj ƒrèt|j tj    ƒs’td|›d    ƒ‚|j j
}z$d
d „|j Dƒ}d d „|jDƒ}Wqøtk
rätd|›d    ƒd‚YqøXntd|›dƒ‚zt||ƒ}Wn>tk
rD}ztd|›d|j›d    ƒ|‚W5d}~XYnXt |¡r®z|||Ž}    WnJtk
rª}z*t|ƒs€‚td|›d|j›dƒ|‚W5d}~XYnXn|}    t|    |ƒrÂ|    Std|j›d|›dƒ‚dS)zŽCheck if the given string is a variable name or a function. Call
    a function to get the app instance, or return the variable directly.
    r    r Úeval)ÚmodezFailed to parse z' as an attribute name or function call.Nz*Function reference must be a simple name: Ú.cSsg|]}t |¡‘qSr)ÚastÚ literal_eval)rÚargrrrrsz&find_app_by_string.<locals>.<listcomp>cSsi|]}|jt |j¡“qSr)r9r7r8Úvalue)rÚkwrrrÚ
<dictcomp>Žsz&find_app_by_string.<locals>.<dictcomp>z-Failed to parse arguments as literal values: zFailed to find attribute z in z The factory z  in module z2 could not be called with the specified arguments.z1A valid Flask application was not obtained from 'rz'.)rrr7ÚparseÚstripÚbodyÚ SyntaxErrorrrÚNameÚidZCallÚfuncÚargsÚkeywordsÚ
ValueErrorrÚAttributeErrorrr"r#r$r%)
r&Úapp_namerÚexprÚnamerDÚkwargsÚattrr)rrrrÚfind_app_by_stringosp 
ÿþ  
ÿ
ÿþ
 
ÿÿþ 
ÿü ÿrMcCs¬tj |¡}tj |¡\}}|dkr(|}tj |¡dkrDtj |¡}g}tj |¡\}}| |¡tj tj     |d¡¡sHq|qHt
jd|kr˜t
j  d|¡d     |ddd…¡S)z“Given a filename this will try to calculate the python path, add it
    to the search path and return the actual module name that is expected.
    z.pyÚ__init__z __init__.pyrr6Néÿÿÿÿ) ÚosÚpathÚrealpathÚsplitextÚbasenameÚdirnameÚsplitÚappendÚexistsÚjoinr,Úinsert)rQÚfnameÚextÚ module_namerJrrrÚprepare_import»s  
r^Tc    Cs’z t|ƒWn\tk
rht ¡djrFtd|›dt ¡›ƒd‚n|r^td|›dƒd‚nYdSYnXtj|}|dkr„t    |ƒSt
||ƒSdS)Nr+zWhile importing z, an ImportError was raised:
 
zCould not import r6) Ú
__import__Ú ImportErrorr,r-r1rÚ    tracebackÚ
format_excÚmodulesr*rM)r]rHÚraise_if_not_foundr&rrrÚ
locate_appØs  ÿý 
recCsV|r
|jrdSddl}ddlm}tjdt ¡›d|›d|j›|jd|     ¡dS)Nrr    )Ú __version__úPython z
Flask z
 
Werkzeug )Úcolor)
Zresilient_parsingÚwerkzeugrrfÚclickÚechoÚplatformÚpython_versionrhÚexit)ÚctxÚparamr:rirfrrrÚ get_versionðs
 ürqz    --versionzShow the Flask version.F)ÚhelpÚ expose_valueÚcallbackÚis_flagÚis_eagerc@s4eZdZdZddddddœd    d
„Zd d œd d„ZdS)Ú
ScriptInfoa…Helper object to deal with Flask applications.  This is usually not
    necessary to interface with as it's used internally in the dispatching
    to click.  In future versions of Flask this object will most likely play
    a bigger role.  Typically it's created automatically by the
    :class:`FlaskGroup` but you can also manually create it and pass it
    onwards as click object.
    NTú
str | Noneút.Callable[..., Flask] | NoneÚboolÚNone)Úapp_import_pathrÚset_debug_flagÚreturncCs"||_||_i|_||_d|_dS©N)r|rÚdatar}Ú _loaded_app)Úselfr|rr}rrrrNs
zScriptInfo.__init__r©r~cCs¬|jdk    r|jS|jdk    r$| ¡}nd|jr`t d|jd¡dgdd…\}}t|ƒ}t||ƒ}n(dD]"}t|ƒ}t|ddd}|rdqˆqd|s”tdƒ‚|jr¢t    ƒ|_
||_|S)    z¨Loads the Flask app (if not yet loaded) and returns it.  Calling
        this multiple times will just result in the already loaded app to
        be returned.
        Nz
:(?![\\/])r    r+)zwsgi.pyzapp.pyF)rdzŸCould not locate a Flask application. Use the 'flask --app' option, 'FLASK_APP' environment variable, or a 'wsgi.py' or 'app.py' file in the current directory.) rrr|ÚrerVr^rerr}r Údebug)r‚rrQrJÚ import_namerrrÚload_app$s0
 
 
ÿþ
 ÿzScriptInfo.load_app)NNT)rrrrrNr‡rrrrrw
s 
ürw)Zensurecstj‡fdd„ƒ}t|ˆƒS)aøWraps a callback so that it's guaranteed to be executed with the
    script's application context.
 
    Custom commands (and their options) registered under ``app.cli`` or
    ``blueprint.cli`` will always have an app context available, this
    decorator is not required in that case.
 
    .. versionchanged:: 2.2
        The app context is active for subcommands as well as the
        decorated callback. The app context is always available to
        ``app.cli`` command and parameter callbacks.
    cs2ts | t¡ ¡}| | ¡¡|jˆf|ž|ŽSr)r
Ú ensure_objectrwr‡Ú with_resourceÚ app_contextZinvoke)Z__ctxrDrKr©r2rrÚ    decorator_sz"with_appcontext.<locals>.decorator)rjZ pass_contextr)r2rŒrr‹rÚwith_appcontextQsrc@s eZdZdZdd„Zdd„ZdS)ÚAppGroupaThis works similar to a regular click :class:`~click.Group` but it
    changes the behavior of the :meth:`command` decorator so that it
    automatically wraps the functions in :func:`with_appcontext`.
 
    Not to be confused with :class:`FlaskGroup`.
    cs"ˆ dd¡‰‡‡‡‡fdd„}|S)zÛThis works exactly like the method of the same name on a regular
        :class:`click.Group` but it wraps callbacks in :func:`with_appcontext`
        unless it's disabled by passing ``with_appcontext=False``.
        rTcs$ˆr t|ƒ}tjjˆfˆžˆŽ|ƒSr)rrjÚGroupÚcommandr‹©rDrKr‚Z wrap_for_ctxrrrŒysz#AppGroup.command.<locals>.decorator)Úpop)r‚rDrKrŒrr‘rrrs zAppGroup.commandcOs | dt¡tjj|f|ž|ŽS)z¤This works exactly like the method of the same name on a regular
        :class:`click.Group` but it defaults the group class to
        :class:`AppGroup`.
        Úcls)Ú
setdefaultrŽrjrÚgroup)r‚rDrKrrrr•€s zAppGroup.groupN)rrrrrr•rrrrrŽjsrŽú click.Contextz click.Optionrx)rorpr:r~cCs |dkr dS| t¡}||_|Sr)rˆrwr|)rorpr:ÚinforrrÚ_set_app‰s
 
r˜z-Az--appZIMPORTzõThe Flask application or factory function to load, in the form 'module:name'. Module can be a dotted import or file path. Name is not required if it is 'app', 'application', 'create_app', or 'make_app', and can be 'name(args)' to pass arguments.)Úmetavarrrrvrsrtrzz bool | NonecCs>| |j¡}|dk    r(|tjtjfkr(dS|r0dndtjd<|S)NÚ1Ú0Z FLASK_DEBUG)Zget_parameter_sourcerJrÚDEFAULTZ DEFAULT_MAPrPÚenviron)rorpr:ÚsourcerrrÚ
_set_debug¥s 
þrŸz--debug/--no-debugzSet debug mode.)rrrsrtcCsV|dkr dSddl}z| d¡Wn&tk
rHtjd||dd‚YnXt|ƒ|S)NrÚdotenvz4python-dotenv must be installed to load an env file.)rorp)Ú    importlibÚ import_moduler`rjÚ BadParameterÚ load_dotenv)rorpr:r¡rrrÚ_env_file_callback¾sýür¥z-ez
--env-file)rXÚdir_okayzKLoad environment variables from this file. python-dotenv must be installed.)Útyperrrvrsrtc    s†eZdZdZdddddddddœ‡fd    d
„ Zd d „Z‡fd d„Z‡fdd„Zdddddddœ‡fdd„ Zddddœ‡fdd„ Z    ‡Z
S)Ú
FlaskGroupa0Special subclass of the :class:`AppGroup` group that supports
    loading more commands from the configured Flask app.  Normally a
    developer does not have to interface with this class but there are
    some very advanced use cases for which it makes sense to create an
    instance of this. see :ref:`custom-scripts`.
 
    :param add_default_commands: if this is True then the default run and
        shell commands will be added.
    :param add_version_option: adds the ``--version`` option.
    :param create_app: an optional callback that is passed the script info and
        returns the loaded app.
    :param load_dotenv: Load the nearest :file:`.env` and :file:`.flaskenv`
        files to set environment variables. Will also change the working
        directory to the directory containing the first file found.
    :param set_debug_flag: Set the app's debug flag.
 
    .. versionchanged:: 2.2
        Added the ``-A/--app``, ``--debug/--no-debug``, ``-e/--env-file`` options.
 
    .. versionchanged:: 2.2
        An app context is pushed when running ``app.cli`` commands, so
        ``@with_appcontext`` is no longer required for those commands.
 
    .. versionchanged:: 1.0
        If installed, python-dotenv will be used to load environment variables
        from :file:`.env` and :file:`.flaskenv` files.
    TNrzryzt.Anyr{)Úadd_default_commandsrÚadd_version_optionr¤r}Úextrar~c s¦t| dd¡pdƒ}| tttf¡|r2| t¡d|krBi|d<|d dd¡t    ƒj
fd|i|—Ž||_ ||_ ||_ |rœ| t¡| t¡| t¡d|_dS)NÚparamsrÚcontext_settingsZauto_envvar_prefixZFLASKF)Úlistr’ÚextendÚ_env_file_optionÚ _app_optionÚ _debug_optionrWÚversion_optionr”ÚsuperrNrr¤r}Ú add_commandÚ run_commandÚ shell_commandÚroutes_commandÚ_loaded_plugin_commands)r‚r©rrªr¤r}r«r¬©Ú    __class__rrrNþs     
 
 
 
zFlaskGroup.__init__cCsX|jr
dStjdkr"ddlm}nddl}|jddD]}| | ¡|j    ¡q6d|_dS)N)éé
r)Úmetadatazflask.commands)r•T)
r¹r,Ú version_infor¡r¾Zimportlib_metadataZ entry_pointsrµÚloadrJ)r‚r¾ÚeprrrÚ_load_plugin_commands#s
z FlaskGroup._load_plugin_commandsc
sª| ¡tƒ ||¡}|dk    r"|S| t¡}z | ¡}WnDtk
r|}z&tjd|     ¡›ddddWY¢dSd}~XYnXt
rŽt
  ¡|k    rœ|  |  ¡¡|j ||¡S©NzError: Ú
TÚred)ÚerrÚfg)rÂr´Ú get_commandrˆrwr‡rrjÚsechoÚformat_messager
Z_get_current_objectr‰rŠÚcli)r‚rorJÚrvr—rr)rºrrrÈ4s
 zFlaskGroup.get_commandc
s°| ¡ttƒ |¡ƒ}| t¡}z| | ¡j |¡¡Wnjt    k
rz}z t
j d|  ¡›ddddW5d}~XYn.t k
r¦t
j t ¡›ddddYnXt|ƒSrÃ)rÂÚsetr´Ú list_commandsrˆrwÚupdater‡rËrrjrÉrÊÚ    ExceptionrarbÚsorted)r‚rorÌr—r)rºrrrÎOs
, zFlaskGroup.list_commandsrxz    list[str]zclick.Context | Noner–)Ú    info_namerDÚparentr«r~c sZdtjd<t|jƒrtƒd|kr@d|jkr@t|j|jd|d<tƒj    ||fd|i|—ŽS)NÚtrueZFLASK_RUN_FROM_CLIÚobj)rr}rÓ)
rPrr r¤r­rwrr}r´Ú make_context)r‚rÒrDrÓr«rºrrrÖds
 
 
ÿ
zFlaskGroup.make_context)rorDr~cs4|s&|jr&t |ig¡t |ig¡tƒ ||¡Sr)Zno_args_is_helpr°Zhandle_parse_resultr±r´Ú
parse_args)r‚rorDrºrrr×|s
zFlaskGroup.parse_args)TNTTT)N) rrrrrNrÂrÈrÎrÖr×Ú __classcell__rrrºrr¨ású %  ür¨cCs&tj ||t|ƒd… tj¡¡|kS)zžTake ``other`` and remove the length of ``path`` from it. Then join it
    to ``path``. If it is the original value, ``path`` is an ancestor of
    ``other``.N)rPrQrYr!ÚlstripÚsep)rQÚotherrrrÚ_path_is_ancestor‡srÜzstr | os.PathLike | None)rQr~cCs®z ddl}WnBtk
rN|s8tj d¡s8tj d¡rHtjddddYd    SX|dk    rvtj |¡rr|j|d
d Sd    Sd    }d D]*}|j|dd }|s–q~|j|d
d d}q~|S)a?Load "dotenv" files in order of precedence to set environment variables.
 
    If an env var is already set it is not overwritten, so earlier files in the
    list are preferred over later files.
 
    This is a no-op if `python-dotenv`_ is not installed.
 
    .. _python-dotenv: https://github.com/theskumar/python-dotenv#readme
 
    :param path: Load the file at this location instead of searching.
    :return: ``True`` if a file was loaded.
 
    .. versionchanged:: 2.0
        The current directory is not changed to the location of the
        loaded file.
 
    .. versionchanged:: 2.0
        When loading the env files, set the default encoding to UTF-8.
 
    .. versionchanged:: 1.1.0
        Returns ``False`` when python-dotenv is not installed, or when
        the given path isn't a file.
 
    .. versionadded:: 1.0
    rNú.envú    .flaskenvz^ * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.ZyellowT)rÇrÆFzutf-8)Úencoding)rÝrÞ)Zusecwd)    r r`rPrQÚisfilerjrÉr¤Z find_dotenv)rQr ZloadedrJrrrr¤Žs, ü r¤cCsHtƒr
dS|dk    r$t d|›d¡|dk    rDt d|r:dnd›¡dS)z]Show extra startup messages the first time the server is run,
    ignoring the reloader.
    Nz * Serving Flask app 'ú'z * Debug mode: ÚonÚoff)rrjrk)r…r|rrrÚshow_server_bannerËs räc@s$eZdZdZdZdd„Zdd„ZdS)Ú CertParamTypez¥Click option type for the ``--cert`` option. Allows either an
    existing file, the string ``'adhoc'``, or an import for a
    :class:`~ssl.SSLContext` object.
    rQcCstjdddd|_dS)NTF©rXr¦Z resolve_path)rjÚPathÚ    path_type)r‚rrrrNászCertParamType.__init__c CsÔz ddl}Wn$tk
r0t d||¡d‚YnXz| |||¡WStjk
rÎt |||¡ ¡}|dkr¨z ddl}Wn$tk
ržt d||¡d‚YnX|YSt|dd}t    ||j
ƒrÈ|YS‚YnXdS)Nrz?Using "--cert" requires Python to be compiled with SSL support.Úadhocz<Using ad-hoc certificates requires the cryptography library.T)Zsilent) Ússlr`rjr£rèÚSTRINGÚlowerÚ cryptographyrrÚ
SSLContext)r‚r:rprorêrírÕrrrÚconvertäs< ýü ýü  zCertParamType.convertN)rrrrrJrNrïrrrrråÙsråcCs²|j d¡}|dk}z ddl}Wntk
r8d}YnXt||jƒ}|dk    r”|r`t d||¡‚|rrt d||¡‚|s„t d||¡‚||f|jd<n|r®|s®|s®t d    ||¡‚|S)
zŽThe ``--key`` option must be specified when ``--cert`` is a file.
    Modifies the ``cert`` param to be a ``(cert, key)`` pair if needed.
    ÚcertrérNFz.When "--cert" is "adhoc", "--key" is not used.z:When "--cert" is an SSLContext object, "--key is not used.z "--cert" must also be specified.zRequired when using "--cert".)r¬Úgetrêr`rrîrjr£)rorpr:rðZis_adhocrêZ
is_contextrrrÚ _validate_keys4  
 ÿÿ ròcs eZdZdZ‡fdd„Z‡ZS)ÚSeparatedPathTypez³Click option type that accepts a list of values separated by the
    OS's path separator (``:``, ``;`` on Windows). Each value is
    validated as a :class:`click.Path` type.
    cs(| |¡}tƒj‰‡‡‡fdd„|DƒS)Ncsg|]}ˆ|ˆˆƒ‘qSrr)rÚitem©rorpZ super_convertrrr5sz-SeparatedPathType.convert.<locals>.<listcomp>)Zsplit_envvar_valuer´rï)r‚r:rproÚitemsrºrõrrï2s
zSeparatedPathType.convert)rrrrrïrØrrrºrró,sróÚrunzRun a development server.)Z
short_helpz--hostz-hz    127.0.0.1zThe interface to bind to.)Údefaultrrz--portz-piˆzThe port to bind to.z--certz(Specify a certificate file to use HTTPS.)r§rrrvz--keyræz2The key file to use when specifying a certificate.)r§rtrsrrz--reload/--no-reloadzVEnable or disable the reloader. By default the reloader is active if debug is enabled.z--debugger/--no-debuggerzVEnable or disable the debugger. By default the debugger is active if debug is enabled.z --with-threads/--without-threadsz!Enable or disable multithreading.z --extra-fileszMExtra files that trigger a reload on change. Multiple paths are separated by r6)rør§rrz--exclude-patternsznFiles matching these fnmatch patterns will not trigger a reload on change. Multiple patterns are separated by c     sžz | ¡}    WnHtk
rT}
z*tƒr>t ¡|
‰‡fdd„}    n|
d‚W5d}
~
XYnXtƒ} |dkrh| }|dkrt| }t| |jƒt|||    ||||||d    dS)aRun a local development server.
 
    This server is for development purposes only. It does not provide
    the stability, security, or performance of production WSGI servers.
 
    The reloader and debugger are enabled by default with the '--debug'
    option.
    cs
ˆd‚dSrr)rZstart_response©rÆrrr‰szrun_command.<locals>.appN)Z use_reloaderZ use_debuggerZthreadedÚ ssl_contextÚ extra_filesÚexclude_patterns)    r‡rÐrraÚ    print_excr rär|r) r—ÚhostÚportÚreloadZdebuggerZ with_threadsrðrûrürr)r…rrùrr¶8s2H  ÷r¶ÚshellzRun a shell in the app context.r{rƒc    Csîddl}dtj›dtj›dtj›dtj›}i}tj     d¡}|rvtj
  |¡rvt |ƒ}t t| ¡|dƒ|ƒW5QRX| t ¡¡ttd    dƒ}|dk    rÜzddl}dd
lm}Wntk
rÄYnX| ||ƒj¡|ƒ|j||d dS) a:Run an interactive Python shell in the context of a given
    Flask application.  The application will populate the default
    namespace of this shell according to its configuration.
 
    This is useful for executing small snippets of management code
    without having to manually configure the application.
    rNrgz on z
App: z
Instance: Z PYTHONSTARTUPÚexecÚ__interactivehook__)Ú    Completer)ÚbannerÚlocal)Úcoder,Úversionrlr
r†Z instance_pathrPrrñrQràÚopenr4ÚcompileÚreadrÏZmake_shell_contextrÚreadlineÚ rlcompleterrr`Z set_completerZcompleteZinteract)rrroZstartupr2Zinteractive_hookr rrrrr·«s&
"ÿ 
  r·ZrouteszShow the routes for the app.z--sortz-s)ÚendpointÚmethodsÚdomainÚruleÚmatchrzgMethod to sort routes by. 'match' is the order that Flask will match routes when dispatching a request.)r§rørrz --all-methodszShow HEAD and OPTIONS methods.)rurrÚstr)ÚsortÚ all_methodsr~c sœttj ¡ƒ}|s t d¡dS|r*tƒnddh}tjj‰t‡fdd„|Dƒƒ}g‰|D]X}|j    d 
t |j pptƒ|ƒ¡g}|rš|  ˆrŽ|jn|jp–d¡|  |j¡ˆ  |¡qXd    d
g}d d g}|râ|  ˆrÒd nd¡|  d¡|  d¡|  d¡zˆjt| |¡ƒdWntk
r&YnXˆ d|¡‡fdd„tt|ƒƒDƒ}    ˆ ddd„|    Dƒ¡d 
dd„t|    ƒDƒ¡}
ˆD]}t |
j|Ž¡q€dS)z6Show all registered routes with endpoints and methods.zNo routes were registered.NÚHEADÚOPTIONSc3s|]}ˆr|jn|jVqdSr)rþÚ    subdomain)rr)Ú host_matchingrrÚ    <genexpr>ósz!routes_command.<locals>.<genexpr>z, rZEndpointZMethodsrrÚHostZ    SubdomainrZRuler)Úkeyrcs"g|]‰t‡fdd„ˆDƒƒ‘qS)c3s|]}t|ˆƒVqdSr)r!)rÚrow©Úirrrsz,routes_command.<locals>.<listcomp>.<genexpr>)Úmax)r)Úrowsrrrsz"routes_command.<locals>.<listcomp>r    cSsg|] }d|‘qS)ú-r)rÚwrrrrsz  css$|]\}}d|›d|›dVqdS)Ú{z:<Ú}Nr)rrr#rrrrs)r®r
Zurl_mapZ
iter_rulesrjrkrÍrÚanyrrYrÑrrWrþrrrrÚindexrFrZÚranger!Ú    enumerateÚformat) rrÚrulesZignored_methodsZ
has_domainrrÚheadersZsortsZwidthsÚtemplater)rr!rr¸ÜsB
þ  
 
 
 r¸ZflaskzÑA general utility script for Flask applications.
 
An application to load must be given with the '--app' option,
'FLASK_APP' environment variable, or with a 'wsgi.py' or 'app.py' file
in the current directory.
)rJrrcCs t ¡dSr)rËÚmainrrrrr.&sr.Ú__main__)T)N)LÚ
__future__rr7r"rPrlr„r,raÚtypingÚtÚ    functoolsrÚoperatorrrjZ
click.corerrirZwerkzeug.servingrZwerkzeug.utilsrÚglobalsr
Zhelpersr r Ú TYPE_CHECKINGrrZ
UsageErrorrr*r%rMr^rerqÚOptionr³rwZmake_pass_decoratorZpass_script_inforrrŽr˜r±rŸr²r¥rçr°r¨rÜr¤räZ    ParamTyperåròrórÚoptionrQÚpathsepr¶r¬rZr·ZChoicer¸rËr.rrrrrÚ<module>s           5L
ú
D õü ú
'=.% üûýýýû    û
; / ú
1þ