Skip to content

Commit 8bd3103

Browse files
committed
fix mypy
1 parent 7c4c68e commit 8bd3103

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

onnx_diagnostic/torch_models/test_helper.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,23 @@ def version_summary() -> Dict[str, Union[int, float, str]]:
181181

182182

183183
def _quiet_or_not_quiet(
184-
quiet: bool, suffix: str, summary: Dict[str, Any], data: Dict[str, Any], fct: Callable
184+
quiet: bool,
185+
suffix: str,
186+
summary: Dict[str, Any],
187+
data: Optional[Dict[str, Any]],
188+
fct: Callable,
185189
) -> Any:
186190
begin = time.perf_counter()
187191
if quiet:
188192
try:
189193
return fct()
190194
except Exception as e:
191195
summary[f"ERR_{suffix}"] = str(e)
192-
data[f"ERR_{suffix}"] = e
193196
summary[f"time_{suffix}"] = time.perf_counter() - begin
194-
return summary, {}
197+
if data is None:
198+
return {f"ERR_{suffix}": e}
199+
data[f"ERR_{suffix}"] = e
200+
return None
195201
res = fct()
196202
summary[f"time_{suffix}"] = time.perf_counter() - begin
197203
return res

0 commit comments

Comments
 (0)