Package rdkit :: Package Chem :: Package Suppliers :: Module MolSupplier
[hide private]
[frames] | no frames]

Source Code for Module rdkit.Chem.Suppliers.MolSupplier

 1  # 
 2  # Copyright (C) 2003-2006 greg Landrum and Rational Discovery LLC 
 3  # 
 4  #   @@ All Rights Reserved @@ 
 5  #  This file is part of the RDKit. 
 6  #  The contents are covered by the terms of the BSD license 
 7  #  which is included in the file license.txt, found at the root 
 8  #  of the RDKit source tree. 
 9  # 
10  """ Supplies an abstract class for working with sequences of molecules 
11   
12  """ 
13   
14   
15 -class MolSupplier(object):
16 """ we must, at minimum, support forward iteration 17 18 """ 19
20 - def __init__(self):
21 raise ValueError('cannot instantiate MolSuppliers')
22
23 - def Reset(self):
24 pass
25
26 - def __iter__(self):
27 self.Reset() 28 return self
29
30 - def next(self):
31 res = self.NextMol() 32 if res is not None: 33 return res 34 else: 35 raise StopIteration
36
37 - def NextMol(self):
38 """ Must be implemented in child class 39 40 """ 41 pass
42 43 __next__ = next # PY3
44