Apply a wrapper to a function for decoration. This mixes Michele Simionato's decorator tool with nose's make_decorator, to apply a wrapper in a decorator so that all nose attributes, as well as function signature and other properties, survive the decoration cleanly. This will ensure
(wrapper, func)
| 67 | # Utility functions |
| 68 | |
| 69 | def apply_wrapper(wrapper, func): |
| 70 | """Apply a wrapper to a function for decoration. |
| 71 | |
| 72 | This mixes Michele Simionato's decorator tool with nose's make_decorator, |
| 73 | to apply a wrapper in a decorator so that all nose attributes, as well as |
| 74 | function signature and other properties, survive the decoration cleanly. |
| 75 | This will ensure that wrapped functions can still be well introspected via |
| 76 | IPython, for example. |
| 77 | """ |
| 78 | warnings.warn("The function `apply_wrapper` is deprecated since IPython 4.0", |
| 79 | DeprecationWarning, stacklevel=2) |
| 80 | import nose.tools |
| 81 | |
| 82 | return decorator(wrapper,nose.tools.make_decorator(func)(wrapper)) |
| 83 | |
| 84 | |
| 85 | def make_label_dec(label, ds=None): |