ipython/ipython — pull request #6362 by embray (2014-08-26 21:01:34+00:00)
Title: Better support for wrapped function signatures in help

In Python 3.2 `functools.wraps` introduced adding a `__wrapped__` attribute to wrapper functions that explicitly references the original function being wrapped. The standard module introspection tools, in turn, know how to handle this `__wrapped__` attribute. For example, the `help()` built-in uses it to display the call signature of the wrapped function, rather than the *wrapper* function, which is usually more useful.

The recently (for use by widgets) introduced `IPython.utils.signatures` module handles this all properly too. But that code isn't used in the `oinspect` module which is used to implement the `?` and `??` magics.

There seems to be a lot of other dead and/or dying code in the `oinspect` module, but for starters this patch at least produces more helpful call signature documentation for functions that have been decorated with `functools.wraps`.

This came up originally in the context of astropy/astropy#2849