rdkit.Chem.Suppliers.MolSupplier

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

# Source Code for Module rdkit.Chem.Suppliers.MolSupplier

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