Skip to content

Commit cbf715e

Browse files
author
y-p
committed
DOC/BLD: ipython_directive cleanups
1 parent 95c7af9 commit cbf715e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

doc/sphinxext/ipython_directive.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,24 +452,25 @@ def process_input(self, data, input_prompt, lineno):
452452
# unless :okexcept: has been specified.
453453
if not is_okexcept and "Traceback" in output:
454454
s = "\nException in %s at block ending on line %s\n" % (filename, lineno)
455-
sys.stdout.write('\n\n>>>'+'-'*73)
455+
s += "Specify :okexcept: as an option in the ipython:: block to suppress this message\n"
456+
sys.stdout.write('\n\n>>>' + ('-' * 73))
456457
sys.stdout.write(s)
457458
sys.stdout.write(output)
458-
sys.stdout.write('<<<' + '-'*73+'\n\n')
459+
sys.stdout.write('<<<' + ('-' * 73) + '\n\n')
459460

460461
# output any warning raised during execution to stdout
461462
# unless :okwarning: has been specified.
462463
if not is_okwarning:
463-
import textwrap
464464
for w in ws:
465465
s = "\nWarning in %s at block ending on line %s\n" % (filename, lineno)
466-
sys.stdout.write('\n\n>>>'+'-'*73)
466+
s += "Specify :okwarning: as an option in the ipython:: block to suppress this message\n"
467+
sys.stdout.write('\n\n>>>' + ('-' * 73))
467468
sys.stdout.write(s)
468-
sys.stdout.write('-'*76+'\n')
469+
sys.stdout.write('-' * 76 + '\n')
469470
s=warnings.formatwarning(w.message, w.category,
470471
w.filename, w.lineno, w.line)
471-
sys.stdout.write('\n'.join(textwrap.wrap(s,80)))
472-
sys.stdout.write('\n<<<' + '-'*73+'\n')
472+
sys.stdout.write(s)
473+
sys.stdout.write('<<<' + ('-' * 73) + '\n')
473474

474475
self.cout.truncate(0)
475476
return (ret, input_lines, output, is_doctest, decorator, image_file,

0 commit comments

Comments
 (0)