Skip to content

Commit e44affd

Browse files
Merge pull request #5181 from neutrinoceros/rfc/cleanup_legacy_imports
RFC: cleanup some unneeded legacy imports
2 parents 389e6d1 + 74fda7d commit e44affd

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

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)