Commit dce38628 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Fixing mypy

parent 84f9046e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2,8 +2,10 @@ PPB.csv
SAMPL.csv
bace.csv
bace_c-featurized/
chembl-featurized/
clintox-featurized/
clintox.csv.gz
core_grid.json
ppb-featurized/
sampl-featurized/
atom_init.json
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ from deepchem.utils.rdkit_utils import MoleculeLoadException
from deepchem.utils.geometry_utils import compute_pairwise_distances
from deepchem.utils.geometry_utils import subtract_centroid

from typing import Tuple, Dict
from typing import Tuple, Dict, List

logger = logging.getLogger(__name__)

@@ -201,7 +201,7 @@ class ContactCircularVoxelizer(ComplexFeaturizer):
    except MoleculeLoadException:
      logger.warning("This molecule cannot be loaded by Rdkit. Returning None")
      return None
    pairwise_features = []
    pairwise_features: List[np.ndarray] = []
    # We compute pairwise contact fingerprints
    centroid = compute_contact_centroid(fragments, cutoff=self.cutoff)
    for (frag1, frag2) in itertools.combinations(fragments, 2):
+2 −2
Original line number Diff line number Diff line
"""
Various utilities around hash functions.
"""
from typing import Callable, Dict, Optional, Tuple
from typing import Callable, Dict, Optional, Tuple, Any
import numpy as np
import hashlib

@@ -63,7 +63,7 @@ def hash_ecfp_pair(ecfp_pair: Tuple[str, str], size: int = 1024) -> int:
  return ecfp_hash


def vectorize(hash_function: Callable[[str, int], int],
def vectorize(hash_function: Callable[[Any, int], int],
              feature_dict: Optional[Dict[int, str]] = None,
              size: int = 1024) -> np.ndarray:
  """Helper function to vectorize a spatial description from a hash.
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ def voxelize(get_voxels: Callable[..., Any],
             coordinates: np.ndarray,
             box_width: float = 16.0,
             voxel_width: float = 1.0,
             feature_dict: Optional[Dict[Union[int, Tuple[int]], Any]] = None,
             feature_dict: Optional[Dict[Any, Any]] = None,
             feature_list: Optional[List[Union[int, Tuple[int]]]] = None,
             nb_channel: int = 16,
             dtype: str = 'int') -> np.ndarray: