1
1
"""Contains functions needed to process reaction SMILES and their tokens"""
2
+
2
3
from __future__ import absolute_import , division , print_function , unicode_literals
3
4
4
5
import logging
@@ -72,7 +73,7 @@ def get_atom_types_smiles(smiles: str) -> List[int]:
72
73
# If `smiles` is a set of molecules, it may contain a "~".
73
74
smiles_mol = smiles_to_mol (smiles .replace ("~" , "." ), sanitize = False )
74
75
75
- atom_types = [atom .GetAtomicNum () for atom in smiles_mol .GetAtoms ()]
76
+ atom_types = [atom .GetAtomicNum () for atom in smiles_mol .GetAtoms ()] # type: ignore[call-arg]
76
77
77
78
return atom_types
78
79
@@ -315,7 +316,7 @@ def canonicalize_and_atom_map(smi: str, return_equivalent_atoms=False):
315
316
316
317
"""
317
318
mol = smiles_to_mol (smi , sanitize = False )
318
- for atom in mol .GetAtoms ():
319
+ for atom in mol .GetAtoms (): # type: ignore[call-arg]
319
320
if atom .HasProp ("molAtomMapNumber" ):
320
321
atom_map = atom .GetAtomMapNum ()
321
322
atom .SetProp ("atom_map" , str (atom_map ))
@@ -329,7 +330,7 @@ def canonicalize_and_atom_map(smi: str, return_equivalent_atoms=False):
329
330
]
330
331
)
331
332
332
- atom_maps_canonical = [mol .GetAtoms ()[idx ].GetProp ("atom_map" ) for idx in order ]
333
+ atom_maps_canonical = [mol .GetAtoms ()[idx ].GetProp ("atom_map" ) for idx in order ] # type: ignore[call-arg]
333
334
334
335
if not return_equivalent_atoms :
335
336
return (can_smi , atom_maps_canonical )
@@ -366,7 +367,7 @@ def generate_atom_mapped_reaction_atoms(
366
367
i = - 1
367
368
atom_mapped_precursors_list = []
368
369
for precursor_mol in precursors_mols :
369
- for atom in precursor_mol .GetAtoms ():
370
+ for atom in precursor_mol .GetAtoms (): # type: ignore[call-arg]
370
371
i += 1
371
372
if i in product_atom_maps :
372
373
# atom maps start at an index of 1
@@ -394,7 +395,7 @@ def generate_atom_mapped_reaction_atoms(
394
395
i = - 1
395
396
atom_mapped_products_list = []
396
397
for products_mol in products_mols :
397
- for atom in products_mol .GetAtoms ():
398
+ for atom in products_mol .GetAtoms (): # type: ignore[call-arg]
398
399
i += 1
399
400
atom_map = product_mapping_dict .get (i , i + 1 )
400
401
atom .SetProp ("molAtomMapNumber" , str (atom_map ))
0 commit comments