| Server IP : 138.197.176.125 / Your IP : 216.73.216.145 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/python/__pycache__/ |
Upload File : |
U
W[�7 � @ s
d Z ddlmZmZmZ ddlmZmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ e � Zdadd � Zd
d� Zdd
� Zdd� Zee� dd� ZeZeG dd� d��ZeG dd� d��ZG dd� de�Zd dd�ZG dd� de�ZG dd� de�Zd ddddddgZ dS )!a�
Component architecture for Twisted, based on Zope3 components.
Using the Zope3 API directly is strongly recommended. Everything
you need is in the top-level of the zope.interface package, e.g.::
from zope.interface import Interface, implementer
class IFoo(Interface):
pass
@implementer(IFoo)
class Foo:
print(IFoo.implementedBy(Foo)) # True
print(IFoo.providedBy(Foo())) # True
L{twisted.python.components.registerAdapter} from this module may be used to
add to Twisted's global adapter registry.
L{twisted.python.components.proxyForInterface} is a factory for classes
which allow access to only the parts of another class defined by a specified
interface.
� )�division�absolute_import�print_function)� interface�declarations)�AdapterRegistry)�NativeStringIO)�reflect)� _oldStylec G sx t }|std��t|tj�s&t�|�}|D ],}|�|g|�}|dk r*ts*t d|f ��q*|D ]}|�
|g|d| � q\dS )a
Register an adapter class.
An adapter class is expected to implement the given interface, by
adapting instances implementing 'origInterface'. An adapter class's
__init__ method should accept one parameter, an instance implementing
'origInterface'.
zYou need to pass an InterfaceNz'an adapter (%s) was already registered.� )�globalRegistry�AssertionError�
isinstancer �InterfaceClassr �
implementedByZ
registered�ALLOW_DUPLICATES�
ValueError�register)ZadapterFactoryZ
origInterfaceZinterfaceClasses�self�interfaceClass�factory� r �;/usr/lib/python3/dist-packages/twisted/python/components.py�registerAdapter2 s
r c C s6 t }t| tj�st�| �} |�| |�}|dkr2|}|S )z�Return registered adapter for a given class and interface.
Note that is tied to the *Twisted* global registry, and will
thus not find adapters registered elsewhere.
N)r r r r r r �lookup1)Z
fromInterfaceZtoInterface�defaultr r r r r �getAdapterFactoryJ s
r c s"