From 62ae16e70bf423ec8a4419b6a1c4e8bd3a727e07 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 25 Nov 2024 15:04:47 +0100 Subject: [PATCH 1/2] fix mulled_hash --- lib/galaxy/tool_util/deps/mulled/mulled_hash.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index 3b4766c61648..eca1da8536f4 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -36,8 +36,7 @@ def main(argv=None): ) parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2") args = parser.parse_args() - targets = target_str_to_targets(args.targets) - print(_mulled_hash(args.hash, targets)) + print(_mulled_hash(args.hash, args.targets)) __all__ = ("main",) From 7e90bcb1eeaf49361013a5d18bd4b5a980d7ed83 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Mon, 25 Nov 2024 15:13:58 +0000 Subject: [PATCH 2/2] Add type annotations --- lib/galaxy/tool_util/deps/mulled/mulled_hash.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index eca1da8536f4..1cd87d5a3d09 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -7,6 +7,7 @@ mulled-hash samtools=1.3.1,bedtools=2.22 """ +from typing_extensions import Literal from ._cli import arg_parser from .mulled_build import target_str_to_targets @@ -16,14 +17,14 @@ ) -def _mulled_hash(hash, targets): +def _mulled_hash(hash: Literal["v1", "v2"], targets_str: str): """ - >>> _mulled_hash(hash="v2", targets="samtools=1.3.1,bedtools=2.26.0") + >>> _mulled_hash("v2", "samtools=1.3.1,bedtools=2.26.0") 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' - >>> _mulled_hash(hash="v2", targets="samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0") + >>> _mulled_hash("v2", "samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0") 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' """ - targets = target_str_to_targets(targets) + targets = target_str_to_targets(targets_str) image_name = v2_image_name if hash == "v2" else v1_image_name return image_name(targets)