##// END OF EJS Templates
Remove PY3 variable
Srinivas Reddy Thatiparthy -
Show More
@@ -36,7 +36,7 b' from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic,'
36 36 line_cell_magic, on_off, needs_local_scope)
37 37 from IPython.testing.skipdoctest import skip_doctest
38 38 from IPython.utils import py3compat
39 from IPython.utils.py3compat import builtin_mod, PY3
39 from IPython.utils.py3compat import builtin_mod
40 40 from IPython.utils.contexts import preserve_keys
41 41 from IPython.utils.capture import capture_output
42 42 from IPython.utils.ipstruct import Struct
@@ -45,11 +45,8 b' from IPython.utils.path import get_py_filename, shellglob'
45 45 from IPython.utils.timing import clock, clock2
46 46 from warnings import warn
47 47 from logging import error
48 from io import StringIO
48 49
49 if PY3:
50 from io import StringIO
51 else:
52 from StringIO import StringIO
53 50
54 51 #-----------------------------------------------------------------------------
55 52 # Magic implementation classes
@@ -652,9 +649,6 b' python-profiler package from non-free.""")'
652 649 args = shellglob(map(os.path.expanduser, arg_lst[1:]))
653 650
654 651 sys.argv = [filename] + args # put in the proper filename
655 # protect sys.argv from potential unicode strings on Python 2:
656 if not py3compat.PY3:
657 sys.argv = [ py3compat.cast_bytes(a) for a in sys.argv ]
658 652
659 653 if 'i' in opts:
660 654 # Run in user's interactive namespace
@@ -28,10 +28,7 b' tests = ['
28 28 ('??%%hist4', ('', '??', '%%hist4', '')),
29 29 ('?x*', ('', '?', 'x*', '')),
30 30 ]
31 if py3compat.PY3:
32 tests.append((u"Pérez Fernando", (u'', u'', u'Pérez', u'Fernando')))
33 else:
34 tests.append((u"Pérez Fernando", (u'', u'', u'P', u'érez Fernando')))
31 tests.append((u"Pérez Fernando", (u'', u'', u'Pérez', u'Fernando')))
35 32
36 33 def test_split_user_input():
37 34 return tt.check_pairs(split_user_input, tests)
@@ -299,7 +299,10 b' def getargs(co):'
299 299
300 300 # Monkeypatch inspect to apply our bugfix.
301 301 def with_patch_inspect(f):
302 """decorator for monkeypatching inspect.findsource"""
302 """
303 Deprecated since IPython 6.0
304 decorator for monkeypatching inspect.findsource
305 """
303 306
304 307 def wrapped(*args, **kwargs):
305 308 save_findsource = inspect.findsource
@@ -315,16 +318,6 b' def with_patch_inspect(f):'
315 318 return wrapped
316 319
317 320
318 if py3compat.PY3:
319 fixed_getargvalues = inspect.getargvalues
320 else:
321 # Fixes for https://github.com/ipython/ipython/issues/8293
322 # and https://github.com/ipython/ipython/issues/8205.
323 # The relevant bug is caused by failure to correctly handle anonymous tuple
324 # unpacking, which only exists in Python 2.
325 fixed_getargvalues = with_patch_inspect(inspect.getargvalues)
326
327
328 321 def fix_frame_records_filenames(records):
329 322 """Try to fix the filenames in each record from inspect.getinnerframes().
330 323
@@ -879,7 +872,7 b' class VerboseTB(TBTools):'
879 872
880 873 file = py3compat.cast_unicode(file, util_path.fs_encoding)
881 874 link = tpl_link % file
882 args, varargs, varkw, locals = fixed_getargvalues(frame)
875 args, varargs, varkw, locals = inspect.getargvalues(frame)
883 876
884 877 if func == '?':
885 878 call = ''
@@ -10,8 +10,6 b' not to be used outside IPython.'
10 10 import unicodedata
11 11 from wcwidth import wcwidth
12 12
13 from IPython.utils.py3compat import PY3
14
15 13 from IPython.core.completer import IPCompleter
16 14 from prompt_toolkit.completion import Completer, Completion
17 15 from prompt_toolkit.layout.lexers import Lexer
@@ -78,7 +76,7 b' class IPythonPTLexer(Lexer):'
78 76 """
79 77 def __init__(self):
80 78 l = pygments_lexers
81 self.python_lexer = PygmentsLexer(l.Python3Lexer if PY3 else l.PythonLexer)
79 self.python_lexer = PygmentsLexer(l.Python3Lexer)
82 80 self.shell_lexer = PygmentsLexer(l.BashLexer)
83 81
84 82 self.magic_lexers = {
@@ -9,6 +9,7 b' import io as stdlib_io'
9 9 import os.path
10 10 import stat
11 11 import sys
12 from io import StringIO
12 13
13 14 from subprocess import Popen, PIPE
14 15 import unittest
@@ -17,14 +18,9 b' import nose.tools as nt'
17 18
18 19 from IPython.testing.decorators import skipif, skip_win32
19 20 from IPython.utils.io import Tee, capture_output
20 from IPython.utils.py3compat import doctest_refactor_print, PY3
21 from IPython.utils.py3compat import doctest_refactor_print
21 22 from IPython.utils.tempdir import TemporaryDirectory
22 23
23 if PY3:
24 from io import StringIO
25 else:
26 from StringIO import StringIO
27
28 24
29 25 def test_tee_simple():
30 26 "Very simple check with stdout only"
General Comments 0
You need to be logged in to leave comments. Login now