Your IP : 216.73.216.213
�
e fN � @ 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 � n 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/python34/lib64/python3.4/Tools/demo/eiffel.pyr s
zEiffelBaseMetaClass.__new__c C s� g } xZ | j � D]L \ } } | j d � s_ | j d � r@ q t | t � r | j | � q q Wx` | D]X } | j d | � } | j d | � } | s� | rj | j | | | | � | | <qj qj 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�append�get�make_eiffel_method)�clsr
�methods�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"