rdkit.VLib.Output module

class rdkit.VLib.Output.OutputNode(dest=None, strFunc=None, **kwargs)

Bases: rdkit.VLib.Node.VLibNode

base class for nodes which dump output

Assumptions:

  • destination supports a write() method
  • strFunc, if provided, returns a string representation of the input
  • inputs (parents) can be stepped through in lockstep
Usage Example:
>>> from rdkit.VLib.Supply import SupplyNode
>>> supplier = SupplyNode(contents=[1,2,3])
>>> from rdkit.six import StringIO
>>> sio = StringIO()
>>> node = OutputNode(dest=sio,strFunc=lambda x:'%s '%(str(x)))
>>> node.AddParent(supplier)
>>> node.next()
1
>>> sio.getvalue()
'1 '
>>> node.next()
2
>>> sio.getvalue()
'1 2 '
next()