From 36be69b5a18d8eac46798833116b6a29b568ed41 Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Wed, 7 Aug 2024 09:43:16 -0400 Subject: [PATCH] Revert "style: update ruff (#40)" This reverts commit 4658513559e9e35a2074902c1ae692c85707c317. --- .pre-commit-config.yaml | 2 +- pyproject.toml | 35 ++++++------------- src/wags_tails/__init__.py | 1 - src/wags_tails/base_source.py | 7 ++-- src/wags_tails/chembl.py | 1 - src/wags_tails/chemidplus.py | 3 +- src/wags_tails/custom.py | 7 ++-- src/wags_tails/do.py | 1 - src/wags_tails/drugbank.py | 8 ++--- src/wags_tails/drugsatfda.py | 3 +- src/wags_tails/ensembl.py | 1 - src/wags_tails/ensembl_transcript_mappings.py | 2 +- src/wags_tails/guide_to_pharmacology.py | 5 ++- src/wags_tails/hemonc.py | 11 +++--- src/wags_tails/hgnc.py | 3 +- src/wags_tails/mondo.py | 6 ++-- src/wags_tails/ncbi.py | 5 ++- src/wags_tails/ncbi_lrg_refseqgene.py | 3 +- src/wags_tails/ncbi_mane_summary.py | 1 - src/wags_tails/ncit.py | 1 - src/wags_tails/oncotree.py | 3 +- src/wags_tails/rxnorm.py | 1 - src/wags_tails/utils/downloads.py | 27 +++++++------- src/wags_tails/utils/storage.py | 1 - src/wags_tails/utils/versioning.py | 1 - tests/conftest.py | 1 - tests/test_base.py | 1 - tests/test_chembl.py | 1 - tests/test_chemidplus.py | 1 - tests/test_custom.py | 1 - tests/test_do.py | 6 ++-- tests/test_drugbank.py | 4 +-- tests/test_drugsatfda.py | 4 +-- tests/test_ensembl.py | 1 - tests/test_ensembl_transcript_mappings.py | 1 - tests/test_gtop.py | 4 +-- tests/test_hemonc.py | 4 +-- tests/test_hgnc.py | 1 - tests/test_mondo.py | 6 ++-- tests/test_ncbi.py | 1 - tests/test_ncbi_lrg_refseqgene.py | 1 - tests/test_ncbi_mane_summary.py | 1 - tests/test_ncit.py | 1 - tests/test_oncotree.py | 6 ++-- tests/test_rxnorm.py | 4 +-- 45 files changed, 70 insertions(+), 119 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b6b29c..43afb3b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 # ruff version + rev: v0.2.0 hooks: - id: ruff-format - id: ruff diff --git a/pyproject.toml b/pyproject.toml index 7b914f5..54d7f4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ [project.optional-dependencies] test = ["pytest>=6.0", "pytest-cov", "requests-mock"] -dev = ["pre-commit", "ruff==0.5.0"] +dev = ["pre-commit", "ruff==0.2.0"] docs = [ "sphinx==6.1.3", "sphinx-autodoc-typehints==1.22.0", @@ -84,22 +84,16 @@ select = [ "DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz "T10", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz "EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em - "LOG", # https://docs.astral.sh/ruff/rules/#flake8-logging-log "G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g - "INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp "PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie "T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20 "PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt "Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q "RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse "RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret - "SLF", # https://docs.astral.sh/ruff/rules/#flake8-self-slf "SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim - "ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg "PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth "PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh - "PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf - "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb "RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf ] fixable = [ @@ -110,20 +104,16 @@ fixable = [ "ANN", "B", "C4", - "LOG", "G", "PIE", "PT", "RSE", "SIM", - "PERF", - "FURB", "RUF" ] -# ANN003 - missing-type-kwargs # ANN101 - missing-type-self -# ANN102 - missing-type-cls +# ANN003 - missing-type-kwargs # D203 - one-blank-line-before-class # D205 - blank-line-after-summary # D206 - indent-with-spaces* @@ -139,7 +129,7 @@ fixable = [ # S321 - suspicious-ftp-lib-usage # *ignored for compatibility with formatter ignore = [ - "ANN003", "ANN101", "ANN102", + "ANN101", "ANN003", "D203", "D205", "D206", "D213", "D300", "D400", "D415", "E111", "E114", "E117", "E501", "W191", @@ -149,20 +139,15 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # ANN001 - missing-type-function-argument # ANN2 - missing-return-type -# S101 - assert -# B011 - assert-false -# INP001 - implicit-namespace-package +# ANN201 - Missing type annotation +# ANN102 - missing-type-cls +# N805 - invalid-first-argument-name-for-method # PT018 - pytest-composite-assertion -# ARG001 - unused-function-argument -# ARG005 - unused-lambda-argument -# T201 - print -"tests/*" = ["ANN001", "ANN2", "S101", "B011", "INP001"] +# S101 - assert +"tests/*" = ["ANN001", "ANN102", "ANN2", "S101"] "tests/test_hemonc.py" = ["PT018"] "tests/test_gtop.py" = ["PT018"] "tests/test_do.py" = ["PT018"] -"tests/test_custom.py" = ["ARG001", "ARG005"] +"*__init__.py" = ["F401"] +"src/wags_tails/base_source.py" = ["ANN102"] "src/wags_tails/utils/downloads.py" = ["T201"] - - -[tool.ruff.format] -docstring-code-format = true diff --git a/src/wags_tails/__init__.py b/src/wags_tails/__init__.py index 971a229..9b8dc28 100644 --- a/src/wags_tails/__init__.py +++ b/src/wags_tails/__init__.py @@ -1,5 +1,4 @@ """Data acquisition tools for Wagnerds.""" - from .base_source import DataSource, RemoteDataError from .chembl import ChemblData from .chemidplus import ChemIDplusData diff --git a/src/wags_tails/base_source.py b/src/wags_tails/base_source.py index 4063dea..3567c80 100644 --- a/src/wags_tails/base_source.py +++ b/src/wags_tails/base_source.py @@ -3,12 +3,11 @@ All source classes should inherit - directly or indirectly - from ``DataSource``. Each class defined here is an ``abstract base class`` and cannot be instantiated directly. """ - import abc import datetime import logging -from collections.abc import Generator from pathlib import Path +from typing import Generator, Optional, Tuple import requests @@ -34,7 +33,7 @@ class DataSource(abc.ABC): _filetype: str _versioned: bool = True - def __init__(self, data_dir: Path | None = None, silent: bool = True) -> None: + def __init__(self, data_dir: Optional[Path] = None, silent: bool = True) -> None: """Set common class parameters. :param data_dir: direct location to store data files in, if specified. See @@ -72,7 +71,7 @@ def _download_data(self, version: str, outfile: Path) -> None: def get_latest( self, from_local: bool = False, force_refresh: bool = False - ) -> tuple[Path, str]: + ) -> Tuple[Path, str]: """Get path to latest version of data. Provides logic for both versioned and unversioned data here, rather than in the diff --git a/src/wags_tails/chembl.py b/src/wags_tails/chembl.py index dc085f6..45a3f85 100644 --- a/src/wags_tails/chembl.py +++ b/src/wags_tails/chembl.py @@ -1,5 +1,4 @@ """Provide source fetching for ChEMBL.""" - import fnmatch import re import tarfile diff --git a/src/wags_tails/chemidplus.py b/src/wags_tails/chemidplus.py index 6eaaace..673124c 100644 --- a/src/wags_tails/chemidplus.py +++ b/src/wags_tails/chemidplus.py @@ -1,5 +1,4 @@ """Provide source fetching for ChemIDplus.""" - import datetime import re from pathlib import Path @@ -39,7 +38,7 @@ def _get_latest_version() -> str: .strftime(DATE_VERSION_PATTERN) ) - def _download_data(self, version: str, outfile: Path) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile: Path) -> None: """Download data file to specified location. ChemIDplus data is no longer updated, so versioning is irrelevant. diff --git a/src/wags_tails/custom.py b/src/wags_tails/custom.py index bcf781e..d5be4d7 100644 --- a/src/wags_tails/custom.py +++ b/src/wags_tails/custom.py @@ -9,9 +9,8 @@ The :ref:`documentation ` provides more explanation and an in-depth example. """ - -from collections.abc import Callable from pathlib import Path +from typing import Callable, Optional from .base_source import DataSource @@ -25,8 +24,8 @@ def __init__( filetype: str, latest_version_cb: Callable[[], str], download_cb: Callable[[str, Path], None], - data_dir: Path | None = None, - file_name: str | None = None, + data_dir: Optional[Path] = None, + file_name: Optional[str] = None, versioned: bool = True, silent: bool = False, ) -> None: diff --git a/src/wags_tails/do.py b/src/wags_tails/do.py index 725b72f..8eff946 100644 --- a/src/wags_tails/do.py +++ b/src/wags_tails/do.py @@ -1,5 +1,4 @@ """Provide source fetching for Human Disease Ontology.""" - import datetime import tarfile from pathlib import Path diff --git a/src/wags_tails/drugbank.py b/src/wags_tails/drugbank.py index 13c6250..e1dcded 100644 --- a/src/wags_tails/drugbank.py +++ b/src/wags_tails/drugbank.py @@ -1,7 +1,7 @@ """Provide source fetching for DrugBank.""" - import logging from pathlib import Path +from typing import Tuple import requests @@ -19,7 +19,7 @@ class DrugBankData(DataSource): _filetype = "csv" @staticmethod - def _get_latest_version() -> tuple[str, str]: + def _get_latest_version() -> Tuple[str, str]: """Retrieve latest version value :return: latest release value and base download URL @@ -35,7 +35,7 @@ def _get_latest_version() -> tuple[str, str]: msg = "Unable to parse latest DrugBank version number from releases API endpoint" raise RemoteDataError(msg) from e - def _get_latest_local_file(self, glob: str) -> tuple[Path, str]: + def _get_latest_local_file(self, glob: str) -> Tuple[Path, str]: """Get most recent locally-available file. DrugBank uses versioning that isn't easily sortable by default so we have to use some extra magic. @@ -72,7 +72,7 @@ def _download_data(self, url: str, outfile: Path) -> None: def get_latest( self, from_local: bool = False, force_refresh: bool = False - ) -> tuple[Path, str]: + ) -> Tuple[Path, str]: """Get path to latest version of data, and its version value :param from_local: if True, use latest available local file diff --git a/src/wags_tails/drugsatfda.py b/src/wags_tails/drugsatfda.py index d8d8492..34ea124 100644 --- a/src/wags_tails/drugsatfda.py +++ b/src/wags_tails/drugsatfda.py @@ -1,5 +1,4 @@ """Provide source fetching for Drugs@FDA.""" - import datetime from pathlib import Path @@ -39,7 +38,7 @@ def _get_latest_version() -> str: .strftime(DATE_VERSION_PATTERN) ) - def _download_data(self, version: str, outfile: Path) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile: Path) -> None: """Download latest data file to specified location. :param version: version to acquire diff --git a/src/wags_tails/ensembl.py b/src/wags_tails/ensembl.py index 699da1f..ece3a25 100644 --- a/src/wags_tails/ensembl.py +++ b/src/wags_tails/ensembl.py @@ -1,5 +1,4 @@ """Provide data management for Ensembl genomic data.""" - from pathlib import Path import requests diff --git a/src/wags_tails/ensembl_transcript_mappings.py b/src/wags_tails/ensembl_transcript_mappings.py index d61552a..5ef3277 100644 --- a/src/wags_tails/ensembl_transcript_mappings.py +++ b/src/wags_tails/ensembl_transcript_mappings.py @@ -14,7 +14,7 @@ class EnsemblTranscriptMappingData(UnversionedDataSource): _src_name = "ensembl_transcript_mappings" _filetype = "tsv" - def _download_data(self, version: str, outfile: Path) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile: Path) -> None: """Download data file to specified location. :param version: version to acquire diff --git a/src/wags_tails/guide_to_pharmacology.py b/src/wags_tails/guide_to_pharmacology.py index a4d5bd4..b71ad17 100644 --- a/src/wags_tails/guide_to_pharmacology.py +++ b/src/wags_tails/guide_to_pharmacology.py @@ -1,9 +1,8 @@ """Provide source fetching for Guide To Pharmacology.""" - import logging import re from pathlib import Path -from typing import NamedTuple +from typing import NamedTuple, Tuple import requests @@ -68,7 +67,7 @@ def _download_data(self, file_paths: GtoPLigandPaths) -> None: def get_latest( self, from_local: bool = False, force_refresh: bool = False - ) -> tuple[GtoPLigandPaths, str]: + ) -> Tuple[GtoPLigandPaths, str]: """Get path to latest version of data, and its version value :param from_local: if True, use latest available local file diff --git a/src/wags_tails/hemonc.py b/src/wags_tails/hemonc.py index 68fa2c6..7af417c 100644 --- a/src/wags_tails/hemonc.py +++ b/src/wags_tails/hemonc.py @@ -1,10 +1,9 @@ """Provide source fetching for HemOnc.""" - import logging import os import zipfile from pathlib import Path -from typing import NamedTuple +from typing import NamedTuple, Tuple import requests @@ -70,7 +69,7 @@ def _download_handler(self, dl_path: Path, file_paths: HemOncPaths) -> None: zip_ref.extract(file, path.parent) dl_path.unlink() - def _download_data(self, version: str, outfile_paths: HemOncPaths) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile_paths: HemOncPaths) -> None: """Download data file to specified location. :param version: version to acquire @@ -85,13 +84,13 @@ def _download_data(self, version: str, outfile_paths: HemOncPaths) -> None: # n self.data_dir, headers={"X-Dataverse-key": api_key}, # provide save_path arg for API consistency, but don't use it - handler=lambda dl_path, save_path: self._download_handler( # noqa: ARG005 + handler=lambda dl_path, save_path: self._download_handler( dl_path, outfile_paths ), tqdm_params=self._tqdm_params, ) - def _get_local_files(self) -> tuple[HemOncPaths, str]: + def _get_local_files(self) -> Tuple[HemOncPaths, str]: """Acquire locally-available data files. :return: HemOnc file paths and their version @@ -109,7 +108,7 @@ def _get_local_files(self) -> tuple[HemOncPaths, str]: def get_latest( self, from_local: bool = False, force_refresh: bool = False - ) -> tuple[HemOncPaths, str]: + ) -> Tuple[HemOncPaths, str]: """Get path to latest version of data, and its version value :param from_local: if True, use latest available local file diff --git a/src/wags_tails/hgnc.py b/src/wags_tails/hgnc.py index 1118ee2..f9c52e4 100644 --- a/src/wags_tails/hgnc.py +++ b/src/wags_tails/hgnc.py @@ -1,5 +1,4 @@ """Provide data fetching for HGNC.""" - import ftplib from pathlib import Path @@ -27,7 +26,7 @@ def _get_latest_version(self) -> str: timestamp = ftp.voidcmd(f"MDTM {self._directory_path}{self._host_filename}") return timestamp[4:12] - def _download_data(self, version: str, outfile: Path) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile: Path) -> None: """Download data file to specified location. :param version: version to acquire diff --git a/src/wags_tails/mondo.py b/src/wags_tails/mondo.py index a41dc84..d815ab0 100644 --- a/src/wags_tails/mondo.py +++ b/src/wags_tails/mondo.py @@ -1,8 +1,8 @@ """Provide source fetching for Mondo Disease Ontology.""" - import datetime import logging from pathlib import Path +from typing import Tuple import requests @@ -22,7 +22,7 @@ class MondoData(GitHubDataSource): _repo = "monarch-initiative/mondo" @staticmethod - def _get_latest_version() -> tuple[str, str]: + def _get_latest_version() -> Tuple[str, str]: """Retrieve latest version value, and download URL, from GitHub release data. :param asset_name: name of file asset, if needed @@ -71,7 +71,7 @@ def _download_data(self, version: str, outfile: Path) -> None: def get_latest( self, from_local: bool = False, force_refresh: bool = False - ) -> tuple[Path, str]: + ) -> Tuple[Path, str]: """Get path to latest version of data. Overwrite inherited method because final downloads depend on information gleaned from the version API call. diff --git a/src/wags_tails/ncbi.py b/src/wags_tails/ncbi.py index fe490cb..9d740d5 100644 --- a/src/wags_tails/ncbi.py +++ b/src/wags_tails/ncbi.py @@ -1,10 +1,9 @@ """Provide data fetching for NCBI gene data sources.""" - import ftplib import logging import re from pathlib import Path -from typing import NamedTuple +from typing import NamedTuple, Tuple from wags_tails.base_source import DataSource, RemoteDataError from wags_tails.utils.downloads import download_ftp, handle_gzip @@ -143,7 +142,7 @@ def _download_data(self, file_paths: NcbiGenePaths) -> None: def get_latest( self, from_local: bool = False, force_refresh: bool = False - ) -> tuple[NcbiGenePaths, str]: + ) -> Tuple[NcbiGenePaths, str]: """Get path to latest version of data, and its version value :param from_local: if True, use latest available local file diff --git a/src/wags_tails/ncbi_lrg_refseqgene.py b/src/wags_tails/ncbi_lrg_refseqgene.py index c426d9d..64ceeac 100644 --- a/src/wags_tails/ncbi_lrg_refseqgene.py +++ b/src/wags_tails/ncbi_lrg_refseqgene.py @@ -1,5 +1,4 @@ """Fetches NCBI LRG_RefSeqGene data.""" - import re from pathlib import Path @@ -37,7 +36,7 @@ def _get_latest_version(self) -> str: raise RemoteDataError(msg) return match[0].replace("-", "") - def _download_data(self, version: str, outfile: Path) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile: Path) -> None: """Download data file to specified location. :param version: version to acquire diff --git a/src/wags_tails/ncbi_mane_summary.py b/src/wags_tails/ncbi_mane_summary.py index 354f39c..53bb56a 100644 --- a/src/wags_tails/ncbi_mane_summary.py +++ b/src/wags_tails/ncbi_mane_summary.py @@ -1,5 +1,4 @@ """Fetches NCBI MANE summary data.""" - from pathlib import Path import requests diff --git a/src/wags_tails/ncit.py b/src/wags_tails/ncit.py index 5c9431c..a53313d 100644 --- a/src/wags_tails/ncit.py +++ b/src/wags_tails/ncit.py @@ -1,5 +1,4 @@ """Provide source fetching for NCI Thesaurus.""" - import re from pathlib import Path diff --git a/src/wags_tails/oncotree.py b/src/wags_tails/oncotree.py index 74b5c88..6253230 100644 --- a/src/wags_tails/oncotree.py +++ b/src/wags_tails/oncotree.py @@ -1,5 +1,4 @@ """Provide access to Oncotree data.""" - import datetime from pathlib import Path @@ -40,7 +39,7 @@ def _get_latest_version(self) -> str: .strftime(DATE_VERSION_PATTERN) ) - def _download_data(self, version: str, outfile: Path) -> None: # noqa: ARG002 + def _download_data(self, version: str, outfile: Path) -> None: """Download data file to specified location. :param version: version to acquire diff --git a/src/wags_tails/rxnorm.py b/src/wags_tails/rxnorm.py index a9da22f..dd1c60b 100644 --- a/src/wags_tails/rxnorm.py +++ b/src/wags_tails/rxnorm.py @@ -1,5 +1,4 @@ """Provide source fetching for RxNorm.""" - import datetime import os import zipfile diff --git a/src/wags_tails/utils/downloads.py b/src/wags_tails/utils/downloads.py index d54023e..56d328b 100644 --- a/src/wags_tails/utils/downloads.py +++ b/src/wags_tails/utils/downloads.py @@ -1,5 +1,4 @@ """Provide helper functions for downloading data.""" - import ftplib import gzip import logging @@ -7,8 +6,8 @@ import re import tempfile import zipfile -from collections.abc import Callable from pathlib import Path +from typing import Callable, Dict, Optional import requests from tqdm import tqdm @@ -52,8 +51,8 @@ def download_ftp( host_directory_path: str, host_filename: str, outfile_path: Path, - handler: Callable[[Path, Path], None] | None = None, - tqdm_params: dict | None = None, + handler: Optional[Callable[[Path, Path], None]] = None, + tqdm_params: Optional[Dict] = None, ) -> None: """Perform FTP download of remote data file. @@ -80,10 +79,9 @@ def download_ftp( file_size = ftp.size(host_filename) if not tqdm_params.get("disable"): print(f"Downloading {host}/{host_directory_path}{host_filename}...") - with ( - dl_path.open("wb") as fp, - tqdm(total=file_size, **tqdm_params) as progress_bar, - ): + with dl_path.open("wb") as fp, tqdm( + total=file_size, **tqdm_params + ) as progress_bar: def _cb(data: bytes) -> None: progress_bar.update(len(data)) @@ -100,9 +98,9 @@ def _cb(data: bytes) -> None: def download_http( url: str, outfile_path: Path, - headers: dict | None = None, - handler: Callable[[Path, Path], None] | None = None, - tqdm_params: dict | None = None, + headers: Optional[Dict] = None, + handler: Optional[Callable[[Path, Path], None]] = None, + tqdm_params: Optional[Dict] = None, ) -> None: """Perform HTTP download of remote data file. @@ -134,10 +132,9 @@ def download_http( print(f"Downloading {print_url}...") else: print(f"Downloading {os.path.basename(url)}...") # noqa: PTH119 - with ( - dl_path.open("wb") as h, - tqdm(total=total_size, **tqdm_params) as progress_bar, - ): + with dl_path.open("wb") as h, tqdm( + total=total_size, **tqdm_params + ) as progress_bar: for chunk in r.iter_content(chunk_size=8192): if chunk: h.write(chunk) diff --git a/src/wags_tails/utils/storage.py b/src/wags_tails/utils/storage.py index 308e41f..01cefa4 100644 --- a/src/wags_tails/utils/storage.py +++ b/src/wags_tails/utils/storage.py @@ -1,5 +1,4 @@ """Provide helpful functions for managing data storage.""" - import logging import os from pathlib import Path diff --git a/src/wags_tails/utils/versioning.py b/src/wags_tails/utils/versioning.py index facc586..bc3f301 100644 --- a/src/wags_tails/utils/versioning.py +++ b/src/wags_tails/utils/versioning.py @@ -1,5 +1,4 @@ """Basic utilities pertaining to data versioning.""" - import re from pathlib import Path diff --git a/tests/conftest.py b/tests/conftest.py index 5640969..1455fae 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,4 @@ """Provide core testing utilities.""" - import shutil from pathlib import Path diff --git a/tests/test_base.py b/tests/test_base.py index 1609945..9048e23 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,5 +1,4 @@ """Test base class functions.""" - import os import tempfile from pathlib import Path diff --git a/tests/test_chembl.py b/tests/test_chembl.py index cccec19..a77b914 100644 --- a/tests/test_chembl.py +++ b/tests/test_chembl.py @@ -1,5 +1,4 @@ """Test ChEMBL data source.""" - from io import TextIOWrapper from pathlib import Path diff --git a/tests/test_chemidplus.py b/tests/test_chemidplus.py index 5a44aa6..79d15ef 100644 --- a/tests/test_chemidplus.py +++ b/tests/test_chemidplus.py @@ -1,5 +1,4 @@ """Test ChemIDplus data source.""" - from pathlib import Path import pytest diff --git a/tests/test_custom.py b/tests/test_custom.py index 1746fe3..09499f4 100644 --- a/tests/test_custom.py +++ b/tests/test_custom.py @@ -1,5 +1,4 @@ """Test custom data source.""" - from io import TextIOWrapper from pathlib import Path diff --git a/tests/test_do.py b/tests/test_do.py index 4d63638..c51e2f4 100644 --- a/tests/test_do.py +++ b/tests/test_do.py @@ -1,8 +1,8 @@ """Test Disease Ontology data source.""" - import json from io import TextIOWrapper from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -48,8 +48,8 @@ def latest_release_file(fixture_dir): def test_get_latest( do: DoData, data_dir, - versions_response: dict, - latest_release_response: dict, + versions_response: Dict, + latest_release_response: Dict, latest_release_file: TextIOWrapper, ): """Test DoData.get_latest()""" diff --git a/tests/test_drugbank.py b/tests/test_drugbank.py index eb6fd0f..9b66331 100644 --- a/tests/test_drugbank.py +++ b/tests/test_drugbank.py @@ -1,7 +1,7 @@ """Test DrugBank data source.""" - import json from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -40,7 +40,7 @@ def versions_response(fixture_dir): def test_get_latest( drugbank: DrugBankData, drugbank_data_dir: Path, - versions_response: dict, + versions_response: Dict, drugbank_file: str, ): """Test chemblData.get_latest()""" diff --git a/tests/test_drugsatfda.py b/tests/test_drugsatfda.py index 1d81e13..d59e1d4 100644 --- a/tests/test_drugsatfda.py +++ b/tests/test_drugsatfda.py @@ -1,7 +1,7 @@ """Test Drugs@FDA data source.""" - import json from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -40,7 +40,7 @@ def drugsatfda_file(fixture_dir): def test_get_latest( drugsatfda: DrugsAtFdaData, drugsatfda_data_dir: Path, - latest_release_response: dict, + latest_release_response: Dict, drugsatfda_file: str, ): """Test DrugsAtFdaData.get_latest()""" diff --git a/tests/test_ensembl.py b/tests/test_ensembl.py index 73cc842..cfd675e 100644 --- a/tests/test_ensembl.py +++ b/tests/test_ensembl.py @@ -1,5 +1,4 @@ """Test Ensembl data source.""" - from pathlib import Path import pytest diff --git a/tests/test_ensembl_transcript_mappings.py b/tests/test_ensembl_transcript_mappings.py index a7689bb..693346b 100644 --- a/tests/test_ensembl_transcript_mappings.py +++ b/tests/test_ensembl_transcript_mappings.py @@ -1,5 +1,4 @@ """Test Ensembl Transcript Mappings data source.""" - from pathlib import Path import pytest diff --git a/tests/test_gtop.py b/tests/test_gtop.py index 2cfe1cc..6e06790 100644 --- a/tests/test_gtop.py +++ b/tests/test_gtop.py @@ -1,6 +1,6 @@ """Test Guide to Pharmacology data source.""" - from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -41,7 +41,7 @@ def gtop_ligand_file_paths(gtop_data_dir: Path): def test_get_latest( gtop_ligand: GToPLigandData, gtop_data_dir: Path, - latest_release_response: dict, + latest_release_response: Dict, gtop_ligand_file_paths: GtoPLigandPaths, ): """Test GToPLigandData.get_latest()""" diff --git a/tests/test_hemonc.py b/tests/test_hemonc.py index 8c4498c..4a90ab5 100644 --- a/tests/test_hemonc.py +++ b/tests/test_hemonc.py @@ -1,8 +1,8 @@ """Test HemOnc data source.""" - import json import os from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -51,7 +51,7 @@ def hemonc_file_paths(hemonc_data_dir: Path): def test_get_latest( hemonc: HemOncData, hemonc_data_dir, - latest_release_response: dict, + latest_release_response: Dict, hemonc_file: str, hemonc_file_paths: HemOncPaths, ): diff --git a/tests/test_hgnc.py b/tests/test_hgnc.py index 62f1fff..80cec02 100644 --- a/tests/test_hgnc.py +++ b/tests/test_hgnc.py @@ -1,5 +1,4 @@ """Test HGNC data source.""" - from pathlib import Path import pytest diff --git a/tests/test_mondo.py b/tests/test_mondo.py index f7db62a..3d6a37b 100644 --- a/tests/test_mondo.py +++ b/tests/test_mondo.py @@ -1,7 +1,7 @@ """Test Mondo data source.""" - import json from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -47,7 +47,7 @@ def versions_response(fixture_dir): def test_get_latest( mondo: MondoData, mondo_data_dir: Path, - latest_release_response: dict, + latest_release_response: Dict, ): """Test MondoData.get_latest()""" with pytest.raises( @@ -99,7 +99,7 @@ def test_get_latest( assert m.call_count == 5 -def test_iterate_versions(mondo: MondoData, versions_response: dict): +def test_iterate_versions(mondo: MondoData, versions_response: Dict): """Test MondoData.iterate_versions()""" with requests_mock.Mocker() as m: m.get( diff --git a/tests/test_ncbi.py b/tests/test_ncbi.py index 8126675..3133825 100644 --- a/tests/test_ncbi.py +++ b/tests/test_ncbi.py @@ -1,5 +1,4 @@ """Test NCBI data source.""" - from pathlib import Path import pytest diff --git a/tests/test_ncbi_lrg_refseqgene.py b/tests/test_ncbi_lrg_refseqgene.py index 33e5949..dd17841 100644 --- a/tests/test_ncbi_lrg_refseqgene.py +++ b/tests/test_ncbi_lrg_refseqgene.py @@ -1,5 +1,4 @@ """Test NCBI LRG_RefSeqGene data source.""" - from pathlib import Path import pytest diff --git a/tests/test_ncbi_mane_summary.py b/tests/test_ncbi_mane_summary.py index db8011a..81f4114 100644 --- a/tests/test_ncbi_mane_summary.py +++ b/tests/test_ncbi_mane_summary.py @@ -1,5 +1,4 @@ """Test NCBI MANE summary data.""" - from pathlib import Path import pytest diff --git a/tests/test_ncit.py b/tests/test_ncit.py index 6671f13..8f4b57e 100644 --- a/tests/test_ncit.py +++ b/tests/test_ncit.py @@ -1,5 +1,4 @@ """Test NCIt data source.""" - from io import TextIOWrapper from pathlib import Path diff --git a/tests/test_oncotree.py b/tests/test_oncotree.py index 9f6c487..ec236f2 100644 --- a/tests/test_oncotree.py +++ b/tests/test_oncotree.py @@ -1,7 +1,7 @@ """Test OncoTree data source.""" - import json from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -40,8 +40,8 @@ def oncotree_tree(fixture_dir): def test_get_latest( oncotree: OncoTreeData, data_dir: Path, - oncotree_versions_response: dict, - oncotree_tree: dict, + oncotree_versions_response: Dict, + oncotree_tree: Dict, ): """Test chemblData.get_latest()""" with pytest.raises( diff --git a/tests/test_rxnorm.py b/tests/test_rxnorm.py index e5cd6af..d8879c7 100644 --- a/tests/test_rxnorm.py +++ b/tests/test_rxnorm.py @@ -1,9 +1,9 @@ """Test RxNorm data source.""" - import json import os from io import TextIOWrapper from pathlib import Path +from typing import Dict import pytest import requests_mock @@ -42,7 +42,7 @@ def rxnorm_file(fixture_dir): def test_get_latest( rxnorm: RxNormData, rxnorm_data_dir: Path, - latest_release_response: dict, + latest_release_response: Dict, rxnorm_file: TextIOWrapper, ): """Test RxNormData.get_latest()"""