diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index ebb8dca..0d0b71e 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -361,10 +361,8 @@ class Pdb(OldPdb): print("Context must be a positive integer", file=self.stdout) except (TypeError, ValueError): print("Context must be a positive integer", file=self.stdout) - try: - import reprlib # Py 3 - except ImportError: - import repr as reprlib # Py 2 + + import reprlib ret = [] diff --git a/IPython/core/tests/test_debugger.py b/IPython/core/tests/test_debugger.py index dcfd9a4..665d8f8 100644 --- a/IPython/core/tests/test_debugger.py +++ b/IPython/core/tests/test_debugger.py @@ -48,10 +48,7 @@ class PdbTestInput(object): #----------------------------------------------------------------------------- def test_longer_repr(): - try: - from reprlib import repr as trepr # Py 3 - except ImportError: - from repr import repr as trepr # Py 2 + from reprlib import repr as trepr a = '1234567890'* 7 ar = "'1234567890123456789012345678901234567890123456789012345678901234567890'" diff --git a/IPython/lib/display.py b/IPython/lib/display.py index de31788..d24f455 100644 --- a/IPython/lib/display.py +++ b/IPython/lib/display.py @@ -266,10 +266,7 @@ class IFrame(object): def _repr_html_(self): """return the embed iframe""" if self.params: - try: - from urllib.parse import urlencode # Py 3 - except ImportError: - from urllib import urlencode + from urllib.parse import urlencode params = "?" + urlencode(self.params) else: params = "" diff --git a/IPython/lib/inputhook.py b/IPython/lib/inputhook.py index e6e8f2d..62f840d 100644 --- a/IPython/lib/inputhook.py +++ b/IPython/lib/inputhook.py @@ -509,10 +509,7 @@ class TkInputHook(InputHookBase): warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", DeprecationWarning, stacklevel=2) if app is None: - try: - from tkinter import Tk # Py 3 - except ImportError: - from Tkinter import Tk # Py 2 + from tkinter import Tk app = Tk() app.withdraw() self.manager.apps[GUI_TK] = app