| Server IP : 195.114.193.97 / Your IP : 216.73.217.93 Web Server : LiteSpeed System : Linux host 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 User : sembi4241 ( 1126) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/web/__pycache__/ |
Upload File : |
o
�b7 � @ s� d dl mZmZmZmZmZmZmZ d dlm Z d dl
mZmZm
Z
d dlmZmZmZ er6d dlmZmZ ed�ZG dd� d�Zd ed
efdd�Zeddd��Ze e�G dd� d��Zd
S )� )�
TYPE_CHECKING�Callable�List�Optional�TypeVar�Union�overload)�implementer)�MissingRenderMethod�MissingTemplateLoader�UnexposedMethodError)�IRenderable�IRequest�ITemplateLoader)�Flattenable�Tag�Tc @ s� e Zd ZdZdedefdd�Ze� Zedede defdd ��Z
edede d
edeeef fdd ��Z
efdede d
edefdd �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�returnc G s@ |st d��|D ]}t|dg �}|�| � t|d|� q|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}.
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__"