Skip to content

Commit

Permalink
Lint fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Oct 31, 2024
1 parent 2ff825c commit 9558b2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
6 changes: 2 additions & 4 deletions lib/galaxy/managers/markdown_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from datetime import datetime
from typing import (
Any,
cast,
Dict,
List,
Match,
Expand Down Expand Up @@ -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):
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down
24 changes: 12 additions & 12 deletions test/unit/app/managers/test_markdown_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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"

Expand All @@ -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):
Expand All @@ -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(
Expand All @@ -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
== """
Expand All @@ -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
== """
Expand All @@ -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"""
Expand All @@ -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"""
Expand All @@ -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"""
Expand All @@ -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"""
Expand Down

0 comments on commit 9558b2a

Please sign in to comment.