Show More
@@ -32,6 +32,7 b' import inspect' | |||
|
32 | 32 | import linecache |
|
33 | 33 | import sys |
|
34 | 34 | import warnings |
|
35 | import re | |
|
35 | 36 | |
|
36 | 37 | from IPython import get_ipython |
|
37 | 38 | from IPython.utils import PyColorize |
@@ -40,6 +41,9 b' from IPython.core.excolors import exception_colors' | |||
|
40 | 41 | from IPython.testing.skipdoctest import skip_doctest |
|
41 | 42 | |
|
42 | 43 | |
|
44 | RGX_EXTRA_INDENT = re.compile('(?<=\n)\s+') | |
|
45 | ||
|
46 | ||
|
43 | 47 | prompt = 'ipdb> ' |
|
44 | 48 | |
|
45 | 49 | #We have to check this directly from sys.argv, config struct not yet available |
@@ -175,6 +179,10 b' class Tracer(object):' | |||
|
175 | 179 | self.debugger.set_trace(sys._getframe().f_back) |
|
176 | 180 | |
|
177 | 181 | |
|
182 | def strip_indentation(multiline_string): | |
|
183 | return RGX_EXTRA_INDENT.sub('', multiline_string) | |
|
184 | ||
|
185 | ||
|
178 | 186 | def decorate_fn_with_doc(new_fn, old_fn, additional_text=""): |
|
179 | 187 | """Make new_fn have old_fn's doc string. This is particularly useful |
|
180 | 188 | for the ``do_...`` commands that hook into the help system. |
@@ -183,7 +191,7 b' def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):' | |||
|
183 | 191 | def wrapper(*args, **kw): |
|
184 | 192 | return new_fn(*args, **kw) |
|
185 | 193 | if old_fn.__doc__: |
|
186 | wrapper.__doc__ = old_fn.__doc__ + additional_text | |
|
194 | wrapper.__doc__ = strip_indentation(old_fn.__doc__) + additional_text | |
|
187 | 195 | return wrapper |
|
188 | 196 | |
|
189 | 197 |
General Comments 0
You need to be logged in to leave comments.
Login now