mailr10308 - in /1.3/prompt: base_class.py interpreter.py


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

Header


Content

Posted by edward on January 25, 2010 - 16:08:
Author: bugman
Date: Mon Jan 25 16:08:41 2010
New Revision: 10308

URL: http://svn.gna.org/viewcvs/relax?rev=10308&view=rev
Log:
Modified how the Exec_info data container is handled.

The class was shifted from prompt.interpreter to prompt.base_class.  In 
addition if not container
is passed into the user function classes, then one is created with the intro 
flag set to a default
of True.


Modified:
    1.3/prompt/base_class.py
    1.3/prompt/interpreter.py

Modified: 1.3/prompt/base_class.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/base_class.py?rev=10308&r1=10307&r2=10308&view=diff
==============================================================================
--- 1.3/prompt/base_class.py (original)
+++ 1.3/prompt/base_class.py Mon Jan 25 16:08:41 2010
@@ -30,26 +30,46 @@
 
 
 class Basic_class:
-    def __init__(self, exec_info):
+    def __init__(self, exec_info=None):
         """All non-user function classes.
 
-        @param exec_info:   The execution information container.  This must 
contain at least the exec_info.intro boolean variable.
-        @type exec_info:    class instance
+        @keyword exec_info: The execution information container.  This must 
contain at least the exec_info.intro boolean variable.  If not supplied, an 
instance will be generated.
+        @type exec_info:    None or class instance
         """
 
-        # Store the args.
+        # Generate the execution info container.
+        if exec_info == None:
+            exec_info = Exec_info()
+
+        # Store the execution info container.
         self.exec_info = exec_info
 
 
+
+class Exec_info:
+    """Container for execution information."""
+
+    def __init__(self):
+        """Initialise the data of this container."""
+
+        # The user function intro flag.
+        self.intro = True
+
+
+
 class User_fn_class:
-    def __init__(self, exec_info):
+    def __init__(self, exec_info=None):
         """Initialise the user function class, compiling the help string.
 
-        @param exec_info:   The execution information container.  This must 
contain at least the exec_info.intro boolean variable.
-        @type exec_info:    class instance
+        @keyword exec_info: The execution information container.  This must 
contain at least the exec_info.intro boolean variable.  If not supplied, an 
instance will be generated.
+        @type exec_info:    None or class instance
         """
 
-        # Store the args.
+        # Generate the execution info container.
+        if exec_info == None:
+            exec_info = Exec_info()
+
+        # Store the execution info container.
         self.exec_info = exec_info
 
         # Add the generic help string.

Modified: 1.3/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=10308&r1=10307&r2=10308&view=diff
==============================================================================
--- 1.3/prompt/interpreter.py (original)
+++ 1.3/prompt/interpreter.py Mon Jan 25 16:08:41 2010
@@ -40,8 +40,9 @@
 from relax_errors import AllRelaxErrors, RelaxBinError, RelaxError, 
RelaxNoneError, RelaxStrError
 
 # Auxiliary modules.
+from base_class import Exec_info
+from command import Ls, Lh, Ll, system
 from help import _Helper, _Helper_python
-from command import Ls, Lh, Ll, system
 if dep_check.readline_module:
     from tab_completion import Tab_completion
 
@@ -124,7 +125,7 @@
         sys.ps3 = '\nrelax> '
 
         # Initialise the execution information container (info that can 
change during execution).
-        self.exec_info = _Exec_info
+        self.exec_info = Exec_info
 
         # The function intro flag (store in the execution information 
container).
         self.exec_info.intro = False
@@ -311,10 +312,6 @@
         self.exec_info.intro = orig_intro_state
 
 
-class _Exec_info:
-    """Container for execution information."""
-
-
 class _Exit:
     def __repr__(self):
         """Exit the program."""




Related Messages


Powered by MHonArc, Updated Mon Jan 25 16:40:02 2010