def enumerate(self, mol):
smiles = Chem.MolToSmiles(mol, isomericSmiles=True)<EOL>tautomers = {smiles: copy.deepcopy(mol)}<EOL>kekulized = copy.deepcopy(mol)<EOL>Chem.Kekulize(kekulized)<EOL>kekulized = {smiles: kekulized}<EOL>done = set()<EOL>while len(tautomers) < self.max_tautomers:<EOL><INDENT>for tsmiles in sorted(tautomers):<EOL><INDENT>if tsmiles in done:<EOL><INDENT>continue<EOL><DEDENT>for transform in self.transforms:<EOL><INDENT>for match in kekulized[tsmiles].GetSubstructMatches(transform.tautomer):<EOL><INDENT>product = copy.deepcopy(kekulized[tsmiles])<EOL>first = product.GetAtomWithIdx(match[<NUM_LIT:0>])<EOL>last = product.GetAtomWithIdx(match[-<NUM_LIT:1>])<EOL>first.SetNumExplicitHs(max(<NUM_LIT:0>, first.GetTotalNumHs() - <NUM_LIT:1>))<EOL>last.SetNumExplicitHs(last.GetTotalNumHs() + <NUM_LIT:1>)<EOL>first.SetNoImplicit(True)<EOL>last.SetNoImplicit(True)<EOL>for bi, pair in enumerate(pairwise(match)):<EOL><INDENT>if transform.bonds:<EOL><INDENT>product.GetBondBetweenAtoms(*pair).SetBondType(transform.bonds[bi])<EOL><DEDENT>else:<EOL><INDENT>current_bond_type = product.GetBondBetweenAtoms(*pair).GetBondType()<EOL>product.GetBondBetweenAtoms(*pair).SetBondType(BondType.DOUBLE if current_bond_type == BondType.SINGLE else BondType.SINGLE)<EOL><DEDENT><DEDENT>if transform.charges:<EOL><INDENT>for ci, idx in enumerate(match):<EOL><INDENT>atom = product.GetAtomWithIdx(idx)<EOL>atom.SetFormalCharge(atom.GetFormalCharge() + transform.charges[ci])<EOL><DEDENT><DEDENT>try:<EOL><INDENT>Chem.SanitizeMol(product)<EOL>smiles = Chem.MolToSmiles(product, isomericSmiles=True)<EOL>log.debug('<STR_LIT>', transform.name, tsmiles)<EOL>if smiles not in tautomers:<EOL><INDENT>log.debug('<STR_LIT>' % smiles)<EOL>kekulized_product = copy.deepcopy(product)<EOL>Chem.Kekulize(kekulized_product)<EOL>tautomers[smiles] = product<EOL>kekulized[smiles] = kekulized_product<EOL><DEDENT>else:<EOL><INDENT>log.debug('<STR_LIT>' % smiles)<EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>log.debug('<STR_LIT>', transform.name)<EOL><DEDENT><DEDENT><DEDENT>done.add(tsmiles)<EOL><DEDENT>if len(tautomers) == len(done):<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>log.warning('<STR_LIT>', self.max_tautomers)<EOL><DEDENT>for tautomer in tautomers.values():<EOL><INDENT>Chem.AssignStereochemistry(tautomer, force=True, cleanIt=True)<EOL>for bond in tautomer.GetBonds():<EOL><INDENT>if bond.GetBondType() == BondType.DOUBLE and bond.GetStereo() > BondStereo.STEREOANY:<EOL><INDENT>begin = bond.GetBeginAtomIdx()<EOL>end = bond.GetEndAtomIdx()<EOL>for othertautomer in tautomers.values():<EOL><INDENT>if not othertautomer.GetBondBetweenAtoms(begin, end).GetBondType() == BondType.DOUBLE:<EOL><INDENT>neighbours = tautomer.GetAtomWithIdx(begin).GetBonds() + tautomer.GetAtomWithIdx(end).GetBonds()<EOL>for otherbond in neighbours:<EOL><INDENT>if otherbond.GetBondDir() in {BondDir.ENDUPRIGHT, BondDir.ENDDOWNRIGHT}:<EOL><INDENT>otherbond.SetBondDir(BondDir.NONE)<EOL><DEDENT><DEDENT>Chem.AssignStereochemistry(tautomer, force=True, cleanIt=True)<EOL>log.debug('<STR_LIT>')<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return list(tautomers.values())<EOL>
Enumerate all possible tautomers and return them as a list.

        :param mol: The input molecule.
        :type mol: rdkit.Chem.rdchem.Mol
        :return: A list of all possible tautomers of the molecule.
        :rtype: list of rdkit.Chem.rdchem.Mol