| Server IP : 139.59.63.204 / Your IP : 216.73.217.62 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/twisted/web/__pycache__/ |
Upload File : |
�
oj� � � � d dl Z d dlmZmZmZmZmZmZmZm Z d dl
mZ d dlm
Z
mZmZ d dlmZmZmZ erd dlmZmZ ed� Z eded ef �
� Z G d� d� Zd
ed ef defd�Zedd�� Z ee� G d� d� � Zy)� N)�
TYPE_CHECKING�Any�Callable�List�Optional�TypeVar�Union�overload)�implementer)�MissingRenderMethod�MissingTemplateLoader�UnexposedMethodError)�IRenderable�IRequest�ITemplateLoader)�Flattenable�Tag�T�_Tc.)�boundc � � e Zd ZdZdededef defd�Z e� Ze dede
dedef fd �� Ze dede
d
e
deedef e
f fd�� Zefdede
d
edefd�Zy
)�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 ]- }t |dg � }|j | � 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 �6/usr/lib/python3/dist-packages/twisted/web/_element.py�__call__zExpose.__call__, sQ � �8 �O�O�Q�C��2� <�D�+2�4�9I�2�+N�N��!�!�$�'��D�*�N�;� <� �� �instance�
methodNamec � � y �N� )r# r( r) s r% �getz
Expose.getP s � �r'