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

Source Code for Module Chem.Suppliers.MolSupplier

 1  # $Id: MolSupplier.py 2 2006-05-06 22:54:39Z glandrum $ 
 2  # 
 3  # Copyright (C) 2003-2006 greg Landrum and Rational Discovery LLC 
 4  # 
 5  #   @@ All Rights Reserved  @@ 
 6  # 
 7  """ Supplies an abstract class for working with sequences of molecules 
 8   
 9  """ 
10   
11 -class MolSupplier(object):
12 """ we must, at minimum, support forward iteration 13 14 """
15 - def __init__(self):
16 raise ValueError,'cannot instantiate MolSuppliers'
17 - def Reset(self):
18 pass
19 - def __iter__(self):
20 self.Reset() 21 return self
22
23 - def next(self):
24 res = self.NextMol() 25 if res is not None: 26 return res 27 else: 28 raise StopIteration
29
30 - def NextMol(self):
31 """ Must be implemented in child class 32 33 """ 34 pass
35