Skip to content

Commit

Permalink
types: Correctly handle types for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob-Stevens-Haas committed Feb 29, 2024
1 parent ec7ae48 commit 5743661
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mitosis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from types import MethodType
from types import ModuleType
from typing import Any
from typing import cast
from typing import Collection
from typing import Hashable
from typing import List
Expand All @@ -28,10 +29,10 @@

import dill # type: ignore
import git
import nbclient.exceptions
import nbformat
import pandas as pd
import sqlalchemy as sql
from nbclient.exceptions import CellExecutionError
from nbconvert.exporters import HTMLExporter
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.writers.files import FilesWriter
Expand Down Expand Up @@ -497,9 +498,9 @@ def _run_in_notebook(
exception = None
metrics = None
if debug:
allowed = ()
allowed = cast(tuple[type[Exception], ...], ())
else:
allowed = (nbclient.exceptions.CellExecutionError,)
allowed = (CellExecutionError,)
try:
ep.preprocess(nb, {"metadata": {"path": trials_folder}})
metrics = nb["cells"][-1]["outputs"][0]["text"][:-1]
Expand Down

0 comments on commit 5743661

Please sign in to comment.