From acc8927f54ec04f413cb36dbcc8015fd8fb8099e Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Thu, 4 Apr 2024 06:26:09 +0000 Subject: [PATCH] [automated] Fix code linting --- nf_core/download.py | 7 +++---- tests/test_download.py | 36 ++++++++++++------------------------ tests/test_utils.py | 8 ++++++-- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/nf_core/download.py b/nf_core/download.py index c2a25cff26..2f0a974f2a 100644 --- a/nf_core/download.py +++ b/nf_core/download.py @@ -161,8 +161,8 @@ def download_workflow(self): # Get workflow details try: self.prompt_pipeline_name() - self.pipeline, self.wf_revisions, self.wf_branches, self.wf_commits = nf_core.utils.get_repo_releases_branches_commits( - self.pipeline, self.wfs + self.pipeline, self.wf_revisions, self.wf_branches, self.wf_commits = ( + nf_core.utils.get_repo_releases_branches_commits(self.pipeline, self.wfs) ) self.prompt_revision() self.get_revision_hash() @@ -358,7 +358,6 @@ def get_revision_hash(self): """Find specified revision / branch / commit hash""" for revision in self.revision: # revision is a list of strings, but may be of length 1 - # Branch if revision in self.wf_branches.keys(): self.wf_sha = {**self.wf_sha, revision: self.wf_branches[revision]} @@ -375,7 +374,7 @@ def get_revision_hash(self): self.wf_sha = {**self.wf_sha, revision: r["tag_sha"]} break - # Can't find the revisions or branch - throw an error + # Can't find the revisions or branch - throw an error else: log.info( "Available {} revisions: '{}'".format( diff --git a/tests/test_download.py b/tests/test_download.py index 09acae2f61..e6929c1ccf 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -28,12 +28,9 @@ def test_get_release_hash_release(self): wfs.get_remote_workflows() pipeline = "methylseq" download_obj = DownloadWorkflow(pipeline=pipeline, revision="1.6") - ( - download_obj.pipeline, - download_obj.wf_revisions, - download_obj.wf_branches, - _ - ) = nf_core.utils.get_repo_releases_branches_commits(pipeline, wfs) + (download_obj.pipeline, download_obj.wf_revisions, download_obj.wf_branches, _) = ( + nf_core.utils.get_repo_releases_branches_commits(pipeline, wfs) + ) download_obj.get_revision_hash() assert download_obj.wf_sha[download_obj.revision[0]] == "b3e5e3b95aaf01d98391a62a10a3990c0a4de395" assert download_obj.outdir == "nf-core-methylseq_1.6" @@ -48,12 +45,9 @@ def test_get_release_hash_branch(self): # Exoseq pipeline is archived, so `dev` branch should be stable pipeline = "exoseq" download_obj = DownloadWorkflow(pipeline=pipeline, revision="dev") - ( - download_obj.pipeline, - download_obj.wf_revisions, - download_obj.wf_branches, - _ - ) = nf_core.utils.get_repo_releases_branches_commits(pipeline, wfs) + (download_obj.pipeline, download_obj.wf_revisions, download_obj.wf_branches, _) = ( + nf_core.utils.get_repo_releases_branches_commits(pipeline, wfs) + ) download_obj.get_revision_hash() assert download_obj.wf_sha[download_obj.revision[0]] == "819cbac792b76cf66c840b567ed0ee9a2f620db7" assert download_obj.outdir == "nf-core-exoseq_dev" @@ -111,12 +105,9 @@ def test_get_release_hash_non_existent_release(self): wfs.get_remote_workflows() pipeline = "methylseq" download_obj = DownloadWorkflow(pipeline=pipeline, revision="thisisfake") - ( - download_obj.pipeline, - download_obj.wf_revisions, - download_obj.wf_branches, - _ - ) = nf_core.utils.get_repo_releases_branches_commits(pipeline, wfs) + (download_obj.pipeline, download_obj.wf_revisions, download_obj.wf_branches, _) = ( + nf_core.utils.get_repo_releases_branches_commits(pipeline, wfs) + ) with pytest.raises(AssertionError): download_obj.get_revision_hash() @@ -631,12 +622,9 @@ def test_download_workflow_for_platform(self, tmp_dir, _): wfs = nf_core.list.Workflows() wfs.get_remote_workflows() - ( - download_obj.pipeline, - download_obj.wf_revisions, - download_obj.wf_branches, - download_obj.wf_commits - ) = nf_core.utils.get_repo_releases_branches_commits(download_obj.pipeline, wfs) + (download_obj.pipeline, download_obj.wf_revisions, download_obj.wf_branches, download_obj.wf_commits) = ( + nf_core.utils.get_repo_releases_branches_commits(download_obj.pipeline, wfs) + ) download_obj.get_revision_hash() # download_obj.wf_download_url is not set for tower downloads, but the sha values are diff --git a/tests/test_utils.py b/tests/test_utils.py index 28a19a748b..81e52dc93d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -163,7 +163,9 @@ def test_pip_erroneous_package(self): def test_get_repo_releases_branches_commits_nf_core(self): wfs = nf_core.list.Workflows() wfs.get_remote_workflows() - pipeline, wf_releases, wf_branches, wf_commits = nf_core.utils.get_repo_releases_branches_commits("methylseq", wfs) + pipeline, wf_releases, wf_branches, wf_commits = nf_core.utils.get_repo_releases_branches_commits( + "methylseq", wfs + ) for r in wf_releases: if r.get("tag_name") == "1.6": break @@ -175,7 +177,9 @@ def test_get_repo_releases_branches_commits_nf_core(self): def test_get_repo_releases_branches_commits_not_nf_core(self): wfs = nf_core.list.Workflows() wfs.get_remote_workflows() - pipeline, wf_releases, wf_branches, wf_commits = nf_core.utils.get_repo_releases_branches_commits("MultiQC/MultiQC", wfs) + pipeline, wf_releases, wf_branches, wf_commits = nf_core.utils.get_repo_releases_branches_commits( + "MultiQC/MultiQC", wfs + ) for r in wf_releases: if r.get("tag_name") == "v1.10": break