Skip to content

Commit 99a274d

Browse files
committed
RFC: cleanup some unneeded legacy imports
1 parent b2a7562 commit 99a274d

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

setupext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
import shutil
77
import subprocess
88
import sys
9+
import sysconfig
910
import tempfile
1011
from textwrap import dedent
1112
from concurrent.futures import ThreadPoolExecutor
12-
from distutils import sysconfig
13+
1314
from distutils.ccompiler import CCompiler, new_compiler
1415
from distutils.sysconfig import customize_compiler
1516
from subprocess import PIPE, Popen

yt/funcs.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ def insert_ipython(num_up=1):
274274
"""
275275
import IPython
276276
from IPython.terminal.embed import InteractiveShellEmbed
277-
278-
try:
279-
from traitlets.config.loader import Config
280-
except ImportError:
281-
from IPython.config.loader import Config
277+
from traitlets.config.loader import Config
282278

283279
frame = inspect.stack()[num_up]
284280
loc = frame[0].f_locals.copy()

yt/utilities/command_line.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ def __call__(self, args):
687687
print("Could not load file.")
688688
sys.exit()
689689
import IPython
690+
from traitlets.config.loader import Config
690691

691692
import yt
692693

@@ -695,11 +696,6 @@ def __call__(self, args):
695696
local_ns["pf"] = args.ds
696697
local_ns["yt"] = yt
697698

698-
try:
699-
from traitlets.config.loader import Config
700-
except ImportError:
701-
from IPython.config.loader import Config
702-
703699
cfg = Config()
704700
# prepend sys.path with current working directory
705701
sys.path.insert(0, "")

yt/visualization/fits_image.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,14 +655,10 @@ def to_glue(self, label="yt", data_collection=None):
655655
add a *label*. If you are already within the Glue environment, you
656656
can pass a *data_collection* object, otherwise Glue will be started.
657657
"""
658+
from glue.app.qt.application import GlueApplication
658659
from glue.core import Data, DataCollection
659660
from glue.core.coordinates import coordinates_from_header
660661

661-
try:
662-
from glue.app.qt.application import GlueApplication
663-
except ImportError:
664-
from glue.qt.glue_application import GlueApplication
665-
666662
image = Data(label=label)
667663
image.coords = coordinates_from_header(self.wcs.to_header())
668664
for k in self.fields:

0 commit comments

Comments
 (0)