mailr13366 - /branches/gui_testing/prompt/base_class.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 01, 2011 - 15:54:
Author: bugman
Date: Fri Jul  1 15:54:31 2011
New Revision: 13366

URL: http://svn.gna.org/viewcvs/relax?rev=13366&view=rev
Log:
_build_doc() and _build_subtitle() are now module functions.


Modified:
    branches/gui_testing/prompt/base_class.py

Modified: branches/gui_testing/prompt/base_class.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/prompt/base_class.py?rev=13366&r1=13365&r2=13366&view=diff
==============================================================================
--- branches/gui_testing/prompt/base_class.py (original)
+++ branches/gui_testing/prompt/base_class.py Fri Jul  1 15:54:31 2011
@@ -30,6 +30,57 @@
 # relax module imports.
 import help
 from string import split, strip
+
+
+def _build_doc(fn):
+    """Build the fn.__doc__ docstring.
+
+    @param fn:  The user function to build the docstring for.
+    @type fn:   method
+    """
+
+    # Initialise.
+    doc = ""
+
+    # Add the title.
+    doc = "%s%s\n\n" % (doc, fn._doc_title)
+
+    # Add the keyword args.
+    doc = doc + _build_subtitle("Keyword Arguments")
+    for arg, desc in fn._doc_args:
+        doc = "%s%s:  %s\n\n" % (doc, arg, desc)
+
+    # Add the description.
+    doc = doc + _build_subtitle("Description")
+    doc = doc + fn._doc_desc
+
+    # Add the examples.
+    doc = doc + _build_subtitle("Examples")
+    doc = doc + fn._doc_examples
+
+    # The width of the document text.
+    if platform.uname()[0] in ['Windows', 'Microsoft']:
+        width = 80
+    else:
+        width = 100
+
+    # Create and wrap the docstring.
+    fn.__doc__ = ""
+    for line in wrap(doc, width):
+        fn.__doc__ = fn.__doc__ + line + "\n"
+
+
+def _build_subtitle(text):
+    """Create the formatted subtitle string.
+    @param text:    The name of the subtitle.
+    @type text:     str
+    @return:        The formatted subtitle.
+    @rtype:         str
+    """
+
+    # Format and return.
+    return "%s\n%s\n\n" % (text, "~"*len(text))
+
 
 
 class Basic_class:
@@ -127,53 +178,3 @@
 
         # Return the new text.
         return new_text
-
-
-    def _build_doc(self, fn):
-        """Build the fn.__doc__ docstring.
-
-        @param fn:  The user function to build the docstring for.
-        @type fn:   method
-        """
-
-        # Initialise.
-        doc = ""
-
-        # Add the title.
-        doc = "%s%s\n\n" % (doc, fn._doc_title)
-
-        # Add the keyword args.
-        doc = doc + self._build_subtitle("Keyword Arguments")
-        for arg, desc in fn._doc_args:
-            doc = "%s%s:  %s\n\n" % (doc, arg, desc)
-
-        # Add the description.
-        doc = doc + self._build_subtitle("Description")
-        doc = doc + fn._doc_desc
-
-        # Add the examples.
-        doc = doc + self._build_subtitle("Examples")
-        doc = doc + fn._doc_examples
-
-        # The width of the document text.
-        if platform.uname()[0] in ['Windows', 'Microsoft']:
-            width = 80
-        else:
-            width = 100
-
-        # Create and wrap the docstring.
-        fn.__doc__ = ""
-        for line in wrap(doc, width):
-            fn.__doc__ = fn.__doc__ + line + "\n"
-
-
-    def _build_subtitle(self, text):
-        """Create the formatted subtitle string.
-        @param text:    The name of the subtitle.
-        @type text:     str
-        @return:        The formatted subtitle.
-        @rtype:         str
-        """
-
-        # Format and return.
-        return "%s\n%s\n\n" % (text, "~"*len(text))




Related Messages


Powered by MHonArc, Updated Fri Jul 01 16:00:01 2011