Skip to content

Commit

Permalink
Type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Apr 10, 2024
1 parent 2c121c0 commit 93efdd9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions planemo/autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "/"):
Expand Down Expand Up @@ -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_sheds>${tool_shed_lines}</tool_sheds>""")
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'<tool_shed name="{tool_shed_url.split("://")[-1]}" url="{tool_shed_url}" />')
for tool_shed_url in sorted(cleaned_tool_shed_urls, key=lambda url: len(url)):
tool_sheds.append(f'<tool_shed name="{tool_shed_url.split("://")[-1]}" url="{tool_shed_url}" />')
return TOOL_SHEDS_CONF_TEMPLATE.substitute(tool_shed_lines="".join(tool_sheds))


Expand Down

0 comments on commit 93efdd9

Please sign in to comment.