Skip to content

Commit

Permalink
Fix black and mypy (#52) [bump patch]
Browse files Browse the repository at this point in the history
  • Loading branch information
avaucher authored Jul 16, 2024
1 parent 90a7012 commit 79260a1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions rxnmapper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""rxnmapper initialization."""

__name__ = "rxnmapper"
__version__ = "0.3.0" # managed by bump2version

Expand Down
1 change: 1 addition & 0 deletions rxnmapper/attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
separating on reactants and products, including special tokens and not including special tokens, in the atom
domain / in the token domain, and accounting for adjacent atoms in molecules.
"""

import logging
from typing import List, Optional

Expand Down
1 change: 1 addition & 0 deletions rxnmapper/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core RXN Attention Mapper module."""

from __future__ import absolute_import, division, print_function, unicode_literals

import logging
Expand Down
11 changes: 6 additions & 5 deletions rxnmapper/smiles_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains functions needed to process reaction SMILES and their tokens"""

from __future__ import absolute_import, division, print_function, unicode_literals

import logging
Expand Down Expand Up @@ -72,7 +73,7 @@ def get_atom_types_smiles(smiles: str) -> List[int]:
# If `smiles` is a set of molecules, it may contain a "~".
smiles_mol = smiles_to_mol(smiles.replace("~", "."), sanitize=False)

atom_types = [atom.GetAtomicNum() for atom in smiles_mol.GetAtoms()]
atom_types = [atom.GetAtomicNum() for atom in smiles_mol.GetAtoms()] # type: ignore[call-arg]

return atom_types

Expand Down Expand Up @@ -315,7 +316,7 @@ def canonicalize_and_atom_map(smi: str, return_equivalent_atoms=False):
"""
mol = smiles_to_mol(smi, sanitize=False)
for atom in mol.GetAtoms():
for atom in mol.GetAtoms(): # type: ignore[call-arg]
if atom.HasProp("molAtomMapNumber"):
atom_map = atom.GetAtomMapNum()
atom.SetProp("atom_map", str(atom_map))
Expand All @@ -329,7 +330,7 @@ def canonicalize_and_atom_map(smi: str, return_equivalent_atoms=False):
]
)

atom_maps_canonical = [mol.GetAtoms()[idx].GetProp("atom_map") for idx in order]
atom_maps_canonical = [mol.GetAtoms()[idx].GetProp("atom_map") for idx in order] # type: ignore[call-arg]

if not return_equivalent_atoms:
return (can_smi, atom_maps_canonical)
Expand Down Expand Up @@ -366,7 +367,7 @@ def generate_atom_mapped_reaction_atoms(
i = -1
atom_mapped_precursors_list = []
for precursor_mol in precursors_mols:
for atom in precursor_mol.GetAtoms():
for atom in precursor_mol.GetAtoms(): # type: ignore[call-arg]
i += 1
if i in product_atom_maps:
# atom maps start at an index of 1
Expand Down Expand Up @@ -394,7 +395,7 @@ def generate_atom_mapped_reaction_atoms(
i = -1
atom_mapped_products_list = []
for products_mol in products_mols:
for atom in products_mol.GetAtoms():
for atom in products_mol.GetAtoms(): # type: ignore[call-arg]
i += 1
atom_map = product_mapping_dict.get(i, i + 1)
atom.SetProp("molAtomMapNumber", str(atom_map))
Expand Down

0 comments on commit 79260a1

Please sign in to comment.