Skip to content

Commit eff1680

Browse files
authored
Merge branch 'main' into feature/aqua_smoke
2 parents f7f169e + 36712d6 commit eff1680

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

ads/common/ipython.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8; -*-
32

4-
# Copyright (c) 2022 Oracle and/or its affiliates.
3+
# Copyright (c) 2022, 2026 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65

76
import logging
@@ -64,13 +63,13 @@ def configure_plotting():
6463
try:
6564
import IPython
6665

67-
global orig_ipython_traceback
68-
if IPython.core.interactiveshell.InteractiveShell.showtraceback != _log_traceback:
69-
orig_ipython_traceback = (
70-
IPython.core.interactiveshell.InteractiveShell.showtraceback
71-
)
66+
shell = IPython.get_ipython()
67+
if shell is not None:
68+
global orig_ipython_traceback
69+
if shell.showtraceback != _log_traceback:
70+
orig_ipython_traceback = shell.showtraceback
7271

73-
# Override the default showtraceback behavior of ipython, to show only the error message and log the stacktrace
74-
IPython.core.interactiveshell.InteractiveShell.showtraceback = _log_traceback
72+
# Override the default showtraceback behavior of ipython, to show only the error message and log the stacktrace
73+
shell.showtraceback = _log_traceback
7574
except ModuleNotFoundError:
7675
pass

ads/common/model.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,8 @@ def show_in_notebook(self):
633633
"display.precision",
634634
4,
635635
):
636-
from IPython.display import HTML
637-
636+
from IPython.display import HTML, display
638637
from ads.common.utils import get_display
639-
640638
display = get_display()
641639
display(HTML(info_df.to_html(index=False, header=False)))
642640
return info

0 commit comments

Comments
 (0)