MCPcopy Create free account
hub / github.com/ipython/ipython / decorate_fn_with_doc

Function decorate_fn_with_doc

IPython/core/debugger.py:183–192  ·  view source on GitHub ↗

Make new_fn have old_fn's doc string. This is particularly useful for the ``do_...`` commands that hook into the help system. Adapted from from a comp.lang.python posting by Duncan Booth.

(new_fn, old_fn, additional_text="")

Source from the content-addressed store, hash-verified

181
182
183def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):
184 """Make new_fn have old_fn's doc string. This is particularly useful
185 for the ``do_...`` commands that hook into the help system.
186 Adapted from from a comp.lang.python posting
187 by Duncan Booth."""
188 def wrapper(*args, **kw):
189 return new_fn(*args, **kw)
190 if old_fn.__doc__:
191 wrapper.__doc__ = strip_indentation(old_fn.__doc__) + additional_text
192 return wrapper
193
194
195class Pdb(OldPdb):

Callers 1

PdbClass · 0.85

Calls 1

strip_indentationFunction · 0.85

Tested by

no test coverage detected