Improve flow for multiple checks

This commit is contained in:
Adriane Boyd 2023-11-08 21:36:52 +01:00 committed by GitHub
parent 75106927d2
commit 0070daf3c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1089,14 +1089,14 @@ def is_in_jupyter() -> bool:
if get_ipython().__class__.__module__ == "google.colab._shell": # type: ignore[name-defined] if get_ipython().__class__.__module__ == "google.colab._shell": # type: ignore[name-defined]
return True # Colab notebook return True # Colab notebook
except NameError: except NameError:
return False # Probably standard Python interpreter pass # Probably standard Python interpreter
# additional check for Colab # additional check for Colab
try: try:
import google.colab import google.colab
return True # Colab notebook return True # Colab notebook
except ImportError: except ImportError:
return False pass
return False return False