Back to index

python3.2  3.2.2
Public Member Functions
eiffel.EiffelBaseMetaClass Class Reference
Inheritance diagram for eiffel.EiffelBaseMetaClass:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __new__
def convert_methods

Detailed Description

Definition at line 12 of file eiffel.py.


Member Function Documentation

def eiffel.EiffelBaseMetaClass.__new__ (   meta,
  name,
  bases,
  dict 
)

Definition at line 14 of file eiffel.py.

00014 
00015     def __new__(meta, name, bases, dict):
00016         meta.convert_methods(dict)
00017         return super(EiffelBaseMetaClass, meta).__new__(
00018             meta, name, bases, dict)

def eiffel.EiffelBaseMetaClass.convert_methods (   cls,
  dict 
)
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.

Definition at line 20 of file eiffel.py.

00020 
00021     def convert_methods(cls, dict):
00022         """Replace functions in dict with EiffelMethod wrappers.
00023 
00024         The dict is modified in place.
00025 
00026         If a method ends in _pre or _post, it is removed from the dict
00027         regardless of whether there is a corresponding method.
00028         """
00029         # find methods with pre or post conditions
00030         methods = []
00031         for k, v in dict.items():
00032             if k.endswith('_pre') or k.endswith('_post'):
00033                 assert isinstance(v, function)
00034             elif isinstance(v, function):
00035                 methods.append(k)
00036         for m in methods:
00037             pre = dict.get("%s_pre" % m)
00038             post = dict.get("%s_post" % m)
00039             if pre or post:
00040                 dict[k] = cls.make_eiffel_method(dict[m], pre, post)
00041 


The documentation for this class was generated from the following file: