diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 06f82c0..9c18c96 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -11,8 +11,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.6, 3.9] - os: [ubuntu-latest, macos-latest] + python-version: ["3.8", "3.10"] + os: [ubuntu-latest] steps: - uses: actions/checkout@v2 @@ -26,10 +26,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install dev dependancies + - name: Install dev dependencies run: if [ -f requirements/requirements-dev.txt ]; then pip install -r requirements/requirements-dev.txt; fi - - name: Install test dependancies + - name: Install test dependencies run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi - name: Install package diff --git a/docs/changelog.md b/docs/changelog.md index c38168d..d514d02 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format. +## [0.12.3] - 2024-10-10 + +### Fixed +- Reduce verbosity of refgenie plugin + + ## [0.12.2] - 2021-11-04 ### Fixed diff --git a/refgenconf/_version.py b/refgenconf/_version.py index 76da4a9..8e1395b 100644 --- a/refgenconf/_version.py +++ b/refgenconf/_version.py @@ -1 +1 @@ -__version__ = "0.12.2" +__version__ = "0.12.3" diff --git a/refgenconf/populator.py b/refgenconf/populator.py index cb85972..7939203 100644 --- a/refgenconf/populator.py +++ b/refgenconf/populator.py @@ -57,14 +57,14 @@ def get_asset_tag(genome, asset): return namespaces["project"]["refgenie"]["tag_overrides"][genome][asset] except KeyError: default_tag = rgc.get_default_tag(genome=genome, asset=asset) - _LOGGER.info( + _LOGGER.debug( f"Refgenie asset ({genome}/{asset}) tag not specified in `refgenie.tag_overrides` section. " f"Using the default tag: {default_tag}" ) return default_tag except TypeError: default_tag = rgc.get_default_tag(genome=genome, asset=asset) - _LOGGER.warn(f"tag_overrides section is malformed. Using default.") + _LOGGER.warning(f"tag_overrides section is malformed. Using default.") return default_tag # Restructure the seek key paths to make them accessible with @@ -78,7 +78,7 @@ def get_asset_tag(genome, asset): try: paths_dict[g][k] = v[tag] except KeyError: - _LOGGER.warn( + _LOGGER.warning( f"Can't find tag '{tag}' for asset '{g}/{k}', as specified in your project config. Using default." ) paths_dict[g][k] = v[rgc.get_default_tag(genome=g, asset=k)] @@ -97,7 +97,7 @@ def get_asset_tag(genome, asset): except KeyError: _LOGGER.debug("Did not find path_overrides section") except TypeError: - _LOGGER.warn("Warning: path_overrides is not iterable") + _LOGGER.warning("Warning: path_overrides is not iterable") # print(paths_dict) # Provide these values under the 'refgenie' namespace diff --git a/refgenconf/refgenconf.py b/refgenconf/refgenconf.py index 0a551fa..ed4872f 100755 --- a/refgenconf/refgenconf.py +++ b/refgenconf/refgenconf.py @@ -557,9 +557,11 @@ def get_symlink_paths(self, genome, asset=None, tag=None, all_aliases=False): if asset: tag = tag or self.get_default_tag(genome, asset) return { - a: os.path.join(self.alias_dir, a, asset, tag) - if asset - else os.path.join(self.alias_dir, a) + a: ( + os.path.join(self.alias_dir, a, asset, tag) + if asset + else os.path.join(self.alias_dir, a) + ) for a in alias } @@ -1128,9 +1130,9 @@ def list_seek_keys_values(self, genomes=None, assets=None): tag_mapping = asset_mapping[CFG_ASSET_TAGS_KEY][tag_name] ret[genome_name][asset_name][tag_name] = {} for seek_key_name in get_tag_seek_keys(tag_mapping): - ret[genome_name][asset_name][tag_name][ - seek_key_name - ] = self.seek(genome_name, asset_name, tag_name, seek_key_name) + ret[genome_name][asset_name][tag_name][seek_key_name] = ( + self.seek(genome_name, asset_name, tag_name, seek_key_name) + ) return ret def get_local_data_str(self, genome=None, order=None): @@ -1217,9 +1219,11 @@ def listr( genomes = genome if isinstance(genome, list) else [genome] if genome is not None: genome_digests = [ - g - if g in aliases_by_digest.keys() - else digests_by_alias.get(g, None) + ( + g + if g in aliases_by_digest.keys() + else digests_by_alias.get(g, None) + ) for g in genomes ] if genome_digests is None: @@ -3139,7 +3143,7 @@ def _str2float(x): size = "{0:f}GB".format(_str2float(size) / 1000) if size.endswith("KB"): # convert to gigs - size = "{0:f}GB".format(_str2float(size) / 1000 ** 2) + size = "{0:f}GB".format(_str2float(size) / 1000**2) return size.endswith("TB") or (size.endswith("GB") and _str2float(size) > cutoff) diff --git a/refgenconf/refgenconf_v03.py b/refgenconf/refgenconf_v03.py index aa6368e..e4f66e6 100644 --- a/refgenconf/refgenconf_v03.py +++ b/refgenconf/refgenconf_v03.py @@ -9,7 +9,7 @@ import sys import urllib.request import warnings -from collections import Iterable, Mapping, OrderedDict +from collections.abc import Iterable, Mapping from functools import partial from inspect import getfullargspec as finspect from tempfile import TemporaryDirectory @@ -223,7 +223,7 @@ def list(self, genome=None, order=None, include_tags=False): ) if include_tags: self.run_plugins(POST_LIST_HOOK) - return OrderedDict( + return dict( [ ( g, @@ -238,7 +238,7 @@ def list(self, genome=None, order=None, include_tags=False): ] ) self.run_plugins(POST_LIST_HOOK) - return OrderedDict( + return dict( [ ( g, @@ -677,7 +677,7 @@ def listr( :param list[str] | str genome: genomes that the assets should be found for :param function(str) -> object order: how to key genome IDs and asset names for sort - :return dict[OrderedDict[list]]: remotely available genomes and assets + :return dict[dict[list]]: remotely available genomes and assets keyed by genome keyed by source server endpoint """ data_by_server = {} @@ -1575,7 +1575,7 @@ def _invert_genomes(self, order=None): asset ID. :param function(str) -> object order: how to key genome IDs and asset names for sort - :return OrderedDict[str, Iterable[str]] binding between asset kind/key/name + :return dict[str, Iterable[str]] binding between asset kind/key/name and collection of reference genome assembly names for which the asset type is available """ @@ -1584,7 +1584,7 @@ def _invert_genomes(self, order=None): for a in am[CFG_ASSETS_KEY].keys(): genomes.setdefault(a, []).append(g) assets = sorted(genomes.keys(), key=order) - return OrderedDict([(a, sorted(genomes[a], key=order)) for a in assets]) + return dict([(a, sorted(genomes[a], key=order)) for a in assets]) def _chk_digest_if_avail(self, genome, remote_asset_name, server_url): """ @@ -1892,7 +1892,7 @@ def _str2float(x): size = "{0:f}GB".format(_str2float(size) / 1000) if size.endswith("KB"): # convert to gigs - size = "{0:f}GB".format(_str2float(size) / 1000 ** 2) + size = "{0:f}GB".format(_str2float(size) / 1000**2) return size.endswith("TB") or (size.endswith("GB") and _str2float(size) > cutoff) @@ -1910,7 +1910,7 @@ def _list_remote(url, genome, order=None, as_str=True): ) if not refgens: return None, None if as_str else dict() - filtered_genomes_data = OrderedDict( + filtered_genomes_data = dict( [(rg, sorted(genomes_data[rg], key=order)) for rg in refgens] ) if not as_str: diff --git a/refgenconf/seqcol.py b/refgenconf/seqcol.py index 7575719..b25fdfe 100644 --- a/refgenconf/seqcol.py +++ b/refgenconf/seqcol.py @@ -19,17 +19,17 @@ def _schema_path(name): return os.path.join(SCHEMA_FILEPATH, name) -CONTENT_ALL_A_IN_B = 2 ** 0 -CONTENT_ALL_B_IN_A = 2 ** 1 -LENGTHS_ALL_A_IN_B = 2 ** 2 -LENGTHS_ALL_B_IN_A = 2 ** 3 -NAMES_ALL_A_IN_B = 2 ** 4 -NAMES_ALL_B_IN_A = 2 ** 5 -CONTENT_A_ORDER = 2 ** 6 -CONTENT_B_ORDER = 2 ** 7 -CONTENT_ANY_SHARED = 2 ** 8 -LENGTHS_ANY_SHARED = 2 ** 9 -NAMES_ANY_SHARED = 2 ** 10 +CONTENT_ALL_A_IN_B = 2**0 +CONTENT_ALL_B_IN_A = 2**1 +LENGTHS_ALL_A_IN_B = 2**2 +LENGTHS_ALL_B_IN_A = 2**3 +NAMES_ALL_A_IN_B = 2**4 +NAMES_ALL_B_IN_A = 2**5 +CONTENT_A_ORDER = 2**6 +CONTENT_B_ORDER = 2**7 +CONTENT_ANY_SHARED = 2**8 +LENGTHS_ANY_SHARED = 2**9 +NAMES_ANY_SHARED = 2**10 FLAGS = { CONTENT_ALL_A_IN_B: "CONTENT_ALL_A_IN_B", @@ -244,5 +244,5 @@ def explain_flag(flag): """Explains a compare flag""" print(f"Flag: {flag}\nBinary: {bin(flag)}\n") for e in range(0, 13): - if flag & 2 ** e: - print(FLAGS[2 ** e]) + if flag & 2**e: + print(FLAGS[2**e]) diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt index 3efdbb7..ed28d03 100644 --- a/requirements/requirements-test.txt +++ b/requirements/requirements-test.txt @@ -2,6 +2,5 @@ mock pytest pytest-cov pytest-remotedata -git+git://github.com/databio/refgenie_myplugin@master#egg=refgenie_myplugin tqdm veracitools diff --git a/setup.py b/setup.py index e44359e..2d023a9 100644 --- a/setup.py +++ b/setup.py @@ -33,10 +33,9 @@ classifiers=[ "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Scientific/Engineering :: Bio-Informatics", ], license="BSD2", @@ -48,6 +47,6 @@ ["pytest-runner"] if {"test", "pytest", "ptr"} & set(sys.argv) else [] ), url="https://refgenie.databio.org", - author=u"Nathan Sheffield, Vince Reuter, Michal Stolarczyk", + author="Nathan Sheffield, Vince Reuter, Michal Stolarczyk", **extra ) diff --git a/tests/conftest.py b/tests/conftest.py index 4694393..b5c1e2c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """ Test suite shared objects and setup """ + import os import random import shutil diff --git a/tests/test_utils.py b/tests/test_utils.py index 3995a3a..c0ffa8f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,4 @@ -from collections import Mapping +from collections.abc import Mapping import pytest