Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/logilab/common/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/logilab/common/__pycache__/interface.cpython-37.pyc

B

�d{T!
�@s.dZdZGdd�de�Zdd�Zd
dd�Zd	S)z�Bases class for interfaces to provide 'light' interface handling.

 TODO:
  _ implements a check method which check that an object implements the
    interface
  _ Attribute objects

  This module requires at least python 2.2
zrestructuredtext enc@s eZdZdZdd�Zee�ZdS)�	InterfacezBase class for interfaces.cCs
t||�S)N)�
implements)�cls�instance�r�I/opt/alt/python37/lib/python3.7/site-packages/logilab/common/interface.py�is_implemented_by szInterface.is_implemented_byN)�__name__�
__module__�__qualname__�__doc__r�classmethodrrrrrsrcCs@t|dd�}t|ttf�s |f}x|D]}t||�r&dSq&WdS)z^Return true if the give object (maybe an instance or class) implements
    the interface.
    �__implements__rTF)�getattr�
isinstance�list�tuple�
issubclass)�obj�	interface�kimplementsZimplementedinterfacerrrr%s

rFcCs�t||�sxy|j}t|�}t|�}Wntk
r@t}g}YnX|�|�||�|_xD|��D]}t||dd�q`Wn$|r�x|��D]}t||dd�q�WdS)z�Add interface to klass'__implements__ if not already implemented in.

    If klass is subclassed, ensure subclasses __implements__ it as well.

    NOTE: klass should be e new class.
    T)�_recursN)	rr
�typer�AttributeErrorr�append�__subclasses__�extend)�klassrrrZkimplementsklassZsubklassrrrr2s



rN)F)r�
__docformat__�objectrrrrrrr�<module>s