Skip to content

Commit

Permalink
Cleanup based on PR review.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Jul 11, 2024
1 parent 13070c3 commit baad701
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
Empty file removed doc/source/dev/tool_state.md
Empty file.
16 changes: 4 additions & 12 deletions lib/galaxy/tool_util/parameters/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions lib/galaxy/tool_util/parameters/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
PagesSource,
ToolSource,
)
from galaxy.util import string_as_bool
from .models import (
BooleanParameterModel,
ColorParameterModel,
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/tool_util/parameters/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit baad701

Please sign in to comment.