From ce56294a1ae581a7e451f59e8560b9a208ab13ff Mon Sep 17 00:00:00 2001 From: David Dotson Date: Fri, 8 Apr 2022 09:54:25 -0700 Subject: [PATCH] More renames --- openff/qcsubmit/results/caching.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/openff/qcsubmit/results/caching.py b/openff/qcsubmit/results/caching.py index 0a3159dc..8325f4ea 100644 --- a/openff/qcsubmit/results/caching.py +++ b/openff/qcsubmit/results/caching.py @@ -7,10 +7,10 @@ import numpy from cachetools import Cache, LRUCache from openff.toolkit.topology import Molecule -from qcportal import FractalClient +from qcportal import PortalClient from qcportal.molecules import Molecule as QCMolecule from qcportal.records import TorsiondriveRecord -from qcportal.records import OptimizationRecord, RecordBase, ResultRecord +from qcportal.records import OptimizationRecord, BaseRecord, SinglepointRecord try: from openmm import unit @@ -27,10 +27,10 @@ R = TypeVar("R", bound=_BaseResult) -S = TypeVar("S", bound=RecordBase) +S = TypeVar("S", bound=BaseRecord) T = TypeVar("T") -RecordAndMolecule = Tuple[RecordBase, Molecule] +RecordAndMolecule = Tuple[BaseRecord, Molecule] _record_cache = LRUCache(maxsize=20000) @@ -63,18 +63,18 @@ def batched_indices(indices: List[T], batch_size: int) -> List[List[T]]: @lru_cache() -def cached_fractal_client(address: str) -> FractalClient: +def cached_fractal_client(address: str) -> PortalClient: """Returns a cached copy of a fractal client.""" try: - return FractalClient(address) + return PortalClient(address) except ConnectionRefusedError as e: # Try to handle the case when connecting to a local snowflake. try: - return FractalClient(address, verify=False) + return PortalClient(address, verify=False) except ConnectionRefusedError: raise e @@ -86,7 +86,7 @@ def _cached_client_query( query_cache: Cache, cache_predicate: Optional[Callable[[Any], bool]] = None, ) -> List[S]: - """A helper method to cache calls to ``FractalClient.query_XXX`` methods. + """A helper method to cache calls to ``PortalClient.query_XXX`` methods. Args: client_address: The address of the running QCFractal instance to query. @@ -145,7 +145,7 @@ def _cached_client_query( def cached_query_procedures(client_address: str, record_ids: List[str]) -> List[S]: - """A cached version of ``FractalClient.query_procedures``. + """A cached version of ``PortalClient.query_procedures``. Args: client_address: The address of the running QCFractal instance to query. @@ -167,7 +167,7 @@ def cached_query_procedures(client_address: str, record_ids: List[str]) -> List[ def cached_query_molecules( client_address: str, molecule_ids: List[str] ) -> List[QCMolecule]: - """A cached version of ``FractalClient.query_molecules``. + """A cached version of ``PortalClient.query_molecules``. Args: client_address: The address of the running QCFractal instance to query. @@ -249,7 +249,7 @@ def _cached_query_single_structure_results( def cached_query_basic_results( client_address: str, results: List["BasicResult"] -) -> List[Tuple[ResultRecord, Molecule]]: +) -> List[Tuple[SinglepointRecord, Molecule]]: """Returns the QC record and corresponding molecule object associated with each of the specified result entries. @@ -288,7 +288,7 @@ def cached_query_optimization_results( def _cached_torsion_drive_molecule_ids( - client_address: str, qc_records: List[TorsionDriveRecord] + client_address: str, qc_records: List[TorsiondriveRecord] ) -> Dict[Tuple[str, Tuple[int, ...]], str]: client_address = client_address.rstrip("/") @@ -351,7 +351,7 @@ def _cached_torsion_drive_molecule_ids( def cached_query_torsion_drive_results( client_address: str, results: List["TorsionDriveResult"] -) -> List[Tuple[TorsionDriveRecord, Molecule]]: +) -> List[Tuple[TorsiondriveRecord, Molecule]]: """Returns the QC record and corresponding molecule object associated with each of the specified result entries. @@ -368,7 +368,7 @@ def cached_query_torsion_drive_results( logger.debug(f"retrieving records from {client_address}") - qc_records: Dict[str, TorsionDriveRecord] = { + qc_records: Dict[str, TorsiondriveRecord] = { qc_record.id: qc_record for qc_record in cached_query_procedures( client_address, [result.record_id for result in results]