mailr16414 - in /branches/uf_redesign/prompt: help.py uf_objects.py


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

Header


Content

Posted by edward on May 23, 2012 - 15:36:
Author: bugman
Date: Wed May 23 15:36:58 2012
New Revision: 16414

URL: http://svn.gna.org/viewcvs/relax?rev=16414&view=rev
Log:
The user function docstrings are now created when the help system is invoked.

This prevents all user function docstrings from being built at the start, or 
any time the
interpreter class is instantiated.  Instead the docstrings are created on 
demand.  Therefore for
most relax usage, the docstrings for most user functions will be rarely built.

This decreases start times of ~6 seconds down to ~0.06 seconds!


Modified:
    branches/uf_redesign/prompt/help.py
    branches/uf_redesign/prompt/uf_objects.py

Modified: branches/uf_redesign/prompt/help.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/help.py?rev=16414&r1=16413&r2=16414&view=diff
==============================================================================
--- branches/uf_redesign/prompt/help.py (original)
+++ branches/uf_redesign/prompt/help.py Wed May 23 15:36:58 2012
@@ -73,9 +73,16 @@
             print((self.text))
             return
 
+        # Alias the object.
+        obj = args[0]
+
+        # Automatically create the user function docstring help text, 
storing it so it only needs to be built once.
+        if not hasattr(obj, '__relax_help__') and hasattr(obj, '_build_doc'):
+            obj.__relax_help__ = obj._build_doc()
+
         # The relax help system.
-        if hasattr(args[0], '__relax_help__'):
-            pydoc.pager(args[0].__relax_help__)
+        if hasattr(obj, '__relax_help__'):
+            pydoc.pager(obj.__relax_help__)
             return
 
         # Default to the normal Python help system.

Modified: branches/uf_redesign/prompt/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/uf_objects.py?rev=16414&r1=16413&r2=16414&view=diff
==============================================================================
--- branches/uf_redesign/prompt/uf_objects.py (original)
+++ branches/uf_redesign/prompt/uf_objects.py Wed May 23 15:36:58 2012
@@ -214,9 +214,6 @@
         for i in range(self._karg_num):
             self._karg_names.append(self._kargs[i]['name'])
 
-        # Build the user function documentation.
-        self.__relax_help__ = self._build_doc()
-
 
     def __repr__(self):
         """Replacement function for displaying an instance of this user 
function class."""




Related Messages


Powered by MHonArc, Updated Wed May 23 18:00:03 2012