From 9558b2a61b3a23a5d8f7ecc425a3cb4e842602a5 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 30 Oct 2024 21:19:21 -0400 Subject: [PATCH] Lint fixes. --- lib/galaxy/managers/markdown_util.py | 6 ++--- .../unit/app/managers/test_markdown_export.py | 24 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/galaxy/managers/markdown_util.py b/lib/galaxy/managers/markdown_util.py index 1ad23d32e1a5..b2d5550b036b 100644 --- a/lib/galaxy/managers/markdown_util.py +++ b/lib/galaxy/managers/markdown_util.py @@ -22,7 +22,6 @@ from datetime import datetime from typing import ( Any, - cast, Dict, List, Match, @@ -98,7 +97,7 @@ def _remap(container, line): if id_match := re.search(ENCODED_ID_PATTERN, line): object_id = id_match.group(2) decoded_id = trans.security.decode_id(object_id) - line = line.replace(id_match.group(), "%s=%d" % (id_match.group(1), decoded_id)) + line = line.replace(id_match.group(), "{0}={1}".format(id_match.group(1), decoded_id)) return (line, False) def _remap_embed_container(match): @@ -108,7 +107,7 @@ def _remap_embed_container(match): if id_match := re.search(ENCODED_ID_PATTERN, whole_match): object_id = id_match.group(2) decoded_id = trans.security.decode_id(object_id) - whole_match = whole_match.replace(id_match.group(), "%s=%d" % (id_match.group(1), decoded_id)) + whole_match = whole_match.replace(id_match.group(), "{0}={1:d}".format(id_match.group(1), decoded_id)) return whole_match @@ -249,7 +248,6 @@ def _remap_container(container, line): def _remap_embed_container(match): container = match.group("container") - valid_args_raw = VALID_ARGUMENTS[container] object_id: Optional[int] = None encoded_id: Optional[str] = None diff --git a/test/unit/app/managers/test_markdown_export.py b/test/unit/app/managers/test_markdown_export.py index 11b0d586b435..c8836d761242 100644 --- a/test/unit/app/managers/test_markdown_export.py +++ b/test/unit/app/managers/test_markdown_export.py @@ -339,7 +339,7 @@ def test_ready_dataset_display(self): ``` """ with self._expect_get_hda(hda): - export_markdown, extra_data = self._ready_export(example) + _, export_markdown, extra_data = self._ready_export(example) assert "history_datasets" in extra_data assert len(extra_data["history_datasets"]) == 1 @@ -357,7 +357,7 @@ def test_ready_export_two_datasets(self): ``` """ self.app.hda_manager.get_accessible.side_effect = [hda, hda2] - export_markdown, extra_data = self._ready_export(example) + _, export_markdown, extra_data = self._ready_export(example) assert "history_datasets" in extra_data assert len(extra_data["history_datasets"]) == 2 @@ -379,7 +379,7 @@ def test_export_dataset_collection_paired(self): from galaxy.managers.hdcas import HDCASerializer with mock.patch.object(HDCASerializer, "url_for", return_value="http://google.com"): - export, extra_data = self._ready_export(example) + _, export, extra_data = self._ready_export(example) assert "history_dataset_collections" in extra_data assert len(extra_data.get("history_dataset_collections")) == 1 @@ -389,7 +389,7 @@ def test_galaxy_version(self): generate_galaxy_version() ``` """ - result, extra_data = self._ready_export(example) + _, result, extra_data = self._ready_export(example) assert "generate_version" in extra_data assert extra_data["generate_version"] == "19.09" @@ -399,7 +399,7 @@ def test_generate_time(self): generate_time() ``` """ - result, extra_data = self._ready_export(example) + _, result, extra_data = self._ready_export(example) assert "generate_time" in extra_data def test_get_invocation_time(self): @@ -410,7 +410,7 @@ def test_get_invocation_time(self): invocation_time(invocation_id=1) ``` """ - result, extra_data = self._ready_export(example) + _, result, extra_data = self._ready_export(example) assert "invocations" in extra_data assert "create_time" in extra_data["invocations"]["be8be0fd2ce547f6"] assert extra_data["invocations"]["be8be0fd2ce547f6"]["create_time"] == invocation.create_time.strftime( @@ -427,7 +427,7 @@ def test_export_replaces_embedded_history_dataset_type(self): I ran a cool analysis with two inputs of types ${galaxy history_dataset_type(history_dataset_id=1)} and ${galaxy history_dataset_type(history_dataset_id=2)}. """ self.app.hda_manager.get_accessible.side_effect = [hda, hda2] # type: ignore[attr-defined,union-attr] - export_markdown, _ = self._ready_export(example) + _, export_markdown, _ = self._ready_export(example) assert ( export_markdown == """ @@ -445,7 +445,7 @@ def test_export_replaces_embedded_history_dataset_name(self): I ran a cool analysis with two inputs of types ${galaxy history_dataset_name(history_dataset_id=1)} and ${galaxy history_dataset_name(history_dataset_id=2)}. """ self.app.hda_manager.get_accessible.side_effect = [hda, hda2] # type: ignore[attr-defined,union-attr] - export_markdown, _ = self._ready_export(example) + _, export_markdown, _ = self._ready_export(example) assert ( export_markdown == """ @@ -457,7 +457,7 @@ def test_export_replaces_embedded_generate_time(self): example = """ I ran a cool analysis at ${galaxy generate_time()}. """ - export_markdown, _ = self._ready_export(example) + _, export_markdown, _ = self._ready_export(example) assert export_markdown.startswith( """ I ran a cool analysis at 2""" @@ -469,7 +469,7 @@ def test_export_replaces_embedded_invocation_time(self): example = """ I ran a cool analysis at ${galaxy invocation_time(invocation_id=1)}. """ - export_markdown, _ = self._ready_export(example) + _, export_markdown, _ = self._ready_export(example) assert export_markdown.startswith( """ I ran a cool analysis at 2""" @@ -479,7 +479,7 @@ def test_export_replaces_embedded_galaxy_version(self): example = """ I ran a cool analysis with Galaxy ${galaxy generate_galaxy_version()}. """ - export_markdown, _ = self._ready_export(example) + _, export_markdown, _ = self._ready_export(example) assert ( export_markdown == f""" @@ -492,7 +492,7 @@ def test_export_replaces_embedded_access_link(self): example = """ I ran a cool analysis at ${galaxy instance_access_link()}. """ - export_markdown, _ = self._ready_export(example) + _, export_markdown, _ = self._ready_export(example) assert ( export_markdown == f"""