Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47609e6

Browse files
terrdavisCarreau
authored andcommitted
Remove clearly marked python 2 imports.
1 parent 201acc8 commit 47609e6

4 files changed

Lines changed: 5 additions & 16 deletions

File tree

IPython/core/debugger.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,8 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context=None):
361361
print("Context must be a positive integer", file=self.stdout)
362362
except (TypeError, ValueError):
363363
print("Context must be a positive integer", file=self.stdout)
364-
try:
365-
import reprlib # Py 3
366-
except ImportError:
367-
import repr as reprlib # Py 2
364+
365+
import reprlib
368366

369367
ret = []
370368

IPython/core/tests/test_debugger.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ def __exit__(self, *exc):
4848
#-----------------------------------------------------------------------------
4949

5050
def test_longer_repr():
51-
try:
52-
from reprlib import repr as trepr # Py 3
53-
except ImportError:
54-
from repr import repr as trepr # Py 2
51+
from reprlib import repr as trepr
5552

5653
a = '1234567890'* 7
5754
ar = "'1234567890123456789012345678901234567890123456789012345678901234567890'"

IPython/lib/display.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,7 @@ def __init__(self, src, width, height, **kwargs):
266266
def _repr_html_(self):
267267
"""return the embed iframe"""
268268
if self.params:
269-
try:
270-
from urllib.parse import urlencode # Py 3
271-
except ImportError:
272-
from urllib import urlencode
269+
from urllib.parse import urlencode
273270
params = "?" + urlencode(self.params)
274271
else:
275272
params = ""

IPython/lib/inputhook.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,7 @@ def enable(self, app=None):
509509
warn("This function is deprecated since IPython 5.0 and will be removed in future versions.",
510510
DeprecationWarning, stacklevel=2)
511511
if app is None:
512-
try:
513-
from tkinter import Tk # Py 3
514-
except ImportError:
515-
from Tkinter import Tk # Py 2
512+
from tkinter import Tk
516513
app = Tk()
517514
app.withdraw()
518515
self.manager.apps[GUI_TK] = app

0 commit comments

Comments
 (0)