ó
    |ñ:iØ:  ã                  ó¨  • S SK Jr  S SKrS SKrS SKrS SKJr  S SKJ	r	  S SK
Jr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  \R(                  (       a  S SKJr  SSKJr  SSKJr  SSKJr  \" 5       r " S S5      r    SS jr \RB                  " S\RD                  S\RF                  4   S9r$SS jr%SS jr&SS jr' " S S5      r( " S S5      r)g) é    )ÚannotationsN)Úupdate_wrapper)ÚTracebackType)ÚHTTPExceptioné   )Útyping)Ú_cv_app)Ú_cv_request)Úappcontext_popped)Úappcontext_pushed)ÚWSGIEnvironment)ÚFlask)ÚSessionMixin)ÚRequestc                  ó€   • \ rS rSrSrSS jrSS jrSS jrSSS jjr\	4SS jjr
SSS	 jjrSS
 jrSS jrSS jrSrg)Ú_AppCtxGlobalsé   a‡  A plain object. Used as a namespace for storing data during an
application context.

Creating an app context automatically creates this object, which is
made available as the :data:`g` proxy.

.. describe:: 'key' in g

    Check whether an attribute is present.

    .. versionadded:: 0.10

.. describe:: iter(g)

    Return an iterator over the attribute names.

    .. versionadded:: 0.10
c                óV   •  U R                   U   $ ! [         a    [        U5      S ef = f©N©Ú__dict__ÚKeyErrorÚAttributeError©ÚselfÚnames     ÚL/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/flask/ctx.pyÚ__getattr__Ú_AppCtxGlobals.__getattr__4   s2   € ð	1Ø—=‘= Ñ&Ð&øÜó 	1Ü  Ó&¨DÐ0ð	1ús   ‚ ‘(c                ó    • X R                   U'   g r   ©r   )r   r   Úvalues      r   Ú__setattr__Ú_AppCtxGlobals.__setattr__:   s   € Ø#�‰�dÒó    c                óT   •  U R                   U	 g ! [         a    [        U5      S ef = fr   r   r   s     r   Ú__delattr__Ú_AppCtxGlobals.__delattr__=   s/   € ð	1Ø—‘˜dÑ#øÜó 	1Ü  Ó&¨DÐ0ð	1ús   ‚ �'Nc                ó8   • U R                   R                  X5      $ )zÆGet an attribute by name, or a default value. Like
:meth:`dict.get`.

:param name: Name of attribute to get.
:param default: Value to return if the attribute is not present.

.. versionadded:: 0.10
)r   Úget©r   r   Údefaults      r   r*   Ú_AppCtxGlobals.getC   s   € ð �}‰}× Ñ  Ó/Ð/r%   c                ó€   • U[         L a  U R                  R                  U5      $ U R                  R                  X5      $ )zäGet and remove an attribute by name. Like :meth:`dict.pop`.

:param name: Name of attribute to pop.
:param default: Value to return if the attribute is not present,
    instead of raising a ``KeyError``.

.. versionadded:: 0.11
)Ú	_sentinelr   Úpopr+   s      r   r0   Ú_AppCtxGlobals.popN   s6   € ð ”iÒØ—=‘=×$Ñ$ TÓ*Ð*à—=‘=×$Ñ$ TÓ3Ð3r%   c                ó8   • U R                   R                  X5      $ )a  Get the value of an attribute if it is present, otherwise
set and return a default value. Like :meth:`dict.setdefault`.

:param name: Name of attribute to get.
:param default: Value to set and return if the attribute is not
    present.

.. versionadded:: 0.11
)r   Ú
setdefaultr+   s      r   r3   Ú_AppCtxGlobals.setdefault\   s   € ð �}‰}×'Ñ'¨Ó6Ð6r%   c                ó   • XR                   ;   $ r   r!   )r   Úitems     r   Ú__contains__Ú_AppCtxGlobals.__contains__h   s   € Ø—}‘}Ñ$Ð$r%   c                ó,   • [        U R                  5      $ r   )Úiterr   ©r   s    r   Ú__iter__Ú_AppCtxGlobals.__iter__k   s   € Ü�D—M‘MÓ"Ð"r%   c                ó’   • [         R                  " S 5      nUb  SUR                  R                   S3$ [        R                  U 5      $ )Nz<flask.g of 'z'>)r	   r*   Úappr   ÚobjectÚ__repr__)r   Úctxs     r   rA   Ú_AppCtxGlobals.__repr__n   s;   € Ü�kŠk˜$ÓˆØ‰?Ø" 3§7¡7§<¡< .°Ð3Ð3Ü�‰˜tÓ$Ð$r%   © )r   ÚstrÚreturnút.Any)r   rE   r"   rG   rF   ÚNone)r   rE   rF   rH   r   )r   rE   r,   zt.Any | NonerF   rG   )r   rE   r,   rG   rF   rG   )r6   rE   rF   Úbool)rF   zt.Iterator[str]©rF   rE   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r#   r'   r*   r/   r0   r3   r7   r<   rA   Ú__static_attributes__rD   r%   r   r   r      s9   † ñô,1ô$ô1ö	0ð /8ö 4ö
7ô%ô#÷%r%   r   c                ó„   • [         R                  " S5      nUc  [        S5      eUR                  R	                  U 5        U $ )aw  Executes a function after this request.  This is useful to modify
response objects.  The function is passed the response object and has
to return the same or a new one.

Example::

    @app.route('/')
    def index():
        @after_this_request
        def add_header(response):
            response.headers['X-Foo'] = 'Parachute'
            return response
        return 'Hello World!'

This is more useful if a function other than the view function wants to
modify a response.  For instance think of a decorator that wants to add
some headers without converting the return value into a response object.

.. versionadded:: 0.9
Nzc'after_this_request' can only be used when a request context is active, such as in a view function.)r
   r*   ÚRuntimeErrorÚ_after_request_functionsÚappend)ÚfrB   s     r   Úafter_this_requestrV   u   sD   € ô. �/Š/˜$Ó
€Cà
�{Üð>ó
ð 	
ð
 × Ñ ×'Ñ'¨Ô*Ø€Hr%   ÚF.)Úboundc                ó˜   ^ ^• [         R                  " S5      mTc  [        S5      eTR                  5       mSUU 4S jjn[	        UT 5      $ )aò  A helper function that decorates a function to retain the current
request context.  This is useful when working with greenlets.  The moment
the function is decorated a copy of the request context is created and
then pushed when the function is called.  The current session is also
included in the copied request context.

Example::

    import gevent
    from flask import copy_current_request_context

    @app.route('/')
    def index():
        @copy_current_request_context
        def do_some_work():
            # do some work here, it can access flask.request or
            # flask.session like you would otherwise in the view function.
            ...
        gevent.spawn(do_some_work)
        return 'Regular response'

.. versionadded:: 0.10
Nzm'copy_current_request_context' can only be used when a request context is active, such as in a view function.c                 ó€   >• T   TR                   R                  T5      " U 0 UD6sS S S 5        $ ! , (       d  f       g = fr   )r?   Úensure_sync)ÚargsÚkwargsrB   rU   s     €€r   ÚwrapperÚ-copy_current_request_context.<locals>.wrapper½   s,   ø€ ÚØ—7‘7×&Ñ& qÔ)¨4Ð:°6Ñ:÷ �S�Sús   „!/¯
=)r\   rG   r]   rG   rF   rG   )r
   r*   rR   Úcopyr   )rU   r^   rB   s   ` @r   Úcopy_current_request_contextra   ›   sQ   ù€ ô0 �/Š/˜$Ó
€Cà
�{ÜðFó
ð 	
ð
 �(‰(‹*€C÷;ð ;ô ˜' 1Ó%Ð%r%   c                 ó2   • [         R                  " S5      SL$ )aª  If you have code that wants to test if a request context is there or
not this function can be used.  For instance, you may want to take advantage
of request information if the request object is available, but fail
silently if it is unavailable.

::

    class User(db.Model):

        def __init__(self, username, remote_addr=None):
            self.username = username
            if remote_addr is None and has_request_context():
                remote_addr = request.remote_addr
            self.remote_addr = remote_addr

Alternatively you can also just test any of the context bound objects
(such as :class:`request` or :class:`g`) for truthness::

    class User(db.Model):

        def __init__(self, username, remote_addr=None):
            self.username = username
            if remote_addr is None and request:
                remote_addr = request.remote_addr
            self.remote_addr = remote_addr

.. versionadded:: 0.7
N)r
   r*   rD   r%   r   Úhas_request_contextrc   Ä   s   € ô: �?Š?˜4Ó ¨Ð,Ð,r%   c                 ó2   • [         R                  " S5      SL$ )z°Works like :func:`has_request_context` but for the application
context.  You can also just do a boolean check on the
:data:`current_app` object instead.

.. versionadded:: 0.9
N)r	   r*   rD   r%   r   Úhas_app_contextre   ä   s   € ô �;Š;�tÓ DÐ(Ð(r%   c                  ó`   • \ rS rSrSrS
S jrSS jr\4SS jjrSS jr	        SS jr
Srg	)Ú
AppContextéî   zØThe app context contains application-specific information. An app
context is created and pushed at the beginning of each request if
one is not already active. An app context is also pushed when
running CLI commands.
c                ót   • Xl         UR                  S 5      U l        UR                  5       U l        / U l        g r   )r?   Úcreate_url_adapterÚurl_adapterÚapp_ctx_globals_classÚgÚ
_cv_tokens)r   r?   s     r   Ú__init__ÚAppContext.__init__õ   s1   € ØŒØ×1Ñ1°$Ó7ˆÔØ!$×!:Ñ!:Ó!<ˆŒØ?Aˆ�r%   c                óÈ   • U R                   R                  [        R                  " U 5      5        [        R
                  " U R                  U R                  R                  S9  g)z-Binds the app context to the current context.©Ú_async_wrapperN)rn   rT   r	   Úsetr   Úsendr?   r[   r;   s    r   ÚpushÚAppContext.pushû   s;   € à�‰×ÑœwŸ{š{¨4Ó0Ô1Ü×Ò˜tŸx™x¸¿¹×8LÑ8LÓMr%   c                ó\  •  [        U R                  5      S:X  a<  U[        L a  [        R                  " 5       S   nU R
                  R                  U5        [        R                  " 5       n[        R                  " U R                  R                  5       5        X La  [        SU< SU < S35      e[        R                  " U R
                  U R
                  R                  S9  g! [        R                  " 5       n[        R                  " U R                  R                  5       5        f = f)zPops the app context.r   zPopped wrong app context. (ú instead of Ú)rr   N)Úlenrn   r/   ÚsysÚexc_infor?   Údo_teardown_appcontextr	   r*   Úresetr0   ÚAssertionErrorr   ru   r[   )r   ÚexcrB   s      r   r0   ÚAppContext.pop   sÒ   € ð	1Ü�4—?‘?Ó# qÓ(Øœ)Ò#ÜŸ,š,›.¨Ñ+�CØ—‘×/Ñ/°Ô4ä—+’+“-ˆCÜ�MŠM˜$Ÿ/™/×-Ñ-Ó/Ô0àŠ?Ü Ø-¨c©W°LÀÁÈÐJóð ô 	×Ò˜tŸx™x¸¿¹×8LÑ8LÓMøô —+’+“-ˆCÜ�MŠM˜$Ÿ/™/×-Ñ-Ó/Õ0ús   ‚AC& Ã&AD+c                ó&   • U R                  5         U $ r   ©rv   r;   s    r   Ú	__enter__ÚAppContext.__enter__  ó   € Ø�	‰	ŒØˆr%   c                ó&   • U R                  U5        g r   ©r0   ©r   Úexc_typeÚ	exc_valueÚtbs       r   Ú__exit__ÚAppContext.__exit__  ó   € ð 	�‰�Õr%   )rn   r?   rm   rk   N)r?   r   rF   rH   ©rF   rH   ©r�   úBaseException | NonerF   rH   )rF   rg   ©r‹   ztype | NonerŒ   r“   r�   zTracebackType | NonerF   rH   )rK   rL   rM   rN   rO   ro   rv   r/   r0   r…   rŽ   rP   rD   r%   r   rg   rg   î   sN   † ñôBôNð
 /8ö Nô$ðàðð (ðð !ð	ð
 
÷r%   rg   c                  ó˜   • \ rS rSrSr  S         SS jjrSS jrSS jrSS jr\	4SS jjr
SS	 jr        SS
 jrSS jrSrg)ÚRequestContexti  a›  The request context contains per-request information. The Flask
app creates and pushes it at the beginning of the request, then pops
it at the end of the request. It will create the URL adapter and
request object for the WSGI environment provided.

Do not attempt to use this class directly, instead use
:meth:`~flask.Flask.test_request_context` and
:meth:`~flask.Flask.request_context` to create this object.

When the request context is popped, it will evaluate all the
functions registered on the application for teardown execution
(:meth:`~flask.Flask.teardown_request`).

The request context is automatically popped at the end of the
request. When using the interactive debugger, the context will be
restored so ``request`` is still accessible. Similarly, the test
client can preserve the context after the request ends. However,
teardown functions may already have closed some resources such as
database connections.
Nc                ó:  • Xl         Uc"  UR                  U5      nUR                  Ul        X0l        S U l         UR                  U R                  5      U l        S U l	        X@l
        / U l        / U l        g ! [         a  nXPR                  l         S nAN;S nAff = fr   )r?   Úrequest_classÚjsonÚjson_moduleÚrequestrk   rj   r   Úrouting_exceptionÚflashesÚsessionrS   rn   )r   r?   Úenvironr›   rž   Úes         r   ro   ÚRequestContext.__init__5  s˜   € ð ŒØ‰?Ø×'Ñ'¨Ó0ˆGØ"%§(¡(ˆGÔØ 'ŒØˆÔð	/Ø"×5Ñ5°d·l±lÓCˆDÔð 6:ˆŒØ,3Œð OQˆÔ%ð ð 	�øô ó 	/Ø-.�L‰L×*Ñ*ûð	/ús   º A6 Á6
BÂ BÂBc                óŠ   • U R                  U R                  U R                  R                  U R                  U R                  S9$ )aí  Creates a copy of this request context with the same request object.
This can be used to move a request context to a different greenlet.
Because the actual request object is the same this cannot be used to
move a request context to a different thread unless access to the
request object is locked.

.. versionadded:: 0.10

.. versionchanged:: 1.1
   The current session object is used instead of reloading the original
   data. This prevents `flask.session` pointing to an out-of-date object.
)rŸ   r›   rž   )Ú	__class__r?   r›   rŸ   rž   r;   s    r   r`   ÚRequestContext.copyQ  s<   € ð �~‰~Ø�H‰HØ—L‘L×(Ñ(Ø—L‘LØ—L‘Lð	 ð 
ð 	
r%   c                óÌ   •  U R                   R                  SS9nUu  U R                  l        U R                  l        g! [
         a  nX R                  l         SnAgSnAff = f)zJCan be overridden by a subclass to hook into the matching
of the request.
T)Úreturn_ruleN)rk   Úmatchr›   Úurl_ruleÚ	view_argsr   rœ   )r   Úresultr    s      r   Úmatch_requestÚRequestContext.match_requeste  sU   € ð	/Ø×%Ñ%×+Ñ+¸Ð+Ð=ˆFØ<BÑ9ˆD�L‰LÔ! 4§<¡<Õ#9øÜó 	/Ø-.�L‰L×*Ñ*ûð	/ús   ‚<? ¿
A#Á	AÁA#c                óV  • [         R                  " S 5      nUb  UR                  U R                  La+  U R                  R                  5       nUR	                  5         OS nU R
                  R                  [        R                  " U 5      U45        U R                  cn  U R                  R                  nUR                  U R                  U R                  5      U l	        U R                  c   UR                  U R                  5      U l	        U R                  b  U R                  5         g g r   )r	   r*   r?   Úapp_contextrv   rn   rT   r
   rt   rž   Úsession_interfaceÚopen_sessionr›   Úmake_null_sessionrk   r«   )r   Úapp_ctxr¯   s      r   rv   ÚRequestContext.pusho  sÝ   € ô —+’+˜dÓ#ˆà‰?˜gŸk™k°·±Ò9Ø—h‘h×*Ñ*Ó,ˆGØ�L‰L�NàˆGà�‰×Ñ¤§¢°Ó 5°wÐ?Ô@ð �<‰<ÑØ $§¡× :Ñ :ÐØ,×9Ñ9¸$¿(¹(ÀDÇLÁLÓQˆDŒLà�|‰|Ñ#Ø0×BÑBÀ4Ç8Á8ÓL�”ð ×ÑÑ'Ø×ÑÕ ð (r%   c           	     óT  • [        U R                  5      S:H  n U(       a]  U[        L a  [        R                  " 5       S   nU R
                  R                  U5        [        U R                  SS5      nUb  U" 5         [        R                  " 5       nU R                  R                  5       u  pV[        R                  " U5        U(       a  SUR                  R                  S'   Ub  UR                  U5        X@La  [        SU< SU < S35      eg! [        R                  " 5       nU R                  R                  5       u  pV[        R                  " U5        U(       a  SUR                  R                  S'   Ub  UR                  U5        X@La  [        SU< SU < S35      ef = f)zãPops the request context and unbinds it by doing that.  This will
also trigger the execution of functions registered by the
:meth:`~flask.Flask.teardown_request` decorator.

.. versionchanged:: 0.9
   Added the `exc` argument.
r   ÚcloseNzwerkzeug.requestzPopped wrong request context. (ry   rz   )r{   rn   r/   r|   r}   r?   Údo_teardown_requestÚgetattrr›   r
   r*   r0   r   rŸ   r€   )r   r�   Úclear_requestÚrequest_closerB   Útokenr²   s          r   r0   ÚRequestContext.popŒ  sr  € ô ˜DŸO™OÓ,°Ñ1ˆð	ÞØœ)Ò#ÜŸ,š,›.¨Ñ+�CØ—‘×,Ñ,¨SÔ1ä '¨¯©°g¸tÓ D�Ø Ñ,Ù!”Oä—/’/Ó#ˆCØ!Ÿ_™_×0Ñ0Ó2‰NˆEÜ×Ò˜eÔ$ö Ø:>�—‘×#Ñ#Ð$6Ñ7àÑ"Ø—‘˜CÔ àŠÜ$Ø5°c±W¸LÈÉÐPQÐRóð ð øô —/’/Ó#ˆCØ!Ÿ_™_×0Ñ0Ó2‰NˆEÜ×Ò˜eÔ$ö Ø:>�—‘×#Ñ#Ð$6Ñ7àÑ"Ø—‘˜CÔ àŠÜ$Ø5°c±W¸LÈÉÐPQÐRóð ð ús   šA$D ÄBF'c                ó&   • U R                  5         U $ r   r„   r;   s    r   r…   ÚRequestContext.__enter__±  r‡   r%   c                ó&   • U R                  U5        g r   r‰   rŠ   s       r   rŽ   ÚRequestContext.__exit__µ  r�   r%   c           	     óÀ   • S[        U 5      R                   SU R                  R                  < SU R                  R                   SU R
                  R                   S3	$ )NÚ<Ú z [z] of Ú>)ÚtyperK   r›   ÚurlÚmethodr?   r   r;   s    r   rA   ÚRequestContext.__repr__½  sQ   € à”�T“
×#Ñ#Ð$ A d§l¡l×&6Ñ&6Ñ%9Ø�—‘×$Ñ$Ð% U¨4¯8©8¯=©=¨/¸ð<ð	
r%   )rS   rn   r?   r�   r›   rž   rk   )NN)
r?   r   rŸ   r   r›   zRequest | Nonerž   zSessionMixin | NonerF   rH   )rF   r–   r‘   r’   r”   rJ   )rK   rL   rM   rN   rO   ro   r`   r«   rv   r/   r0   r…   rŽ   rA   rP   rD   r%   r   r–   r–     s“   † ñð2 #'Ø'+ðàðð !ðð  ð	ð
 %ðð 
õô8
ô(/ô!ð: /8ö #ôJðàðð (ðð !ð	ð
 
ô÷
r%   r–   )rU   úft.AfterRequestCallable[t.Any]rF   rÈ   )rU   rW   rF   rW   )rF   rI   )*Ú
__future__r   Úcontextvarsr|   r   ÚtÚ	functoolsr   Útypesr   Úwerkzeug.exceptionsr   Ú ÚftÚglobalsr	   r
   Úsignalsr   r   ÚTYPE_CHECKINGÚ_typeshed.wsgir   r?   r   Úsessionsr   Úwrappersr   r@   r/   r   rV   ÚTypeVarÚCallableÚAnyrW   ra   rc   re   rg   r–   rD   r%   r   Ú<module>rÚ      s³   ðÝ "ã Û 
Û Ý $Ý å -å Ý Ý  Ý &Ý &à‡?‡?Ý.åÝ&Ý!ñ ‹H€	÷U%ñ U%ðp Ø%ð à#ô ðF ‡I‚Iˆc˜Ÿ™ C¨¯© JÑ/Ñ0€ô&&ôR-ô@)÷.ñ .÷bb
ò b
r%   