mailr3476 - /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 November 11, 2007 - 12:59:
Author: bugman
Date: Sun Nov 11 12:59:27 2007
New Revision: 3476

URL: http://svn.gna.org/viewcvs/relax?rev=3476&view=rev
Log:
Added a docstring and comments to the selection class method __contains__().


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=3476&r1=3475&r2=3476&view=diff
==============================================================================
--- 1.3/generic_fns/selection.py (original)
+++ 1.3/generic_fns/selection.py Sun Nov 11 12:59:27 2007
@@ -103,26 +103,44 @@
 
 
     def __contains__(self, obj):
+        """Replacement function for determining if an object matches the 
selection.
+
+        @param obj:     The data object.
+        @type obj:      MoleculeContainer, ResidueContainer, or 
SpinContainer object.
+        @return:        The answer of whether the object matches the 
selection.
+        @rtype:         Boolean
+        """
+
+        # The selection object is a union.
         if self._union:
             return (obj in self._union[0]) or (obj in self._union[1])
+
+        # The selection object is an intersection.
         elif self._intersect:
             return (obj in self._intersect[0]) and (obj in 
self._intersect[1])
+
+        # The object is a molecule.
         elif isinstance(obj, MoleculeContainer):
             if not self.molecules:
                 return True
             elif obj.name in self.molecules:
                 return True
+
+        # The object is a residue.
         elif isinstance(obj, ResidueContainer):
             if not self.residues:
                 return True
             elif obj.name in 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 obj.name in self.spins or obj.num in self.spins:
                 return True
 
+        # No match.
         return False
 
 




Related Messages


Powered by MHonArc, Updated Sun Nov 11 13:20:12 2007