Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify code in core/oinspect.py

  • Loading branch information...
commit e78a80743cec7b650d76dc5d98b6a37b8f743822 1 parent f8e5b4a
@takluyver authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 IPython/core/oinspect.py
View
17 IPython/core/oinspect.py
@@ -28,7 +28,6 @@
# IPython's own
from IPython.core import page
-from IPython.external.Itpl import itpl
from IPython.utils import PyColorize
from IPython.utils import io
from IPython.utils.text import indent
@@ -298,22 +297,24 @@ def pdoc(self,obj,oname='',formatter = None):
-formatter: a function to run the docstring through for specially
formatted docstrings."""
- head = self.__head # so that itpl can find it even if private
+ head = self.__head # For convenience
ds = getdoc(obj)
if formatter:
ds = formatter(ds)
if inspect.isclass(obj):
init_ds = getdoc(obj.__init__)
- output = itpl('$head("Class Docstring:")\n'
- '$indent(ds)\n'
- '$head("Constructor Docstring"):\n'
- '$indent(init_ds)')
+ output = "\n".join([head("Class Docstring:"),
+ indent(ds),
+ head("Constructor Docstring:"),
+ indent(init_ds)])
elif (type(obj) is types.InstanceType or isinstance(obj,object)) \
and hasattr(obj,'__call__'):
call_ds = getdoc(obj.__call__)
if call_ds:
- output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
- '$head("Calling Docstring:")\n$indent(call_ds)')
+ output = "\n".join([head("Class Docstring:"),
+ indent(ds),
+ head("Calling Docstring:"),
+ indent(call_ds)])
else:
output = ds
else:
Please sign in to comment.
Something went wrong with that request. Please try again.