From 24ba3e62d45c7b4a4ff63d9cbbccb0f069aed51c Mon Sep 17 00:00:00 2001 From: John Chilton Date: Fri, 28 Jun 2024 08:22:20 -0400 Subject: [PATCH] Small improvement to typing in metadata_generator. --- .../tool_shed/metadata/metadata_generator.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_shed/metadata/metadata_generator.py b/lib/galaxy/tool_shed/metadata/metadata_generator.py index 4c439ada7a99..90d374bec726 100644 --- a/lib/galaxy/tool_shed/metadata/metadata_generator.py +++ b/lib/galaxy/tool_shed/metadata/metadata_generator.py @@ -12,7 +12,10 @@ Union, ) -from typing_extensions import Protocol +from typing_extensions import ( + Protocol, + TypedDict, +) from galaxy import util from galaxy.model.tool_shed_install import ToolShedRepository @@ -64,6 +67,21 @@ ] +class RepositoryMetadataToolDict(TypedDict): + id: str + guid: str + name: str + version: str + profile: str + description: Optional[str] + version_string_cmd: Optional[str] + tool_config: str + tool_type: str + requirements: Optional[Any] + tests: Optional[Any] + add_to_tool_panel: bool + + class RepositoryProtocol(Protocol): name: str id: str @@ -597,7 +615,7 @@ def generate_tool_metadata(self, tool_config, tool, metadata_dict): # should not be displayed in the tool panel are datatypes converters and DataManager tools # (which are of type 'manage_data'). add_to_tool_panel_attribute = self._set_add_to_tool_panel_attribute_for_tool(tool) - tool_dict = dict( + tool_dict = RepositoryMetadataToolDict( id=tool.id, guid=guid, name=tool.name,