mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Use decorators.
This commit is contained in:
parent
9ba3684ecc
commit
75b64e65f1
3 changed files with 8 additions and 15 deletions
|
@ -9,6 +9,7 @@ class EiffelBaseMetaClass(type):
|
|||
return super(EiffelBaseMetaClass, meta).__new__(meta, name, bases,
|
||||
dict)
|
||||
|
||||
@classmethod
|
||||
def convert_methods(cls, dict):
|
||||
"""Replace functions in dict with EiffelMethod wrappers.
|
||||
|
||||
|
@ -30,11 +31,10 @@ class EiffelBaseMetaClass(type):
|
|||
if pre or post:
|
||||
dict[k] = cls.make_eiffel_method(dict[m], pre, post)
|
||||
|
||||
convert_methods = classmethod(convert_methods)
|
||||
|
||||
class EiffelMetaClass1(EiffelBaseMetaClass):
|
||||
# an implementation of the "eiffel" meta class that uses nested functions
|
||||
|
||||
@staticmethod
|
||||
def make_eiffel_method(func, pre, post):
|
||||
def method(self, *args, **kwargs):
|
||||
if pre:
|
||||
|
@ -49,8 +49,6 @@ class EiffelMetaClass1(EiffelBaseMetaClass):
|
|||
|
||||
return method
|
||||
|
||||
make_eiffel_method = staticmethod(make_eiffel_method)
|
||||
|
||||
class EiffelMethodWrapper:
|
||||
|
||||
def __init__(self, inst, descr):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue