From 04689accd072bc47aadecbd4db52af075477ff3b Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 4 Jan 2009 20:43:15 +0100 Subject: [PATCH] Small API change. --- sphinx/ext/autodoc.py | 8 ++++---- tests/test_autodoc.py | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 60ebd5b5e..35d96bda9 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -212,8 +212,9 @@ class RstGenerator(object): docstrings.append(initdocstring) # the default is only the class docstring - # make sure we get Unicode docstrings - return [force_decode(docstring, encoding) for docstring in docstrings] + # make sure we have Unicode docstrings, then sanitize and split into lines + return [prepare_docstring(force_decode(docstring, encoding)) + for docstring in docstrings] def process_doc(self, docstrings, what, name, obj): """Let the user process the docstrings.""" @@ -462,8 +463,7 @@ class RstGenerator(object): # add content from docstrings if not no_docstring: encoding = analyzer and analyzer.encoding - docstrings = map(prepare_docstring, - self.get_doc(what, todoc, encoding)) + docstrings = self.get_doc(what, todoc, encoding) for i, line in enumerate(self.process_doc(docstrings, what, fullname, todoc)): self.result.append(indent + line, sourcename, i) diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index dd9934f59..67220180a 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -15,7 +15,6 @@ from util import * from docutils.statemachine import ViewList from sphinx.ext.autodoc import RstGenerator, cut_lines, between -from sphinx.util.docstrings import prepare_docstring def setup_module(): @@ -174,7 +173,7 @@ def test_format_signature(): def test_get_doc(): def getdocl(*args): - ds = map(prepare_docstring, gen.get_doc(*args)) + ds = gen.get_doc(*args) # for testing purposes, concat them and strip the empty line at the end return sum(ds, [])[:-1] @@ -240,8 +239,7 @@ def test_get_doc(): def test_docstring_processing(): def process(what, name, obj): - return list(gen.process_doc(map(prepare_docstring, gen.get_doc(what, obj)), - what, name, obj)) + return list(gen.process_doc(gen.get_doc(what, obj), what, name, obj)) class E: def __init__(self):