mailr5691 - /1.3/generic_fns/selection.py


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

Header


Content

Posted by edward on April 14, 2008 - 16:37:
Author: bugman
Date: Mon Apr 14 16:33:38 2008
New Revision: 5691

URL: http://svn.gna.org/viewcvs/relax?rev=5691&view=rev
Log:
Bug fix:  None, str, or number is now accepted in Selection.wildcard_match().


Modified:
    1.3/generic_fns/selection.py

Modified: 1.3/generic_fns/selection.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/selection.py?rev=5691&r1=5690&r2=5691&view=diff
==============================================================================
--- 1.3/generic_fns/selection.py (original)
+++ 1.3/generic_fns/selection.py Mon Apr 14 16:33:38 2008
@@ -124,21 +124,21 @@
         elif isinstance(obj, MoleculeContainer):
             if not self.molecules:
                 return True
-            elif self.wildcard_match(str(obj.name), self.molecules):
+            elif self.wildcard_match(obj.name, self.molecules):
                 return True
 
         # The object is a residue.
         elif isinstance(obj, ResidueContainer):
             if not self.residues:
                 return True
-            elif self.wildcard_match(str(obj.name), self.residues) or 
obj.num in self.residues:
+            elif self.wildcard_match(obj.name, self.residues) or obj.num in 
self.residues:
                 return True
 
         # The object is a spin.
         elif isinstance(obj, SpinContainer):
             if not self.spins:
                 return True
-            elif self.wildcard_match(str(obj.name), self.spins) or obj.num 
in self.spins:
+            elif self.wildcard_match(obj.name, self.spins) or obj.num in 
self.spins:
                 return True
 
         # No match.
@@ -177,16 +177,20 @@
         This method converts from relax's RE syntax to that of the re python 
module.
 
         @param string:      The molecule/res/spin name or number.
-        @type string:       str
+        @type string:       None, str, or number
         @param patterns:    A list of patterns to match.  This should be the 
output of
                             parse_token().
         @return:            True if there is a match, False otherwise.
         @rtype:             bool
         """
 
-        # Catch the None string.
+        # Catch None.
         if string == None:
             return False
+
+        # If a number, convert to a string.
+        if type(string) == int or type(string) == float:
+            string = str(string)
 
         # Loop over the patterns.
         for pattern in patterns:




Related Messages


Powered by MHonArc, Updated Mon Apr 14 16:40:15 2008