File: //lib/python3/dist-packages/zope/component/__pycache__/interface.cpython-310.pyc
o
,�W� � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ dd
d�Z
dd
� Zddd�Zddd�Zddd�Zddd�Zdd� Zdd� Zdd� ZdS )zInterface utility functions
� )�alsoProvides)�
IInterface)�getGlobalSiteManager)�ComponentLookupError)�queryUtility)�CLASS_TYPESN� c C s| | s
d|j |jf } t�|�st|t�st| d��dS |dur/|�t�s)t|d��t||� nt}t � }|�
||| |� dS )z@ Mark 'interface' as a named utilty providing 'iface_type'.
�%s.%szis not an interface or classNzis not an interface type)�
__module__�__name__r �
providedBy�
isinstancer � TypeError�extendsr r �registerUtility)�id� interface�
iface_type�info�gsm� r �:/usr/lib/python3/dist-packages/zope/component/interface.py�provideInterface s
r c C s t |d�}|du r
t|��|S )z3Return interface or raise ComponentLookupError
N)�queryInterfacer ��contextr �ifacer r r �getInterface. s
r c C s t t| |�S )z$Return an interface or ``None``
)r r )r �defaultr r r r 7 s r c C � dd� t | ||�D �S )�Interfaces search
c S � g | ]}|d �qS �� r ��.0�
iface_utilr r r �
<listcomp>@ � z#searchInterface.<locals>.<listcomp>��searchInterfaceUtilities�r �
search_string�baser r r �searchInterface= �
�r. c C r )r c S r! )r r r$ r r r r'