Skip to content

Commit

Permalink
Rename get_kernel into get_ipython
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Nov 29, 2018
1 parent 9f1b7d3 commit 024172c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ipywidgets/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .trait_types import Color, Datetime, NumberFormat

from .kernel import register_target, get_kernel, Comm, display, clear_output
from .kernel import register_target, get_ipython, Comm, display, clear_output

from .widget_core import CoreWidget
from .widget_bool import Checkbox, ToggleButton, Valid
Expand Down
4 changes: 2 additions & 2 deletions ipywidgets/widgets/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from . import (ValueWidget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
VBox, Button, DOMWidget, Output, get_kernel, display, clear_output)
VBox, Button, DOMWidget, Output, get_ipython, display, clear_output)
from ipython_genutils.py3compat import string_types, unicode_type
from traitlets import HasTraits, Any, Unicode, observe
from numbers import Real, Integral
Expand Down Expand Up @@ -251,7 +251,7 @@ def update(self, *args):
if self.auto_display and self.result is not None:
display(self.result)
except Exception as e:
ip = get_kernel()
ip = get_ipython()
if ip is None:
self.log.warn("Exception in interact callback: %s", e, exc_info=True)
else:
Expand Down
2 changes: 1 addition & 1 deletion ipywidgets/widgets/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def mock_register(*args, **kwargs):
else:
register_target = mock_register

get_kernel = get_ipython
get_ipython = get_ipython
2 changes: 1 addition & 1 deletion ipywidgets/widgets/tests/test_widget_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestOutputWidget(TestCase):
def _mocked_kernel(self, get_kernel, clear_output):
""" Context manager that monkeypatches get_kernel and clear_output """
original_clear_output = widget_output.clear_output
original_get_kernel = widget_output.get_kernel
original_get_kernel = widget_output.get_ipython
widget_output.get_kernel = get_kernel
widget_output.clear_output = clear_output
try:
Expand Down
6 changes: 3 additions & 3 deletions ipywidgets/widgets/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import collections
import sys

from .kernel import get_kernel, Comm, display
from .kernel import get_ipython, Comm, display
from traitlets.utils.importstring import import_item
from traitlets import (
HasTraits, Unicode, Dict, Instance, List, Int, Set, Bytes, observe, default, Container,
Expand Down Expand Up @@ -182,7 +182,7 @@ def __call__(self, *args, **kwargs):
try:
local_value = callback(*args, **kwargs)
except Exception as e:
ip = get_kernel()
ip = get_ipython()
if ip is None:
self.log.warning("Exception in callback %s: %s", callback, e, exc_info=True)
else:
Expand Down Expand Up @@ -213,7 +213,7 @@ def m(self, *args, **kwargs):
try:
return(method(self, *args, **kwargs))
except Exception as e:
ip = get_kernel()
ip = get_ipython()
if ip is None:
self.log.warning("Exception in widget method %s: %s", method, e, exc_info=True)
else:
Expand Down
6 changes: 3 additions & 3 deletions ipywidgets/widgets/widget_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .domwidget import DOMWidget
from .trait_types import TypedTuple
from .widget import register
from .kernel import get_kernel
from .kernel import get_ipython
from .._version import __jupyter_widgets_output_version__

from traitlets import Unicode, Dict
Expand Down Expand Up @@ -105,13 +105,13 @@ def inner(*args, **kwargs):
def __enter__(self):
"""Called upon entering output widget context manager."""
self._flush()
ip = get_kernel()
ip = get_ipython()
if ip and hasattr(ip, 'kernel') and hasattr(ip.kernel, '_parent_header'):
self.msg_id = ip.kernel._parent_header['header']['msg_id']

def __exit__(self, etype, evalue, tb):
"""Called upon exiting output widget context manager."""
ip = get_kernel()
ip = get_ipython()
if etype is not None:
if ip:
ip.showtraceback((etype, evalue, tb), tb_offset=0)
Expand Down

0 comments on commit 024172c

Please sign in to comment.