This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#653: unhandled exceptions no longer reported twice.
- Loading branch information
Showing
13 changed files
with
541 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,35 @@ | ||
def overrides(method): | ||
''' | ||
Initially meant to be used as | ||
Meant to be used as | ||
class B: | ||
@overrides(A.m1) | ||
def m1(self): | ||
pass | ||
but as we want to be compatible with Jython 2.1 where decorators have an uglier syntax (needing an assign | ||
after the method), it should now be used without being a decorator as below (in which case we don't even check | ||
for anything, just that the parent name was actually properly loaded). | ||
i.e.: | ||
class B: | ||
overrides(A.m1) | ||
def m1(self): | ||
pass | ||
''' | ||
return | ||
def wrapper(func): | ||
if func.__name__ != method.__name__: | ||
msg = "Wrong @override: %r expected, but overwriting %r." | ||
msg = msg % (func.__name__, method.__name__) | ||
raise AssertionError(msg) | ||
|
||
# def wrapper(func): | ||
# if func.__name__ != method.__name__: | ||
# msg = "Wrong @override: %r expected, but overwriting %r." | ||
# msg = msg % (func.__name__, method.__name__) | ||
# raise AssertionError(msg) | ||
# | ||
# if func.__doc__ is None: | ||
# func.__doc__ = method.__doc__ | ||
# | ||
# return func | ||
# | ||
# return wrapper | ||
if func.__doc__ is None: | ||
func.__doc__ = method.__doc__ | ||
|
||
return func | ||
|
||
return wrapper | ||
|
||
def implements(method): | ||
return | ||
# def wrapper(func): | ||
# if func.__name__ != method.__name__: | ||
# msg = "Wrong @implements: %r expected, but implementing %r." | ||
# msg = msg % (func.__name__, method.__name__) | ||
# raise AssertionError(msg) | ||
# | ||
# if func.__doc__ is None: | ||
# func.__doc__ = method.__doc__ | ||
# | ||
# return func | ||
# | ||
# return wrapper | ||
def wrapper(func): | ||
if func.__name__ != method.__name__: | ||
msg = "Wrong @implements: %r expected, but implementing %r." | ||
msg = msg % (func.__name__, method.__name__) | ||
raise AssertionError(msg) | ||
|
||
if func.__doc__ is None: | ||
func.__doc__ = method.__doc__ | ||
|
||
return func | ||
|
||
return wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.