def with_patch_inspect(f):
 def wrapped(*args, **kwargs):
  save_findsource = inspect.findsource
  save_getargs = inspect.getargs
  inspect.findsource = findsource
  inspect.getargs = getargs
  try:
   return f(*args, **kwargs)
  finally:
   inspect.findsource = save_findsource
   inspect.getargs = save_getargs
 return wrapped

def with_patch_inspect ( f ) : def wrapped ( * args , ** kwargs ) : save_findsource = inspect . findsource save_getargs = inspect . getargs inspect . findsource = findsource inspect . getargs = getargs try : return f ( * args , ** kwargs ) finally : inspect . findsource = save_findsource inspect . getargs = save_getargs return wrapped
deprecated since ipython 6 .