mailr16573 - /branches/uf_redesign/user_functions/data.py


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

Header


Content

Posted by edward on May 31, 2012 - 18:19:
Author: bugman
Date: Thu May 31 18:19:32 2012
New Revision: 16573

URL: http://svn.gna.org/viewcvs/relax?rev=16573&view=rev
Log:
The Uf_info.uf_loop() method can now restrict the looping over a given user 
function class.


Modified:
    branches/uf_redesign/user_functions/data.py

Modified: branches/uf_redesign/user_functions/data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/data.py?rev=16573&r1=16572&r2=16573&view=diff
==============================================================================
--- branches/uf_redesign/user_functions/data.py (original)
+++ branches/uf_redesign/user_functions/data.py Thu May 31 18:19:32 2012
@@ -152,15 +152,21 @@
         return self._uf[name]
 
 
-    def uf_loop(self):
+    def uf_loop(self, uf_class=None):
         """Iterator method for looping over the user functions.
 
-        @return:    The user function name and data container.
-        @rtype:     tuple of str and Uf_container instance
+        @keyword uf_class:  If given, restrict the iterator to a user 
function class.
+        @type uf_class:     str or None
+        @return:            The user function name and data container.
+        @rtype:             tuple of str and Uf_container instance
         """
 
         # Loop over the user functions.
         for i in range(len(self._uf_names)):
+            # Restriction.
+            if uf_class and not search("^%s\." % uf_class, 
self._uf_names[i]):
+                continue
+
             yield self._uf_names[i], self._uf[self._uf_names[i]]
 
 




Related Messages


Powered by MHonArc, Updated Fri Jun 01 00:00:02 2012