Skip to content

Commit d9d8416

Browse files
committed
fix type errors discovered by mypyc
1 parent ad0a5f3 commit d9d8416

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cwltool/cuda.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
from .loghandler import _logger
77
from .utils import CWLObjectType
8+
from typing import Union
89

910

1011
def cuda_version_and_device_count() -> tuple[str, int]:
1112
"""Determine the CUDA version and number of attached CUDA GPUs."""
1213
try:
13-
out = subprocess.check_output(["nvidia-smi", "-q", "-x"]) # nosec
14+
out: Union[str, bytes] = subprocess.check_output(["nvidia-smi", "-q", "-x"]) # nosec
1415
except Exception as e:
15-
_logger.warning("Error checking CUDA version with nvidia-smi: %s", e)
16+
_logger.warning("Error checking CUDA version with nvidia-smi: %s", e, exc_info=e)
1617
return ("", 0)
1718
dm = xml.dom.minidom.parseString(out) # nosec
1819

@@ -62,5 +63,5 @@ def cuda_check(cuda_req: CWLObjectType, requestCount: int) -> int:
6263
return 0
6364
return requestCount
6465
except Exception as e:
65-
_logger.warning("Error checking CUDA requirements: %s", e)
66+
_logger.warning("Error checking CUDA requirements: %s", e, exc_info=e)
6667
return 0

cwltool/workflow_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def object_from_state(
406406
("merge_nested" if len(connections) > 1 else None),
407407
),
408408
),
409-
valueFrom=cast(str, inp.get("valueFrom")),
409+
valueFrom=cast(Optional[str], inp.get("valueFrom")),
410410
):
411411
raise WorkflowException(
412412
"Type mismatch between source '%s' (%s) and "

0 commit comments

Comments
 (0)