File: //usr/lib/python3/dist-packages/zope/component/__pycache__/interface.cpython-39.pyc
a
,�W� � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ dd
d�Z
dd
� Zddd�Zddd�Zddd�Zd dd�Zdd� Zdd� Zdd� ZdS )!zInterface utility functions
� )�alsoProvides)�
IInterface)�getGlobalSiteManager)�ComponentLookupError)�queryUtility)�CLASS_TYPESN� c C s| | sd|j |jf } t�|�s6t|t�s2t| d��dS |dur^|�t�sRt|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 � TypeErrorZextendsr r ZregisterUtility)�id� interfaceZ
iface_type�info�gsm� r �:/usr/lib/python3/dist-packages/zope/component/interface.py�provideInterface s
r c C s t |d�}|du rt|��|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 s dd� t | ||�D �S )�Interfaces search
c S s g | ]}|d �qS �� r ��.0Z
iface_utilr r r �
<listcomp>@ � z#searchInterface.<locals>.<listcomp>��searchInterfaceUtilities�r �
search_string�baser r r �searchInterface= s
�r( c C s dd� t | ||�D �S )r c S s g | ]}|d �qS )r r r r r r r! G r"