§
    ÈtºfŒ  ã                   óL  — d dl Z d dlmZmZmZmZmZmZmZm	Z	 d dl
mZ d dlmZmZmZ d dlmZmZmZ erd dlmZmZ  ed¦  «        Z eded	ef         ¬
¦  «        Z G d„ d¦  «        Zded	ef         defd„Zedd„¦   «         Z ee¦  «         G d„ d¦  «        ¦   «         ZdS )é    N)ÚTYPE_CHECKINGÚAnyÚCallableÚListÚOptionalÚTypeVarÚUnionÚoverload)Úimplementer)ÚMissingRenderMethodÚMissingTemplateLoaderÚUnexposedMethodError)ÚIRenderableÚIRequestÚITemplateLoader)ÚFlattenableÚTagÚTÚ_Tc.)Úboundc                   óâ   — e Zd ZdZdededef         defd„Z e¦   «         Ze	dede
dedef         fd	„¦   «         Ze	dede
d
edeedef         ef         fd„¦   «         Zefdede
d
edefd„ZdS )ÚExposea/  
    Helper for exposing methods for various uses using a simple decorator-style
    callable.

    Instances of this class can be called with one or more functions as
    positional arguments.  The names of these functions will be added to a list
    on the class object of which they are methods.
    ÚfÚfuncObjs.Úreturnc                ó¦   — t          j        |g|¦  «        D ]9}t          |dg ¦  «        }|                     | ¦  «         t	          |d|¦  «         Œ:|S )a;  
        Add one or more functions to the set of exposed functions.

        This is a way to declare something about a class definition, similar to
        L{zope.interface.implementer}.  Use it like this::

            magic = Expose('perform extra magic')
            class Foo(Bar):
                def twiddle(self, x, y):
                    ...
                def frob(self, a, b):
                    ...
                magic(twiddle, frob)

        Later you can query the object::

            aFoo = Foo()
            magic.get(aFoo, 'twiddle')(x=1, y=2)

        The call to C{get} will fail if the name it is given has not been
        exposed using C{magic}.

        @param funcObjs: One or more function objects which will be exposed to
        the client.

        @return: The first of C{funcObjs}.
        ÚexposedThrough)Ú	itertoolsÚchainÚgetattrÚappendÚsetattr)Úselfr   r   ÚfObjr   s        úS/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/web/_element.pyÚ__call__zExpose.__call__,   sb   € õ8 ”O Q C¨Ñ2Ô2ð 	<ð 	<ˆDÝ+2°4Ð9IÈ2Ñ+NÔ+NˆNØ×!Ò! $Ñ'Ô'Ð'Ý�DÐ*¨NÑ;Ô;Ð;Ð;Øˆó    ÚinstanceÚ
methodNamec                 ó   — d S ©N© )r#   r(   r)   s      r%   Úgetz
Expose.getP   s   € àˆr'   Údefaultc                 ó   — d S r+   r,   )r#   r(   r)   r.   s       r%   r-   z
Expose.getT   s	   € ð 	ˆr'   c                 óˆ   — t          ||d¦  «        }t          |dg ¦  «        }| |vr|| j        u rt          | |¦  «        ‚|S |S )aB  
        Retrieve an exposed method with the given name from the given instance.

        @raise UnexposedMethodError: Raised if C{default} is not specified and
        there is no exposed method with the given name.

        @return: A callable object for the named method assigned to the given
        instance.
        Nr   )r    Ú
_nodefaultr   )r#   r(   r)   r.   Úmethodr   s         r%   r-   z
Expose.getZ   sY   € õ ˜ :¨tÑ4Ô4ˆÝ  Ð)9¸2Ñ>Ô>ˆØ�~Ð%Ð%Ø˜$œ/Ð)Ð)Ý*¨4°Ñ<Ô<Ð<ØˆNØˆr'   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úobjectr&   r1   r
   Ústrr   r-   r   r	   r,   r'   r%   r   r   "   s-  € € € € € ðð ð ˜#ð  ¨X°c¸6°kÔ-Bð  Àsð  ð  ð  ð  ðD �‘”€Jàð˜Fð °ð ¸ÀÀcÀÔ8Jð ð ð ñ „Xðð ðØðØ,/ðØ:;ðà	ˆx˜˜S˜Ô! 1Ð$Ô	%ðð ð ñ „Xðð DNðð ØðØ,/ðØ:@ðà	ðð ð ð ð ð r'   r   Úthunkr   c                 ó:   — t          ¦   «         }| j        |_        |S r+   )r   r6   )r9   Úexposes     r%   Úexposerr<   o   s   € Ý‰XŒX€FØ”]€F„NØ€Mr'   c                  ó   — dS )aâ  
    Decorate with L{renderer} to use methods as template render directives.

    For example::

        class Foo(Element):
            @renderer
            def twiddle(self, request, tag):
                return tag('Hello, world.')

        <div xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
            <span t:render="twiddle" />
        </div>

    Will result in this final output::

        <div>
            <span>Hello, world.</span>
        </div>
    Nr,   r,   r'   r%   Úrendererr>   u   s   € € € r'   c                   ó”   — e Zd ZU dZdZee         ed<   ddee         fd„Zde	de
ee         dgdf         fd	„Zd
ee         ddfd„ZdS )ÚElementaª  
    Base for classes which can render part of a page.

    An Element is a renderer that can be embedded in a stan document and can
    hook its template (from the loader) up to render methods.

    An Element might be used to encapsulate the rendering of a complex piece of
    data which is to be displayed in multiple different contexts.  The Element
    allows the rendering logic to be easily re-used in different ways.

    Element returns render methods which are registered using
    L{twisted.web._element.renderer}.  For example::

        class Menu(Element):
            @renderer
            def items(self, request, tag):
                ....

    Render methods are invoked with two arguments: first, the
    L{twisted.web.http.Request} being served and second, the tag object which
    "invoked" the render method.

    @ivar loader: The factory which will be used to load documents to
        return from C{render}.
    NÚloaderc                 ó   — |�	|| _         d S d S r+   )rA   )r#   rA   s     r%   Ú__init__zElement.__init__«   s   € ØÐØ ˆDŒKˆKˆKð Ðr'   Únamer   r   r   c                 ób   — t                                | |d¦  «        }|€t          | |¦  «        ‚|S )z=
        Look up and return the named render method.
        N)r>   r-   r   )r#   rD   r2   s      r%   ÚlookupRenderMethodzElement.lookupRenderMethod¯   s3   € õ —’˜d D¨$Ñ/Ô/ˆØˆ>Ý% d¨DÑ1Ô1Ð1Øˆr'   Úrequestc                 óZ   — | j         }|€t          | ¦  «        ‚|                     ¦   «         S )aê  
        Implement L{IRenderable} to allow one L{Element} to be embedded in
        another's template or rendering output.

        (This will simply load the template from the C{loader}; when used in a
        template, the flattening engine will keep track of this object
        separately as the object to lookup renderers on and call
        L{Element.renderer} to look them up.  The resulting object from this
        method is not directly associated with this L{Element}.)
        )rA   r   Úload)r#   rG   rA   s      r%   ÚrenderzElement.renderº   s,   € ð ”ˆØˆ>Ý'¨Ñ-Ô-Ð-Ø�{Š{‰}Œ}Ðr'   r+   )r3   r4   r5   r6   rA   r   r   Ú__annotations__rC   r8   r   r   rF   rJ   r,   r'   r%   r@   r@   �   s»   € € € € € € ðð ð4 )-€FˆH�_Ô%Ð,Ð,Ñ,ð!ð !˜x¨Ô8ð !ð !ð !ð !ð	Øð	à	�8˜HÔ% uÐ-¨}Ð<Ô	=ð	ð 	ð 	ð 	ð˜h xÔ0ð °]ð ð ð ð ð ð r'   r@   )r   N)r   Útypingr   r   r   r   r   r   r	   r
   Úzope.interfacer   Útwisted.web.errorr   r   r   Útwisted.web.iwebr   r   r   Útwisted.web.templater   r   r   r7   r   r   r<   r>   r@   r,   r'   r%   ú<module>rQ      sï  ðð
 Ð Ð Ð ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 'Ð &Ð &Ð &Ð &Ð &ðð ð ð ð ð ð ð ð ð ð
 DÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ Càð 6Ø5Ð5Ð5Ð5Ð5Ð5Ð5Ð5ð €GˆC�L„L€Ø€gˆe˜8 C¨ KÔ0Ð1Ñ1Ô1€ðJð Jð Jð Jð Jñ Jô Jð JðZ�8˜C ˜KÔ(ð ¨Vð ð ð ð ð 	ðð ð ñ 	„ðð. €ˆ[ÑÔð:ð :ð :ð :ð :ñ :ô :ñ Ôð:ð :ð :r'   