diff --git a/src/pyobo/api/utils.py b/src/pyobo/api/utils.py index 2a84dda5..2d683006 100644 --- a/src/pyobo/api/utils.py +++ b/src/pyobo/api/utils.py @@ -7,8 +7,8 @@ import bioversions -from ..utils.path import prefix_directory_join from ..constants import VERSION_PINS +from ..utils.path import prefix_directory_join __all__ = [ "get_version", diff --git a/src/pyobo/constants.py b/src/pyobo/constants.py index a0444853..87550f35 100644 --- a/src/pyobo/constants.py +++ b/src/pyobo/constants.py @@ -2,20 +2,15 @@ """Constants for PyOBO.""" +import json import logging -import re import os -import json -import click +import re +import click import pystow -__all__ = [ - "RAW_DIRECTORY", - "DATABASE_DIRECTORY", - "SPECIES_REMAPPING", - "VERSION_PINS" -] +__all__ = ["RAW_DIRECTORY", "DATABASE_DIRECTORY", "SPECIES_REMAPPING", "VERSION_PINS"] logger = logging.getLogger(__name__) @@ -112,18 +107,20 @@ VERSION_PINS = json.loads(VERSION_PINS_STR) for k, v in VERSION_PINS.items(): if not isinstance(k, str) or not isinstance(v, str): - logger.error("The prefix and version name must both be " - "strings") + logger.error("The prefix and version name must both be " "strings") VERSION_PINS = {} break except ValueError as e: - logger.error("The value for the environment variable VERSION_PINS" - " must be a valid JSON string") + logger.error( + "The value for the environment variable VERSION_PINS" " must be a valid JSON string" + ) VERSION_PINS = {} -click.echo(f"These are the resource versions that are pinned.\n{VERSION_PINS}. " - f"\nPyobo will download the latest version of a resource if it's " - f"not pinned.\nIf you want to use a specific version of a " - f"resource, edit your VERSION_PINS environmental " - f"variable which is a JSON string to include a prefix and version " - f"name.") +click.echo( + f"These are the resource versions that are pinned.\n{VERSION_PINS}. " + f"\nPyobo will download the latest version of a resource if it's " + f"not pinned.\nIf you want to use a specific version of a " + f"resource, edit your VERSION_PINS environmental " + f"variable which is a JSON string to include a prefix and version " + f"name." +) diff --git a/src/pyobo/sources/antibodyregistry.py b/src/pyobo/sources/antibodyregistry.py index 3f1e9f4a..20b8b229 100644 --- a/src/pyobo/sources/antibodyregistry.py +++ b/src/pyobo/sources/antibodyregistry.py @@ -10,8 +10,8 @@ from tqdm.auto import tqdm from pyobo import Obo, Term -from pyobo.utils.path import ensure_df from pyobo.api.utils import get_version +from pyobo.utils.path import ensure_df __all__ = [ "AntibodyRegistryGetter", diff --git a/src/pyobo/sources/biogrid.py b/src/pyobo/sources/biogrid.py index 30076f58..2843fbd3 100644 --- a/src/pyobo/sources/biogrid.py +++ b/src/pyobo/sources/biogrid.py @@ -7,10 +7,10 @@ import pandas as pd +from pyobo.api.utils import get_version from pyobo.resources.ncbitaxon import get_ncbitaxon_id from pyobo.utils.cache import cached_mapping from pyobo.utils.path import ensure_df, prefix_directory_join -from pyobo.api.utils import get_version PREFIX = "biogrid" BASE_URL = "https://downloads.thebiogrid.org/Download/BioGRID/Release-Archive" diff --git a/src/pyobo/sources/hgnc.py b/src/pyobo/sources/hgnc.py index 0451fd13..d27430f2 100644 --- a/src/pyobo/sources/hgnc.py +++ b/src/pyobo/sources/hgnc.py @@ -10,10 +10,10 @@ from operator import attrgetter from typing import DefaultDict, Dict, Iterable, Optional - from tabulate import tabulate from tqdm.auto import tqdm +from pyobo.api.utils import get_version from pyobo.struct import ( Obo, Reference, @@ -29,7 +29,6 @@ ) from pyobo.struct.typedef import exact_match from pyobo.utils.path import ensure_path, prefix_directory_join -from pyobo.api.utils import get_version __all__ = [ "HGNCGetter", diff --git a/src/pyobo/sources/mesh.py b/src/pyobo/sources/mesh.py index e85ca5ba..b7c0ddae 100644 --- a/src/pyobo/sources/mesh.py +++ b/src/pyobo/sources/mesh.py @@ -11,12 +11,12 @@ from tqdm.auto import tqdm +from pyobo.api.utils import get_version from pyobo.identifier_utils import standardize_ec from pyobo.struct import Obo, Reference, Synonym, Term from pyobo.utils.cache import cached_json, cached_mapping from pyobo.utils.io import parse_xml_gz from pyobo.utils.path import ensure_path, prefix_directory_join -from pyobo.api.utils import get_version __all__ = [ "MeSHGetter", diff --git a/src/pyobo/sources/pubchem.py b/src/pyobo/sources/pubchem.py index 18a99031..6c91ca08 100644 --- a/src/pyobo/sources/pubchem.py +++ b/src/pyobo/sources/pubchem.py @@ -5,16 +5,15 @@ import logging from typing import Iterable, Mapping, Optional - import pandas as pd from bioregistry.utils import removeprefix from tqdm.auto import tqdm from ..api import get_name_id_mapping +from ..api.utils import get_version from ..struct import Obo, Reference, Synonym, Term from ..utils.iter import iterate_gzips_together from ..utils.path import ensure_df, ensure_path -from ..api.utils import get_version __all__ = [ "PubChemCompoundGetter", diff --git a/src/pyobo/sources/rhea.py b/src/pyobo/sources/rhea.py index 7587a79f..412ef8c2 100644 --- a/src/pyobo/sources/rhea.py +++ b/src/pyobo/sources/rhea.py @@ -7,6 +7,7 @@ import pystow +from pyobo.api.utils import get_version from pyobo.struct import Obo, Reference, Term from pyobo.struct.typedef import ( TypeDef, @@ -20,7 +21,6 @@ reaction_enabled_by_molecular_function, ) from pyobo.utils.path import ensure_df -from pyobo.api.utils import get_version if TYPE_CHECKING: import rdflib diff --git a/src/pyobo/sources/uniprot/uniprot.py b/src/pyobo/sources/uniprot/uniprot.py index 1cc91c9d..6b1a639d 100644 --- a/src/pyobo/sources/uniprot/uniprot.py +++ b/src/pyobo/sources/uniprot/uniprot.py @@ -9,12 +9,12 @@ from tqdm.auto import tqdm from pyobo import Obo, Reference +from pyobo.api.utils import get_version from pyobo.constants import RAW_MODULE from pyobo.identifier_utils import standardize_ec from pyobo.struct import Term, derives_from, enables, from_species, participates_in from pyobo.struct.typedef import gene_product_of, located_in, molecularly_interacts_with from pyobo.utils.io import open_reader -from pyobo.api.utils import get_version PREFIX = "uniprot" BASE_URL = "https://rest.uniprot.org/uniprotkb/stream" diff --git a/src/pyobo/struct/struct.py b/src/pyobo/struct/struct.py index 0b9eb681..d30a93ff 100644 --- a/src/pyobo/struct/struct.py +++ b/src/pyobo/struct/struct.py @@ -56,6 +56,7 @@ term_replaced_by, ) from .utils import comma_separate, obo_escape_slim +from ..api.utils import get_version from ..constants import ( DATE_FORMAT, NCBITAXON_PREFIX, @@ -68,7 +69,6 @@ from ..utils.io import multidict, write_iterable_tsv from ..utils.misc import obo_to_owl from ..utils.path import get_prefix_obo_path, prefix_directory_join -from ..api.utils import get_version __all__ = [ "Synonym", diff --git a/src/pyobo/xrefdb/sources/chembl.py b/src/pyobo/xrefdb/sources/chembl.py index 56304760..a3b04b6c 100644 --- a/src/pyobo/xrefdb/sources/chembl.py +++ b/src/pyobo/xrefdb/sources/chembl.py @@ -6,6 +6,7 @@ import pandas as pd +from pyobo.api.utils import get_version from pyobo.constants import ( PROVENANCE, SOURCE_ID, @@ -15,7 +16,6 @@ XREF_COLUMNS, ) from pyobo.utils.path import ensure_df -from pyobo.api.utils import get_version CHEMBL_COMPOUND_PREFIX = "chembl.compound" CHEMBL_TARGET_PREFIX = "chembl.target" diff --git a/src/pyobo/xrefdb/sources/pubchem.py b/src/pyobo/xrefdb/sources/pubchem.py index 7bbfb7b6..673858c0 100644 --- a/src/pyobo/xrefdb/sources/pubchem.py +++ b/src/pyobo/xrefdb/sources/pubchem.py @@ -6,9 +6,9 @@ import pandas as pd +from ...api.utils import get_version from ...constants import XREF_COLUMNS from ...sources.pubchem import _get_pubchem_extras_url, get_pubchem_id_to_mesh_id -from ...api.utils import get_version __all__ = [ "get_pubchem_mesh_df",