Skip to content

Commit d7c385c

Browse files
committed
Move conditional import.
1 parent 997beb9 commit d7c385c

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/BioSimSpace/FreeEnergy/_relative.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@
4848
from .. import _is_notebook
4949
from .._Exceptions import MissingSoftwareError as _MissingSoftwareError
5050

51-
if _is_notebook:
52-
from IPython.display import FileLink as _FileLink
53-
5451
# Check that the analyse_freenrg script exists.
5552
if _sys.platform != "win32":
5653
_analyse_freenrg = _os.path.join(_getBinDir(), "analyse_freenrg")
@@ -332,8 +329,6 @@ def getData(self, name="data", file_link=False, work_dir=None):
332329
import pathlib as _pathlib
333330
import zipfile as _zipfile
334331

335-
from IPython.display import FileLink as _FileLink
336-
337332
from .._Utils import cd as _cd
338333

339334
if self._work_dir is None:
@@ -377,6 +372,8 @@ def getData(self, name="data", file_link=False, work_dir=None):
377372
# Return a link to the archive.
378373
if _is_notebook:
379374
if file_link:
375+
from IPython.display import FileLink as _FileLink
376+
380377
# Create a FileLink to the archive.
381378
f_link = _FileLink(zipname)
382379

src/BioSimSpace/Sandpit/Exscientia/FreeEnergy/_alchemical_free_energy.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
from .. import _is_notebook
4343
from .._Exceptions import MissingSoftwareError as _MissingSoftwareError
4444

45-
if _is_notebook:
46-
from IPython.display import FileLink as _FileLink
47-
4845
# Check that the analyse_freenrg script exists.
4946
if _sys.platform != "win32":
5047
_analyse_freenrg = _os.path.join(_getBinDir(), "analyse_freenrg")
@@ -441,8 +438,6 @@ def getData(self, name="data", file_link=False, work_dir=None):
441438
import zipfile as _zipfile
442439
from glob import glob as _glob
443440

444-
from IPython.display import FileLink as _FileLink
445-
446441
from .._Utils import cd as _cd
447442

448443
if self._work_dir is None:
@@ -485,6 +480,8 @@ def getData(self, name="data", file_link=False, work_dir=None):
485480
# Return a link to the archive.
486481
if _is_notebook:
487482
if file_link:
483+
from IPython.display import FileLink as _FileLink
484+
488485
# Create a FileLink to the archive.
489486
f_link = _FileLink(zipname)
490487

0 commit comments

Comments
 (0)