File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 2323 "outputs" : [],
2424 "source" : [
2525 " # Setup to enable running the notebook in the Google Colab environment\n " ,
26- " import pathlib\n " ,
2726 " \n " ,
28- " def _in_colab() -> bool:\n " ,
29- " try:\n " ,
30- " import google.colab # noqa: F401\n " ,
31- " return True\n " ,
32- " except Exception:\n " ,
33- " return False\n " ,
27+ " try:\n " ,
28+ " import google.colab # noqa: F401\n " ,
29+ " import pathlib\n " ,
3430 " \n " ,
35- " if _in_colab():\n " ,
3631 " repo_dir = pathlib.Path(\" SimpleITK-Notebooks\" )\n " ,
3732 " if not repo_dir.exists():\n " ,
3833 " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n " ,
3934 " %cd SimpleITK-Notebooks/Python\n " ,
40- " !pip install -q -r requirements.txt\n "
35+ " !pip install -q -r requirements.txt\n " ,
36+ " \n " ,
37+ " except ImportError:\n " ,
38+ " pass # not on Colab\n "
4139 ]
4240 },
4341 {
You can’t perform that action at this time.
0 commit comments