From baad701249c1f044498c31fa5007b1bcb12dfdaf Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 11 Jul 2024 14:22:12 -0400 Subject: [PATCH] Cleanup based on PR review. --- doc/source/dev/tool_state.md | 0 lib/galaxy/tool_util/parameters/_types.py | 16 ++++------------ lib/galaxy/tool_util/parameters/factory.py | 4 +--- lib/galaxy/tool_util/parameters/models.py | 1 - 4 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 doc/source/dev/tool_state.md diff --git a/doc/source/dev/tool_state.md b/doc/source/dev/tool_state.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/lib/galaxy/tool_util/parameters/_types.py b/lib/galaxy/tool_util/parameters/_types.py index 59d42279df72..682b26bb22ea 100644 --- a/lib/galaxy/tool_util/parameters/_types.py +++ b/lib/galaxy/tool_util/parameters/_types.py @@ -16,18 +16,10 @@ ) # https://stackoverflow.com/questions/56832881/check-if-a-field-is-typing-optional -# Python >= 3.8 -try: - from typing import get_args # type: ignore[attr-defined,unused-ignore] - from typing import get_origin # type: ignore[attr-defined,unused-ignore] -# Compatibility -except ImportError: - - def get_args(tp: Any) -> tuple: - return getattr(tp, "__args__", ()) if tp is not Generic else Generic # type: ignore[return-value,assignment,unused-ignore] - - def get_origin(tp: Any) -> Optional[Any]: # type: ignore[no-redef,unused-ignore] - return getattr(tp, "__origin__", None) +from typing_extensions import ( + get_args, + get_origin, +) def optional_if_needed(type: Type, is_optional: bool) -> Type: diff --git a/lib/galaxy/tool_util/parameters/factory.py b/lib/galaxy/tool_util/parameters/factory.py index 072e98328309..0b28e7da3288 100644 --- a/lib/galaxy/tool_util/parameters/factory.py +++ b/lib/galaxy/tool_util/parameters/factory.py @@ -12,6 +12,7 @@ PagesSource, ToolSource, ) +from galaxy.util import string_as_bool from .models import ( BooleanParameterModel, ColorParameterModel, @@ -156,8 +157,6 @@ def _from_input_source_galaxy(input_source: InputSource) -> ToolParameterT: for value, case_inputs_sources in input_source.parse_when_input_sources(): if isinstance(test_parameter, BooleanParameterModel): # TODO: investigate truevalue/falsevalue when... - from galaxy.util import string_as_bool - typed_value = string_as_bool(value) else: typed_value = value @@ -175,7 +174,6 @@ def _from_input_source_galaxy(input_source: InputSource) -> ToolParameterT: whens=whens, ) elif input_type == "repeat": - # TODO: min/max name = input_source.get("name") # title = input_source.get("title") # help = input_source.get("help", None) diff --git a/lib/galaxy/tool_util/parameters/models.py b/lib/galaxy/tool_util/parameters/models.py index d81e6256bddb..49635c4e7187 100644 --- a/lib/galaxy/tool_util/parameters/models.py +++ b/lib/galaxy/tool_util/parameters/models.py @@ -140,7 +140,6 @@ class BaseGalaxyToolParameterModelDefinition(BaseToolParameterModelDefinition): label: Optional[str] = None help: Optional[str] = None argument: Optional[str] = None - refresh_on_change: bool = False is_dynamic: bool = False optional: bool = False