Your IP : 216.73.216.213
��YfN � @ s� d Z d d l Z d d l m Z Gd d � d e � Z Gd d � d e � Z Gd d � d � Z Gd
d � d � Z Gd d
� d
e � Z
Gd d � d e j � Z e
d k r� e j � d S)zj
Support Eiffel-style preconditions and postconditions for functions.
An example for Python metaclasses.
� N)�FunctionTypec s4 e Z d Z � f d d � Z e d d � � Z � S)�EiffelBaseMetaClassc s, | j | � t t | � j | | | | � S)N)�convert_methods�superr �__new__)�meta�name�bases�dict)� __class__� �6/opt/alt/python35/lib64/python3.5/Tools/demo/eiffel.pyr s
zEiffelBaseMetaClass.__new__c C s� g } xl | j � D]^ \ } } | j d � s= | j d � rU t | t � sq t � q t | t � r | j | � q Wx] | D]U } | j d | � } | j d | � } | s� | r| | j | | | | � | | <q| Wd S)z�Replace functions in dict with EiffelMethod wrappers.
The dict is modified in place.
If a method ends in _pre or _post, it is removed from the dict
regardless of whether there is a corresponding method.
�_pre�_postz%s_prez%s_postN)�items�endswith�
isinstance�function�AssertionError�append�get�make_eiffel_method)�clsr
Zmethods�k�v�m�pre�postr r r
r s
z#EiffelBaseMetaClass.convert_methods)�__name__�
__module__�__qualname__r �classmethodr r r )r r
r s r c @ s"