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

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Dec 15 00:23:49 EST 2008


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

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

Modified: trunk/scipy/ndimage/doccer.py
===================================================================
--- trunk/scipy/ndimage/doccer.py	2008-12-15 04:45:00 UTC (rev 5262)
+++ trunk/scipy/ndimage/doccer.py	2008-12-15 05:23:47 UTC (rev 5263)
@@ -16,14 +16,20 @@
         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
-        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``.  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.
 
     Returns
     -------
     outstring : string
-        string with any formatted strings inserted
+        string with requested ``docdict`` strings inserted
+
+    Examples
+    --------
+    >>> docformat(' Test string with %(value)s', {'value':'inserted value'})
+    ' Test string with inserted value'
     '''
     if not docstring:
         return docstring
@@ -50,7 +56,20 @@
 
 
 def indentcount_lines(lines):
-    ''' Minumum indent for all lines in line list '''
+    ''' Minumum indent for all lines in line list
+
+    >>> lines = [' one', '  two', '   three']
+    >>> indentcount_lines(lines)
+    1
+    >>> lines = []
+    >>> indentcount_lines(lines)
+    0
+    >>> lines = [' one']
+    >>> indentcount_lines(lines)
+    1
+    >>> indentcount_lines(['    '])
+    0
+    '''
     indentno = sys.maxint
     for line in lines:
         stripped = line.lstrip()
@@ -76,6 +95,7 @@
     -------
     decfunc : function
         decorator that applies dictionary to input function docstring
+
     '''
     if unindent_params:
         docdict = unindent_dict(docdict)
@@ -94,7 +114,11 @@
 
 
 def unindent_string(docstring):
-    ''' Set docstring to minimum indent for all lines, including first '''
+    ''' Set docstring to minimum indent for all lines, including first
+
+    >>> unindent_string(' two')
+    'two'
+    '''
     lines = docstring.expandtabs().splitlines()
     icount = indentcount_lines(lines)
     if icount == 0:




More information about the Scipy-svn mailing list