????
Your IP : 3.145.196.175
3
,�W��@s�dZddlmZddlmZddlmZddlmZddl m
Z
ddlmZdd
d�Z
dd
�Zddd�Zddd�Zddd�Zd dd�Zdd�Zdd�Zdd�ZdS)!zInterface utility functions
�)�alsoProvides)�
IInterface)�getGlobalSiteManager)�ComponentLookupError)�queryUtility)�CLASS_TYPESN�cCs||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� TypeErrorZextendsrrZregisterUtility)�id� interfaceZ
iface_type�info�gsm�r�/usr/lib/python3.6/interface.py�provideInterfaces
rcCst|d�}|dkrt|��|S)z3Return interface or raise ComponentLookupError
N)�queryInterfacer)�contextr�ifacerrr�getInterface.s
rcCstt||�S)z$Return an interface or ``None``
)rr)r�defaultrrrr7srcCsdd�t|||�D�S)zInterfaces search
cSsg|]}|d�qS)�r)�.0�
iface_utilrrr�
<listcomp>@sz#searchInterface.<locals>.<listcomp>)�searchInterfaceUtilities)r�
search_string�baserrr�searchInterface=sr!cCsdd�t|||�D�S)zInterfaces search
cSsg|]}|d�qS)rr)rrrrrrGsz&searchInterfaceIds.<locals>.<listcomp>)r)rrr rrr�searchInterfaceIdsDsr"csXt�}|jt�}�r.�j���fdd�|D�}�rF�fdd�|D�}ndd�|D�}|S)Ncs&g|]}t|d�j��dkr|�qS)rr)�getInterfaceAllDocs�find)rr)rrrrQsz,searchInterfaceUtilities.<locals>.<listcomp>csg|]}|dj��r|�qS)r)ZisOrExtends)rr)r rrrUscSsg|]}|�qSrr)rrrrrrXs)rZgetUtilitiesForr�lower)rrr rZiface_utilities�resr)r rrrKs
rcCsjd|j|jf}t|�j�t|j�j�g}tj|�r`x*t|�D]}|jt|j |�j�j��q>Wdj
|�S)Nz%s.%s�
)r r
�strr%�__doc__rr�sorted�appendZgetDescriptionFor�join)rZiface_idZdocs�namerrrr#\s
r#cCs|dkrdSt||�}|S)N�None)r)rrrrrr�nameToInterfaceis
r/csF�dkrdSt|�d�}�fdd�|D�}|s>�jd�jS|dS)Nr.)r cs$g|]}|�krd|j|jf�qS)z%s.%s)r r
)rr)rrrrusz#interfaceToName.<locals>.<listcomp>�.r)r!r r
)rr�itemsZidsr)rr�interfaceToNameos
r2)Nr)N)NN)NN)NN)r)Zzope.interfacerZzope.interface.interfacesrZzope.component.globalregistryrZzope.component.interfacesrZzope.component._apirZzope.component._compatrrrrr!r"rr#r/r2rrrr�<module>s