Skip to content

Commit

Permalink
Minor clean-up of env detection.
Browse files Browse the repository at this point in the history
Moved exceptions catch into one line.
  • Loading branch information
nopdive committed Nov 11, 2024
1 parent 2c47707 commit 11c60b1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions guidance/visual/_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ def _detect_ipython(flags: EnvFlags) -> bool:
try:
from IPython import get_ipython
found = get_ipython() is not None
except NameError: # pragma: no cover
pass
except ImportError: # pragma: no cover
except (NameError, ImportError): # pragma: no cover
pass
return found

Expand All @@ -131,9 +129,7 @@ def _detect_ipython_zmq(flags: EnvFlags) -> bool:
found = False # Terminal running IPython
else:
found = False # Other type (?)
except NameError: # pragma: no cover
found = False # Probably standard Python interpreter
except ImportError: # pragma: no cover
except (NameError, ImportError): # pragma: no cover
found = False # Probably standard Python interpreter

flags.is_notebook |= found
Expand Down

0 comments on commit 11c60b1

Please sign in to comment.