[Scipy-svn] r5264 - trunk/scipy/ndimage

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Dec 15 00:44:38 EST 2008


Author: matthew.brett at gmail.com
Date: 2008-12-14 23:44:37 -0600 (Sun, 14 Dec 2008)
New Revision: 5264

Modified:
   trunk/scipy/ndimage/doccer.py
Log:
More docstrings for doccer, again
;


Modified: trunk/scipy/ndimage/doccer.py
===================================================================
--- trunk/scipy/ndimage/doccer.py	2008-12-15 05:23:47 UTC (rev 5263)
+++ trunk/scipy/ndimage/doccer.py	2008-12-15 05:44:37 UTC (rev 5264)
@@ -16,10 +16,9 @@
         dictionary with keys that match the dict formatting strings
         and values that are docstring fragments to be inserted.  The
         indentation of the inserted docstrings is set to match the
-        minimum indentation of the ``docstring``.  The string values
-        in the docdict are assumed to have no indent in the first
-        line, and only indent relative to the first line for following
-        lines.
+        minimum indentation of the ``docstring`` by adding this
+        indentation to all lines of the inserted string, except the
+        first
 
     Returns
     -------
@@ -30,6 +29,11 @@
     --------
     >>> docformat(' Test string with %(value)s', {'value':'inserted value'})
     ' Test string with inserted value'
+    >>> docstring = 'First line\\n    Second line\\n    %(value)s'
+    >>> inserted_string = "indented\\nstring"
+    >>> docdict = {'value': inserted_string}
+    >>> docformat(docstring, docdict)
+    'First line\\n    Second line\\n    indented\\n    string'
     '''
     if not docstring:
         return docstring
@@ -118,6 +122,8 @@
 
     >>> unindent_string(' two')
     'two'
+    >>> unindent_string('  two\\n   three')
+    'two\\n three'
     '''
     lines = docstring.expandtabs().splitlines()
     icount = indentcount_lines(lines)




More information about the Scipy-svn mailing list