| Tor Norbye | 1aa2e09 | 2014-08-20 17:01:23 -0700 | [diff] [blame^] | 1 | def overrides(method): |
| 2 | ''' |
| 3 | Initially meant to be used as |
| 4 | |
| 5 | class B: |
| 6 | @overrides(A.m1) |
| 7 | def m1(self): |
| 8 | pass |
| 9 | |
| 10 | but as we want to be compatible with Jython 2.1 where decorators have an uglier syntax (needing an assign |
| 11 | after the method), it should now be used without being a decorator as below (in which case we don't even check |
| 12 | for anything, just that the parent name was actually properly loaded). |
| 13 | |
| 14 | i.e.: |
| 15 | |
| 16 | class B: |
| 17 | overrides(A.m1) |
| 18 | def m1(self): |
| 19 | pass |
| 20 | ''' |
| 21 | return |
| 22 | |
| 23 | # def wrapper(func): |
| 24 | # if func.__name__ != method.__name__: |
| 25 | # msg = "Wrong @override: %r expected, but overwriting %r." |
| 26 | # msg = msg % (func.__name__, method.__name__) |
| 27 | # raise AssertionError(msg) |
| 28 | # |
| 29 | # if func.__doc__ is None: |
| 30 | # func.__doc__ = method.__doc__ |
| 31 | # |
| 32 | # return func |
| 33 | # |
| 34 | # return wrapper |
| 35 | |
| 36 | def implements(method): |
| 37 | return |
| 38 | # def wrapper(func): |
| 39 | # if func.__name__ != method.__name__: |
| 40 | # msg = "Wrong @implements: %r expected, but implementing %r." |
| 41 | # msg = msg % (func.__name__, method.__name__) |
| 42 | # raise AssertionError(msg) |
| 43 | # |
| 44 | # if func.__doc__ is None: |
| 45 | # func.__doc__ = method.__doc__ |
| 46 | # |
| 47 | # return func |
| 48 | # |
| 49 | # return wrapper |