Molecule Database

class MoleculeDatabase[source]

Bases: object

An abstract base class for storing and retrieving molecules.

See also

ConstructedMoleculeDatabase

If you need to store and retrieve ConstructedMolecule instances. You can put ConstructedMolecule instances into a MoleculeDatabase, however, you will only be able to retrieve them as plain Molecule instances.

Examples

Subclass Implementation

The source code of the subclasses, listed in molecule_database, can serve as good examples.

Methods

get(key)

Get the molecule with key from the database.

get_all()

Get all molecules in the database.

put(molecule)

Put molecule into the database.

get(key)[source]

Get the molecule with key from the database.

Parameters

key (object) – The key of a molecule, which is to be returned from the database.

Returns

The molecule held in the database under key.

Return type

Molecule

Raises

KeyError – If key is not found in the database.

get_all()[source]

Get all molecules in the database.

Yields

Molecule – A molecule in the database.

put(molecule)[source]

Put molecule into the database.

Parameters

molecule (Molecule) – The molecule to place into the database.

Returns

None

Return type

NoneType