Skip to content

Commit

Permalink
improve typing of lib/galaxy/tools/evaluation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Nov 11, 2021
1 parent 916c4cb commit 0ec8fcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 12 additions & 8 deletions lib/galaxy/tools/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import os
import shlex
import tempfile
from typing import Any, cast, Dict, List

from galaxy import model
from galaxy.files import ProvidesUserFileSourcesUserContext
from galaxy.job_execution.setup import ensure_configs_directory
from galaxy.model.none_like import NoneDataset
from galaxy.security.object_wrapper import wrap_with_safe_string
from galaxy.tools import global_tool_errors
from galaxy.tools import global_tool_errors, Tool
from galaxy.tools.parameters import (
visit_input_values,
wrapped_json,
Expand Down Expand Up @@ -118,7 +119,7 @@ def build_param_dict(self, incoming, input_datasets, output_datasets, output_col
compute_environment = self.compute_environment
job_working_directory = compute_environment.working_directory()

param_dict = dict()
param_dict: Dict[str, Any] = {}

def input():
raise SyntaxError("Unbound variable input.") # Don't let $input hang Python evaluation process.
Expand Down Expand Up @@ -211,11 +212,14 @@ def wrap_input(input_values, input):
else:
# Trick wrapper into using target conv ext (when
# None) without actually being a tool parameter
input_values[conversion_name] = \
DatasetFilenameWrapper(converted_dataset,
datatypes_registry=self.app.datatypes_registry,
tool=Bunch(conversion_name=Bunch(extensions=conv_ext)),
name=conversion_name)
input_values[conversion_name] = DatasetFilenameWrapper(
converted_dataset,
datatypes_registry=self.app.datatypes_registry,
tool=cast(
Tool, Bunch(conversion_name=Bunch(extensions=conv_ext))
),
name=conversion_name,
)
# Wrap actual input dataset
dataset = input_values[input.name]
wrapper_kwds = dict(
Expand Down Expand Up @@ -439,7 +443,7 @@ def build(self):
config templates corresponding to this tool with these inputs on this
compute environment.
"""
self.extra_filenames = []
self.extra_filenames: List[str] = []
self.command_line = None

try:
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,6 @@ check_untyped_defs = False
check_untyped_defs = False
[mypy-galaxy.jobs.mapper]
check_untyped_defs = False
[mypy-galaxy.tools.evaluation]
check_untyped_defs = False
[mypy-galaxy.jobs.runners]
check_untyped_defs = False
[mypy-galaxy.jobs]
Expand Down

0 comments on commit 0ec8fcf

Please sign in to comment.