From 049692d28d18427e8ba2564e5d20710e4aaf6035 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 08:50:14 -0400 Subject: [PATCH 1/9] fix plugin verbosity --- refgenconf/populator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From 34386c406c9d963603f98ece62e742ded1be63bf Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 08:53:00 -0400 Subject: [PATCH 2/9] update changelog, version bump --- docs/changelog.md | 6 ++++++ refgenconf/_version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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" From 4de2e89ce36e08c074a25d4b98748d1d9db9a4b1 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 09:02:41 -0400 Subject: [PATCH 3/9] lint --- refgenconf/refgenconf.py | 24 ++++++++++++++---------- refgenconf/refgenconf_v03.py | 2 +- refgenconf/seqcol.py | 26 +++++++++++++------------- setup.py | 2 +- tests/conftest.py | 1 + 5 files changed, 30 insertions(+), 25 deletions(-) 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..a4cd47b 100644 --- a/refgenconf/refgenconf_v03.py +++ b/refgenconf/refgenconf_v03.py @@ -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) 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/setup.py b/setup.py index e44359e..29b45a5 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,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 From 53c5e7f16f4797068ada114077a2b679114cec08 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 09:19:56 -0400 Subject: [PATCH 4/9] update test architectures --- .github/workflows/run-pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 06f82c0..0d00ca9 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.6, 3.9] + python-version: [3.7, 3.10] os: [ubuntu-latest, macos-latest] steps: From ac80707e45537cfcdf0093c2f22353f09f734e33 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 09:20:33 -0400 Subject: [PATCH 5/9] update test architectures --- .github/workflows/run-pytest.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 0d00ca9..4b19d90 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.7, 3.10] + python-version: ["3.7", "3.10"] os: [ubuntu-latest, macos-latest] steps: @@ -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 From 31c1c3b33cec9c4411970b23fd9bf16cb64ce011 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 09:22:03 -0400 Subject: [PATCH 6/9] update test architectures --- .github/workflows/run-pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 4b19d90..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.7", "3.10"] - os: [ubuntu-latest, macos-latest] + python-version: ["3.8", "3.10"] + os: [ubuntu-latest] steps: - uses: actions/checkout@v2 From 852c54d56d2bae9ed85b71bfebcdcf2b978dd372 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 09:29:01 -0400 Subject: [PATCH 7/9] remove refgenie_myplugin from test reqs --- requirements/requirements-test.txt | 1 - 1 file changed, 1 deletion(-) 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 From 9367ed972aa02888a238b42b5209bf39b1683793 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 10:08:49 -0400 Subject: [PATCH 8/9] updates for Python 3.10 --- refgenconf/refgenconf_v03.py | 14 +++++++------- tests/test_utils.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/refgenconf/refgenconf_v03.py b/refgenconf/refgenconf_v03.py index a4cd47b..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): """ @@ -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/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 From 5ce6c01c7c56441642f8cb6687e303dc5fbbc2b0 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 10 Oct 2024 10:09:33 -0400 Subject: [PATCH 9/9] py3.10 --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 29b45a5..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",