zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
U
ß=®dŸ‰ã@sìddlmZddlZddlZddlZddlZddlZddlZ    ddl
m Z ddl m Z ddlmZddlmZddlmZddlmZdd    lmZd
d lmZd
d lmZd
d lmZd
dlmZd
dlmZd
dl m!Z!e    j"rêd
dl#m$Z$e%ƒZ&e    j'de    j(de    j)fdZ*e    j'dej+dZ,e    j'dej-dZ.e    j'dej/dZ0e    j'dej1dZ2e    j'dej3dZ4e    j'dej5dZ6e    j'dej7dZ8e    j'dej9dZ:dddœdd„Z;Gd d!„d!ƒZ<d"d#d$œd%d&„Z=d'd(„Z>d)d#d*d+œd,d-„Z?d.d/„Z@d#d0œd1d2„ZAdS)3é)Ú annotationsN)Ú defaultdict)Ú    timedelta)Úupdate_wrapper)ÚFileSystemLoader)Údefault_exceptions)Ú HTTPException)Úcached_propertyé)Útyping)ÚAppGroup)Ú current_app)Ú get_root_path)Úsend_from_directory)Ú_default_template_ctx_processor)ÚResponseÚF.)ÚboundÚT_after_requestÚT_before_requestÚT_error_handlerÚ
T_teardownÚT_template_context_processorÚT_url_defaultsÚT_url_value_preprocessorÚT_route©ÚfÚreturncs0ˆj‰ddddœ‡‡fdd„ }t tt|ˆƒ¡S)Nút.Any)ÚargsÚkwargsrcs| ˆ¡ˆ|f|ž|ŽS©N)Ú_check_setup_finished)Úselfr r!©rÚf_name©úEd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\flask/scaffold.pyÚ wrapper_func1s
z!setupmethod.<locals>.wrapper_func)Ú__name__ÚtÚcastrr)rr)r'r%r(Ú setupmethod.sr-c    @seZdZUdZded<dZded<dZded<dhdddddd    œd
d „Zdd œd d„Zdddœdd„Z    e
dd œdd„ƒZ e j dddœdd„ƒZ e
dd œdd„ƒZ e
dd œdd„ƒZej dddœdd„ƒZdddœdd „Zdd!dœd"d#„Zed$d œd%d&„ƒZdiddd(d)œd*d+„Zddd,d-d.œd/d0„Zedd1d-d2œd3d4„ƒZedd1d-d2œd5d6„ƒZedd1d-d2œd7d8„ƒZedd1d-d2œd9d:„ƒZedd1d-d2œd;d<„ƒZedd1d-d2œd=d>„ƒZedjddd?d@d1ddAœdBdC„ƒZeddDdEœdFdG„ƒZedHdHdIœdJdK„ƒZedLdLdIœdMdN„ƒZedOdOdIœdPdQ„ƒZ edRdRdIœdSdT„ƒZ!edUdUdIœdVdW„ƒZ"edXdXdIœdYdZ„ƒZ#ed[d\d]œd^d_„ƒZ$ed[d`ddaœdbdc„ƒZ%e&d[dddeœdfdg„ƒZ'dS)kÚScaffoldaùCommon behavior shared between :class:`~flask.Flask` and
    :class:`~flask.blueprints.Blueprint`.
 
    :param import_name: The import name of the module where this object
        is defined. Usually :attr:`__name__` should be used.
    :param static_folder: Path to a folder of static files to serve.
        If this is set, a static route will be added.
    :param static_url_path: URL prefix for the static route.
    :param template_folder: Path to a folder containing template files.
        for rendering. If this is set, a Jinja loader will be added.
    :param root_path: The path that static, template, and resource files
        are relative to. Typically not set, it is discovered based on
        the ``import_name``.
 
    .. versionadded:: 2.0
    ÚstrÚnameNz
str | NoneÚ_static_folderÚ_static_url_pathzstr | os.PathLike | None)Ú import_nameÚ static_folderÚstatic_url_pathÚtemplate_folderÚ    root_pathcCs”||_||_||_||_|dkr*t|jƒ}||_tƒ|_i|_t    dd„ƒ|_
t    t ƒ|_ t    t ƒ|_ t    t ƒ|_t    t dtgiƒ|_t    t ƒ|_t    t ƒ|_dS)NcSsttƒSr")rÚdictr'r'r'r(Ú<lambda>‡óz#Scaffold.__init__.<locals>.<lambda>)r3r4r5r6rr7r ÚcliÚview_functionsrÚerror_handler_specÚlistÚbefore_request_funcsÚafter_request_funcsÚteardown_request_funcsrÚtemplate_context_processorsÚurl_value_preprocessorsÚurl_default_functions)r$r3r4r5r6r7r'r'r(Ú__init__Ns.
 
 
ýþþþþýþzScaffold.__init__)rcCsdt|ƒj›d|j›dS)Nú<ú ú>)Útyper*r0©r$r'r'r(Ú__repr__âszScaffold.__repr__ÚNone)r&rcCst‚dSr"©ÚNotImplementedError)r$r&r'r'r(r#åszScaffold._check_setup_finishedcCs$|jdk    rtj |j|j¡SdSdS)zhThe absolute path to the configured static folder. ``None``
        if no static folder is set.
        N)r1ÚosÚpathÚjoinr7rJr'r'r(r4ès
zScaffold.static_folder)ÚvaluercCs"|dk    rt |¡ d¡}||_dS)Nz\/)rOÚfspathÚrstripr1©r$rRr'r'r(r4òsÚboolcCs
|jdk    S)zQ``True`` if :attr:`static_folder` is set.
 
        .. versionadded:: 0.5
        N)r4rJr'r'r(Úhas_static_folderùszScaffold.has_static_foldercCs<|jdk    r|jS|jdk    r8tj |j¡}d|› d¡SdS)z§The URL prefix that the static route will be accessible from.
 
        If it was not configured during init, it is derived from
        :attr:`static_folder`.
        Nú/)r2r4rOrPÚbasenamerT)r$rYr'r'r(r5s 
 
zScaffold.static_url_pathcCs|dk    r| d¡}||_dS)NrX)rTr2rUr'r'r(r5s
z
int | None)ÚfilenamercCs0tjd}|dkrdSt|tƒr,t| ¡ƒS|S)aUsed by :func:`send_file` to determine the ``max_age`` cache
        value for a given file path if it wasn't passed.
 
        By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from
        the configuration of :data:`~flask.current_app`. This defaults
        to ``None``, which tells the browser to use conditional requests
        instead of a timed cache, which is usually preferable.
 
        .. versionchanged:: 2.0
            The default configuration is ``None`` instead of 12 hours.
 
        .. versionadded:: 0.9
        ZSEND_FILE_MAX_AGE_DEFAULTN)r ÚconfigÚ
isinstancerÚintÚ total_seconds)r$rZrRr'r'r(Úget_send_file_max_ages 
 
 zScaffold.get_send_file_max_agercCs0|jstdƒ‚| |¡}tt t|j¡||dS)zïThe view function used to serve files from
        :attr:`static_folder`. A route is automatically registered for
        this view at :attr:`static_url_path` if :attr:`static_folder` is
        set.
 
        .. versionadded:: 0.5
        z2'static_folder' must be set to serve static_files.)Úmax_age)rWÚ RuntimeErrorr_rr+r,r/r4)r$rZr`r'r'r(Úsend_static_file0s
 ÿzScaffold.send_static_filezFileSystemLoader | NonecCs(|jdk    r ttj |j|j¡ƒSdSdS)zÒThe Jinja loader for this object's templates. By default this
        is a class :class:`jinja2.loaders.FileSystemLoader` to
        :attr:`template_folder` if it is set.
 
        .. versionadded:: 0.5
        N)r6rrOrPrQr7rJr'r'r(Ú jinja_loaderBs
zScaffold.jinja_loaderÚrbzt.IO[t.AnyStr])ÚresourceÚmodercCs&|dkrtdƒ‚ttj |j|¡|ƒS)aKOpen a resource file relative to :attr:`root_path` for
        reading.
 
        For example, if the file ``schema.sql`` is next to the file
        ``app.py`` where the ``Flask`` app is defined, it can be opened
        with:
 
        .. code-block:: python
 
            with app.open_resource("schema.sql") as f:
                conn.executescript(f.read())
 
        :param resource: Path to the resource relative to
            :attr:`root_path`.
        :param mode: Open the file in this mode. Only reading is
            supported, valid values are "r" (or "rt") and "rb".
        >ÚrÚrtrdz)Resources can only be opened for reading.)Ú
ValueErrorÚopenrOrPrQr7)r$rerfr'r'r(Ú open_resourceOszScaffold.open_resourcer8zt.Callable[[T_route], T_route])ÚmethodÚruleÚoptionsrcCs(d|krtdƒ‚|j|fd|gi|—ŽS)NÚmethodsz8Use the 'route' decorator to use the 'methods' argument.)Ú    TypeErrorÚroute)r$rlrmrnr'r'r(Ú _method_routefszScaffold._method_router)rmrnrcKs| d||¡S)z\Shortcut for :meth:`route` with ``methods=["GET"]``.
 
        .. versionadded:: 2.0
        ÚGET©rr©r$rmrnr'r'r(Úgetqsz Scaffold.getcKs| d||¡S)z]Shortcut for :meth:`route` with ``methods=["POST"]``.
 
        .. versionadded:: 2.0
        ÚPOSTrtrur'r'r(Úpostysz Scaffold.postcKs| d||¡S)z\Shortcut for :meth:`route` with ``methods=["PUT"]``.
 
        .. versionadded:: 2.0
        ÚPUTrtrur'r'r(Úputsz Scaffold.putcKs| d||¡S)z_Shortcut for :meth:`route` with ``methods=["DELETE"]``.
 
        .. versionadded:: 2.0
        ÚDELETErtrur'r'r(Údelete‰szScaffold.deletecKs| d||¡S)z^Shortcut for :meth:`route` with ``methods=["PATCH"]``.
 
        .. versionadded:: 2.0
        ÚPATCHrtrur'r'r(Úpatch‘szScaffold.patchc sdddœ‡‡‡fdd„ }|S)aìDecorate a view function to register it with the given URL
        rule and options. Calls :meth:`add_url_rule`, which has more
        details about the implementation.
 
        .. code-block:: python
 
            @app.route("/")
            def index():
                return "Hello, World!"
 
        See :ref:`url-route-registrations`.
 
        The endpoint name for the route defaults to the name of the view
        function if the ``endpoint`` parameter isn't passed.
 
        The ``methods`` parameter defaults to ``["GET"]``. ``HEAD`` and
        ``OPTIONS`` are added automatically.
 
        :param rule: The URL rule string.
        :param options: Extra options passed to the
            :class:`~werkzeug.routing.Rule` object.
        rrcs"ˆ dd¡}ˆjˆ||fˆŽ|S)NÚendpoint)ÚpopÚ add_url_rule)rr©rnrmr$r'r(Ú    decorator²s z!Scaffold.route.<locals>.decoratorr')r$rmrnrƒr'r‚r(rq™szScaffold.routezft.RouteCallable | Nonez bool | None)rmrÚ    view_funcÚprovide_automatic_optionsrnrcKst‚dS)a;Register a rule for routing incoming requests and building
        URLs. The :meth:`route` decorator is a shortcut to call this
        with the ``view_func`` argument. These are equivalent:
 
        .. code-block:: python
 
            @app.route("/")
            def index():
                ...
 
        .. code-block:: python
 
            def index():
                ...
 
            app.add_url_rule("/", view_func=index)
 
        See :ref:`url-route-registrations`.
 
        The endpoint name for the route defaults to the name of the view
        function if the ``endpoint`` parameter isn't passed. An error
        will be raised if a function has already been registered for the
        endpoint.
 
        The ``methods`` parameter defaults to ``["GET"]``. ``HEAD`` is
        always added automatically, and ``OPTIONS`` is added
        automatically by default.
 
        ``view_func`` does not necessarily need to be passed, but if the
        rule should participate in routing an endpoint name must be
        associated with a view function at some point with the
        :meth:`endpoint` decorator.
 
        .. code-block:: python
 
            app.add_url_rule("/", endpoint="index")
 
            @app.endpoint("index")
            def index():
                ...
 
        If ``view_func`` has a ``required_methods`` attribute, those
        methods are added to the passed and automatic methods. If it
        has a ``provide_automatic_methods`` attribute, it is used as the
        default if the parameter is not passed.
 
        :param rule: The URL rule string.
        :param endpoint: The endpoint name to associate with the rule
            and view function. Used when routing and building URLs.
            Defaults to ``view_func.__name__``.
        :param view_func: The view function to associate with the
            endpoint name.
        :param provide_automatic_options: Add the ``OPTIONS`` method and
            respond to ``OPTIONS`` requests automatically.
        :param options: Extra options passed to the
            :class:`~werkzeug.routing.Rule` object.
        NrM)r$rmrr„r…rnr'r'r(r¹sBzScaffold.add_url_rulezt.Callable[[F], F])rrcsdddœ‡‡fdd„ }|S)a®Decorate a view function to register it for the given
        endpoint. Used if a rule is added without a ``view_func`` with
        :meth:`add_url_rule`.
 
        .. code-block:: python
 
            app.add_url_rule("/ex", endpoint="example")
 
            @app.endpoint("example")
            def example():
                ...
 
        :param endpoint: The endpoint name to associate with the view
            function.
        rrcs|ˆjˆ<|Sr")r<©r©rr$r'r(rƒs
z$Scaffold.endpoint.<locals>.decoratorr')r$rrƒr'r‡r(rýszScaffold.endpointrrcCs|j dg¡ |¡|S)a²Register a function to run before each request.
 
        For example, this can be used to open a database connection, or
        to load the logged in user from the session.
 
        .. code-block:: python
 
            @app.before_request
            def load_user():
                if "user_id" in session:
                    g.user = db.session.get(session["user_id"])
 
        The function will be called without any arguments. If it returns
        a non-``None`` value, the value is handled as if it was the
        return value from the view, and further request handling is
        stopped.
 
        This is available on both app and blueprint objects. When used on an app, this
        executes before every request. When used on a blueprint, this executes before
        every request that the blueprint handles. To register with a blueprint and
        execute before every request, use :meth:`.Blueprint.before_app_request`.
        N)r?Ú
setdefaultÚappend©r$rr'r'r(Úbefore_requestszScaffold.before_requestrcCs|j dg¡ |¡|S)aWRegister a function to run after each request to this object.
 
        The function is called with the response object, and must return
        a response object. This allows the functions to modify or
        replace the response before it is sent.
 
        If a function raises an exception, any remaining
        ``after_request`` functions will not be called. Therefore, this
        should not be used for actions that must execute, such as to
        close resources. Use :meth:`teardown_request` for that.
 
        This is available on both app and blueprint objects. When used on an app, this
        executes after every request. When used on a blueprint, this executes after
        every request that the blueprint handles. To register with a blueprint and
        execute after every request, use :meth:`.Blueprint.after_app_request`.
        N)r@rˆr‰rŠr'r'r(Ú after_request0szScaffold.after_requestrcCs|j dg¡ |¡|S)aRegister a function to be called when the request context is
        popped. Typically this happens at the end of each request, but
        contexts may be pushed manually as well during testing.
 
        .. code-block:: python
 
            with app.test_request_context():
                ...
 
        When the ``with`` block exits (or ``ctx.pop()`` is called), the
        teardown functions are called just before the request context is
        made inactive.
 
        When a teardown function was called because of an unhandled
        exception it will be passed an error object. If an
        :meth:`errorhandler` is registered, it will handle the exception
        and the teardown will not receive it.
 
        Teardown functions must avoid raising exceptions. If they
        execute code that might fail they must surround that code with a
        ``try``/``except`` block and log any errors.
 
        The return values of teardown functions are ignored.
 
        This is available on both app and blueprint objects. When used on an app, this
        executes after every request. When used on a blueprint, this executes after
        every request that the blueprint handles. To register with a blueprint and
        execute after every request, use :meth:`.Blueprint.teardown_app_request`.
        N)rArˆr‰rŠr'r'r(Úteardown_requestEszScaffold.teardown_requestrcCs|jd |¡|S)a#Registers a template context processor function. These functions run before
        rendering a template. The keys of the returned dict are added as variables
        available in the template.
 
        This is available on both app and blueprint objects. When used on an app, this
        is called for every rendered template. When used on a blueprint, this is called
        for templates rendered from the blueprint's views. To register with a blueprint
        and affect every template, use :meth:`.Blueprint.app_context_processor`.
        N)rBr‰rŠr'r'r(Úcontext_processorgszScaffold.context_processorrcCs|jd |¡|S)alRegister a URL value preprocessor function for all view
        functions in the application. These functions will be called before the
        :meth:`before_request` functions.
 
        The function can modify the values captured from the matched url before
        they are passed to the view. For example, this can be used to pop a
        common language code value and place it in ``g`` rather than pass it to
        every view.
 
        The function is passed the endpoint name and values dict. The return
        value is ignored.
 
        This is available on both app and blueprint objects. When used on an app, this
        is called for every request. When used on a blueprint, this is called for
        requests that the blueprint handles. To register with a blueprint and affect
        every request, use :meth:`.Blueprint.app_url_value_preprocessor`.
        N)rCr‰rŠr'r'r(Úurl_value_preprocessorxszScaffold.url_value_preprocessorrcCs|jd |¡|S)aýCallback function for URL defaults for all view functions of the
        application.  It's called with the endpoint and values and should
        update the values passed in place.
 
        This is available on both app and blueprint objects. When used on an app, this
        is called for every request. When used on a blueprint, this is called for
        requests that the blueprint handles. To register with a blueprint and affect
        every request, use :meth:`.Blueprint.app_url_defaults`.
        N)rDr‰rŠr'r'r(Ú url_defaults‘s zScaffold.url_defaultsztype[Exception] | intz.t.Callable[[T_error_handler], T_error_handler])Úcode_or_exceptionrcsdddœ‡‡fdd„ }|S)aˆRegister a function to handle errors by code or exception class.
 
        A decorator that is used to register a function given an
        error code.  Example::
 
            @app.errorhandler(404)
            def page_not_found(error):
                return 'This page does not exist', 404
 
        You can also register handlers for arbitrary exceptions::
 
            @app.errorhandler(DatabaseError)
            def special_exception_handler(error):
                return 'Database connection failed', 500
 
        This is available on both app and blueprint objects. When used on an app, this
        can handle errors from every request. When used on a blueprint, this can handle
        errors from requests that the blueprint handles. To register with a blueprint
        and affect every request, use :meth:`.Blueprint.app_errorhandler`.
 
        .. versionadded:: 0.7
            Use :meth:`register_error_handler` instead of modifying
            :attr:`error_handler_spec` directly, for application wide error
            handlers.
 
        .. versionadded:: 0.7
           One can now additionally also register custom exception types
           that do not necessarily have to be a subclass of the
           :class:`~werkzeug.exceptions.HTTPException` class.
 
        :param code_or_exception: the code as integer for the handler, or
                                  an arbitrary exception
        rrcsˆ ˆ|¡|Sr")Úregister_error_handlerr†©r‘r$r'r(rƒÅs z(Scaffold.errorhandler.<locals>.decoratorr')r$r‘rƒr'r“r(Ú errorhandlerŸs&zScaffold.errorhandlerzft.ErrorHandlerCallable)r‘rrcCs$| |¡\}}||jd||<dS)z¼Alternative error attach function to the :meth:`errorhandler`
        decorator that is more straightforward to use for non decorator
        usage.
 
        .. versionadded:: 0.7
        N)Ú_get_exc_class_and_coder=)r$r‘rÚ    exc_classÚcoder'r'r(r’Ës zScaffold.register_error_handlerz"tuple[type[Exception], int | None])Úexc_class_or_codercCs˜t|tƒr@z t|}WqDtk
r<td|›dƒd‚YqDXn|}t|tƒr\t|›dƒ‚t|tƒsxtd|j›dƒ‚t|t    ƒrŒ||j
fS|dfSdS)a Get the exception class being handled. For HTTP status codes
        or ``HTTPException`` subclasses, return both the exception and
        status code.
 
        :param exc_class_or_code: Any exception class, or an HTTP status
            code as an integer.
        ú'z^' is not a recognized HTTP error code. Use a subclass of HTTPException with that code instead.Nzh is an instance, not a class. Handlers can only be registered for Exception classes or HTTP error codes.zl' is not a subclass of Exception. Handlers can only be registered for Exception classes or HTTP error codes.) r\r]rÚKeyErrorriÚ    ExceptionrpÚ
issubclassr*rr—)r˜r–r'r'r(r•Ús*
 
ÿü
 
ÿ
 ÿ
 
z Scaffold._get_exc_class_and_code)NNNN)rd)NNN)(r*Ú
__module__Ú __qualname__Ú__doc__Ú__annotations__r1r2rErKr#Úpropertyr4ÚsetterrWr5r_rbr    rcrkrrr-rvrxrzr|r~rqrrr‹rŒrrŽrrr”r’Ú staticmethodr•r'r'r'r(r.8s‚
  ú      ûC! +r.z
t.Callabler/)r„rcCs|dk    stdƒ‚|jS)zsInternal helper that returns the default endpoint for a given
    function.  This always is the function name.
    Nz/expected view func if endpoint is not provided.)ÚAssertionErrorr*)r„r'r'r(Ú_endpoint_from_view_funcsr¥cCsJt|dƒr| |¡St|ƒ}|jdkr4|jdkr4dStd|j›dƒ‚dS)zµAttempt to figure out if the given name is a package or a module.
 
    :param: loader: The loader that handled the name.
    :param mod_name: The name of the package or module.
    Ú
is_packageÚ_frozen_importlibZNamespaceLoaderTr™z<.is_package()' must be implemented for PEP 302 import hooks.N)Úhasattrr¦rIrr*ÚAttributeError)ÚloaderÚmod_nameÚclsr'r'r(Ú)_matching_loader_thinks_module_is_packages
 
 ÿr­zpathlib.PurePathrV)rPÚbasercCs,z| |¡WdStk
r&YdSXdS)NTF)Ú relative_tori)rPr®r'r'r(Ú_path_is_relative_to(s
 
r°c    sh| d¡\}}}z tj |¡}|dkr.tdƒ‚Wnttfk
rHYn”X|jdkr²tj |¡}|dk    r˜|jr˜t     t
j   |j¡¡‰‡fdd„|jDƒ}n
t |jƒ}t
j  t|ƒ¡S|jrÎt
j  t
j  |j¡¡St
j  |j¡St |¡}|dksø|dkrt
 ¡St|dƒr| |¡}n t|d    ƒr,|j}n t |¡j}t
j  t
j  |¡¡‰t||ƒrdt
j  ˆ¡‰ˆS)
z2Find the path that contains the package or module.Ú.Nz    not found>NÚ    namespacec3s|]}tˆ|ƒr|VqdSr")r°)Ú.0Úlocation©Ú package_pathr'r(Ú    <genexpr>Js
þz%_find_package_path.<locals>.<genexpr>Ú__main__Ú get_filenameÚarchive)Ú    partitionÚ    importlibÚutilÚ    find_specriÚ ImportErrorÚoriginÚsubmodule_search_locationsÚpathlibÚPathrOrPÚ
commonpathÚiterÚdirnameÚnextÚpkgutilÚ
get_loaderÚgetcwdr¨r¹rºÚ import_moduleÚ__file__Úabspathr­)r3Z root_mod_nameÚ_Z    root_specZ package_specZsearch_locationsrªrZr'rµr(Ú_find_package_path1sB  
  ÿ
þ
 
      rÏ)r3cCs¢t|ƒ}tj tj¡}tt |¡|ƒr.||fStj     |¡\}}| 
¡dkrštj     |¡\}}| 
¡dkrn||fStj  |¡ 
¡dkr’tj  |¡|fS||fSd|fS)aFind the prefix that a package is installed under, and the path
    that it would be imported from.
 
    The prefix is the directory containing the standard directory
    hierarchy (lib, bin, etc.). If the package is not installed to the
    system (:attr:`sys.prefix`) or a virtualenv (``site-packages``),
    ``None`` is returned.
 
    The path is the entry in :attr:`sys.path` that contains the package
    for import. If the package is not installed, it's assumed that the
    package was imported from the current working directory.
    z site-packagesÚlibN) rÏrOrPrÍÚsysÚprefixr°rÂÚPurePathÚsplitÚlowerrYrÆ)r3r¶Z    py_prefixZ site_parentZ site_folderÚparentÚfolderr'r'r(Ú find_packageus   rØ)BÚ
__future__rÚimportlib.utilr¼rOrÂrÈrÑr r+Ú collectionsrÚdatetimerÚ    functoolsrZjinja2rZwerkzeug.exceptionsrrZwerkzeug.utilsr    ÚÚftr;r Úglobalsr ZhelpersrrZ
templatingrÚ TYPE_CHECKINGÚwrappersrÚobjectÚ    _sentinelÚTypeVarÚCallableÚAnyrZAfterRequestCallablerZBeforeRequestCallablerZErrorHandlerCallablerZTeardownCallablerZ TemplateContextProcessorCallablerZURLDefaultCallablerZURLValuePreprocessorCallablerZ RouteCallablerr-r.r¥r­r°rÏrØr'r'r'r(Ú<module>sb               ÿÿ
T    D