From 93efdd97b9be8bea2f0ed6a506b5c8bf95e295e8 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 11 Apr 2024 00:37:11 +0200 Subject: [PATCH] Type fixes --- planemo/autoupdate.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/planemo/autoupdate.py b/planemo/autoupdate.py index 280811ffa..d328268dc 100644 --- a/planemo/autoupdate.py +++ b/planemo/autoupdate.py @@ -328,8 +328,7 @@ def check_tool_step(tool_id: str) -> Dict[str, Dict[str, str]]: base_id = base_tool_id(tool_id) matching_tool_ids = [] # newer toolshed returns list - repos = repos.values() if isinstance(repos, dict) else repos - for repo in repos: + for repo in repos.values(): if isinstance(repo, dict): for tool in repo.get("tools") or []: if tool["guid"].startswith(base_id + "/"): @@ -387,14 +386,13 @@ def get_tools_to_update( def get_shed_tools_conf_string_for_tool_ids(tool_ids: List[str]) -> str: tool_shed_urls = set(get_toolshed_url_for_tool_id(tool_id) for tool_id in tool_ids if tool_id) - tool_shed_urls = [_ for _ in tool_shed_urls if _ is not None] + cleaned_tool_shed_urls = set(_ for _ in tool_shed_urls if _ is not None) TOOL_SHEDS_CONF_TEMPLATE = Template("""${tool_shed_lines}""") tool_sheds: List[str] = [] # sort tool_shed_urls from shortest to longest, as https://github.com/galaxyproject/galaxy/blob/c7cb47a1b18ccd5b39075a705bbd2f34572755fe/lib/galaxy/util/tool_shed/tool_shed_registry.py#L106-L118 # has a bug where a toolshed that is an exact substring of another registered toolshed would wrongly be selected. - for tool_shed_url in sorted(tool_shed_urls, key=lambda url: len(url)): - if tool_shed_url: - tool_sheds.append(f'') + for tool_shed_url in sorted(cleaned_tool_shed_urls, key=lambda url: len(url)): + tool_sheds.append(f'') return TOOL_SHEDS_CONF_TEMPLATE.substitute(tool_shed_lines="".join(tool_sheds))