Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/python/__pycache__/components.cpython-39.pyc
Ðазад
a k�hw7 � @ 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�s&t�|�}|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)ZadapterFactoryZ origInterfaceZinterfaceClasses�self�interfaceClass�factory� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/python/components.py�registerAdapter2 s r c C s6 t }t| tj�st�| �} |�| |�}|du r2|}|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"