Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplify code in core/oinspect.py

  • Loading branch information...
commit e78a80743cec7b650d76dc5d98b6a37b8f743822 1 parent f8e5b4a
Thomas Kluyver authored

Showing 1 changed file with 9 additions and 8 deletions. Show diff stats Hide diff stats

  1. +9 8 IPython/core/oinspect.py
17 IPython/core/oinspect.py
@@ -28,7 +28,6 @@
28 28
29 29 # IPython's own
30 30 from IPython.core import page
31   -from IPython.external.Itpl import itpl
32 31 from IPython.utils import PyColorize
33 32 from IPython.utils import io
34 33 from IPython.utils.text import indent
@@ -298,22 +297,24 @@ def pdoc(self,obj,oname='',formatter = None):
298 297 -formatter: a function to run the docstring through for specially
299 298 formatted docstrings."""
300 299
301   - head = self.__head # so that itpl can find it even if private
  300 + head = self.__head # For convenience
302 301 ds = getdoc(obj)
303 302 if formatter:
304 303 ds = formatter(ds)
305 304 if inspect.isclass(obj):
306 305 init_ds = getdoc(obj.__init__)
307   - output = itpl('$head("Class Docstring:")\n'
308   - '$indent(ds)\n'
309   - '$head("Constructor Docstring"):\n'
310   - '$indent(init_ds)')
  306 + output = "\n".join([head("Class Docstring:"),
  307 + indent(ds),
  308 + head("Constructor Docstring:"),
  309 + indent(init_ds)])
311 310 elif (type(obj) is types.InstanceType or isinstance(obj,object)) \
312 311 and hasattr(obj,'__call__'):
313 312 call_ds = getdoc(obj.__call__)
314 313 if call_ds:
315   - output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
316   - '$head("Calling Docstring:")\n$indent(call_ds)')
  314 + output = "\n".join([head("Class Docstring:"),
  315 + indent(ds),
  316 + head("Calling Docstring:"),
  317 + indent(call_ds)])
317 318 else:
318 319 output = ds
319 320 else:

0 comments on commit e78a807

Please sign in to comment.
Something went wrong with that request. Please try again.