| Current File : //proc/self/root/lib/python3.6/site-packages/zope/component/__pycache__/interface.cpython-36.pyc |
3
,�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 } tj|�s6t|t�s2t| d��dS |dk r^|jt�sRt|d��t||� nt}t � }|j
||| |� dS )z@ Mark 'interface' as a named utilty providing 'iface_type'.
z%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.6/interface.py�provideInterface s
r c C s t |d�}|dkrt|��|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 )zInterfaces search
c S s g | ]}|d �qS )� r )�.0�
iface_utilr r r �
<listcomp>@ s z#searchInterface.<locals>.<listcomp>)�searchInterfaceUtilities)r �
search_string�baser r r �searchInterface= s r! c C s dd� t | ||�D �S )zInterfaces search
c S s g | ]}|d �qS )r r )r r r r r r G s z&searchInterfaceIds.<locals>.<listcomp>)r )r r r r r r �searchInterfaceIdsD s r"