![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/python/__pycache__/ |
o �bw7 � @ s� d Z ddlmZ ddlmZ ddlmZmZ ddlm Z ddl mZ e � Zda dd� Zd d � Zdd� Zd d� Zee� dd� ZeZG dd� d�ZG dd� d�ZG dd� de�Zd dd�ZG dd� d�ZG dd� d�Zg d�ZdS )!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: pass 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. � )�StringIO)�Dict)�declarations� interface)�AdapterRegistry)�reflectc G sz t }|sJ d��t|tj�st�|�}|D ]}|�|g|�}|dur,ts,td|� d���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 InterfaceNzan adapter (z) was already registered.� ) �globalRegistry� isinstancer �InterfaceClassr � implementedBy� registered�ALLOW_DUPLICATES� ValueError�register)�adapterFactory� origInterface�interfaceClasses�self�interfaceClass�factory� r �;/usr/lib/python3/dist-packages/twisted/python/components.py�registerAdapter2 s ��r c C s6 t }t| tj�s t�| �} |�| |�}|du r|}|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)� fromInterface�toInterface�defaultr r r r r �getAdapterFactoryJ s r c s"