From e78a80743cec7b650d76dc5d98b6a37b8f743822 2011-06-21 10:21:17 From: Thomas Kluyver Date: 2011-06-21 10:21:17 Subject: [PATCH] Simplify code in core/oinspect.py --- diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 33d5f6e..2f34490 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -28,7 +28,6 @@ from itertools import izip_longest # 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 @@ class Inspector: -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: