Skip to content

Commit

Permalink
type updates for mypy 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Nov 13, 2023
1 parent 09b939e commit e711fe1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions cwltool/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
from .cwlprov.provenance_profile import (
ProvenanceProfile, # pylint: disable=unused-import
)

CollectOutputsType = Union[
Callable[[str, int], CWLObjectType], functools.partial[CWLObjectType]
]

needs_shell_quoting_re = re.compile(r"""(^$|[\s|&;()<>\'"$@])""")

FORCE_SHELLED_POPEN = os.getenv("CWLTOOL_FORCE_SHELL_POPEN", "0") == "1"
Expand Down Expand Up @@ -112,9 +117,6 @@ def neverquote(string: str, pos: int = 0, endpos: int = 0) -> Optional[Match[str
return None


CollectOutputsType = Union[Callable[[str, int], CWLObjectType], functools.partial]


class JobBase(HasReqsHints, metaclass=ABCMeta):
def __init__(
self,
Expand Down Expand Up @@ -144,7 +146,7 @@ def __init__(
self.generatemapper: Optional[PathMapper] = None

# set in CommandLineTool.job(i)
self.collect_outputs = cast(CollectOutputsType, None)
self.collect_outputs = cast("CollectOutputsType", None)
self.output_callback: Optional[OutputCallbackType] = None
self.outdir = ""
self.tmpdir = ""
Expand Down
1 change: 0 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ show_column_numbers = true
show_error_codes = true
pretty = true
warn_unreachable = True
new_type_inference = True

[mypy-galaxy.tool_util.*]
ignore_missing_imports = True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_singularity_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def reset_singularity_version_cache() -> None:
def set_dummy_check_output(name: str, version: str) -> None:
"""Mock out subprocess.check_output."""
cwltool.singularity.check_output = ( # type: ignore[attr-defined]
lambda c, text: name + " version " + version
lambda c, text: name + " version " + version # type: ignore[assignment]
)


Expand Down

0 comments on commit e711fe1

Please sign in to comment.