Skip to content

Commit

Permalink
mypy fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Aug 11, 2024
1 parent 477a1a1 commit b3a12b9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/tool_util/parameters/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def to_dict(self):
}


def legacy_from_string(parameter: ToolParameterT, value: str, warnings: List[str], profile: str) -> Any:
def legacy_from_string(parameter: ToolParameterT, value: Optional[Any], warnings: List[str], profile: str) -> Any:
"""Convert string values in XML test cases into typed variants.
This should only be used when parsing XML test cases into a TestCaseToolState object.
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_case_state(
warnings: List[str] = []
inputs: ToolSourceTestInputs = test_dict["inputs"]
unhandled_inputs = []
state = {}
state: Dict[str, Any] = {}

handled_inputs = _merge_level_into_state(tool_parameter_bundle, inputs, state, profile, warnings, None)

Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/tool_util/parameters/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _from_input_source_galaxy(input_source: InputSource) -> ToolParameterT:
Union[BooleanParameterModel, SelectParameterModel], _from_input_source_galaxy(test_param_input_source)
)
whens = []
default_value = cond_test_parameter_default_value(test_parameter)
default_test_value = cond_test_parameter_default_value(test_parameter)
for value, case_inputs_sources in input_source.parse_when_input_sources():
if isinstance(test_parameter, BooleanParameterModel):
# TODO: investigate truevalue/falsevalue when...
Expand All @@ -221,7 +221,7 @@ def _from_input_source_galaxy(input_source: InputSource) -> ToolParameterT:

tool_parameter_models = input_models_for_page(case_inputs_sources)
is_default_when = False
if typed_value == default_value:
if typed_value == default_test_value:
is_default_when = True
whens.append(
ConditionalWhen(discriminator=value, parameters=tool_parameter_models, is_default_when=is_default_when)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def arg_parser() -> argparse.ArgumentParser:
@dataclass
class ToolTestValidationResults:
tool_id: str
tool_version: str
tool_version: Optional[str]
tool_profile: str
tool_path: str
results: List[TestCaseStateValidationResult]
Expand Down Expand Up @@ -103,7 +103,7 @@ def validate_tool(tool_path, latest) -> ToolTestValidationResults:
load_error = e
results = []
return ToolTestValidationResults(
tool_source.parse_id(),
tool_id,
tool_source.parse_version(),
tool_source.parse_profile(),
tool_path,
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/verify/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _description_from_tool_source(
return ToolTestDescription.from_tool_source_dict(processed_test_dict)


def _tool_id_and_version(tool_source: ToolSource, tool_guid: Optional[str]) -> Tuple[str, Optional[str]]:
def _tool_id_and_version(tool_source: ToolSource, tool_guid: Optional[str]) -> Tuple[str, str]:
tool_id = tool_guid or tool_source.parse_id()
assert tool_id
tool_version = parse_tool_version_with_defaults(tool_id, tool_source)
Expand Down
3 changes: 2 additions & 1 deletion test/unit/tool_util/test_parameter_test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from galaxy.tool_util.parameters.case import (
test_case_state as case_state,
validate_test_cases_for_tool_source,
TestCaseStateValidationResult,
)
from galaxy.tool_util.parser.factory import get_tool_source
from galaxy.tool_util.parser.interface import ToolSourceTest
Expand Down Expand Up @@ -119,7 +120,7 @@ def _validate_path(tool_path: str):
assert tool_state.state_representation == "test_case_xml"


def validate_test_cases_for(tool_name: str, **kwd) -> List[List[str]]:
def validate_test_cases_for(tool_name: str, **kwd) -> List[TestCaseStateValidationResult]:
test_tool_directory = functional_test_tool_directory()
tool_path = os.path.join(test_tool_directory, f"{tool_name}.xml")
tool_source = get_tool_source(tool_path)
Expand Down

0 comments on commit b3a12b9

Please sign in to comment.