Skip to content

Commit

Permalink
[automated] Fix code linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nf-core-bot committed Apr 4, 2024
1 parent 937e442 commit 74bacb8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 30 deletions.
7 changes: 3 additions & 4 deletions nf_core/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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]}
Expand All @@ -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(
Expand Down
36 changes: 12 additions & 24 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 74bacb8

Please sign in to comment.