##// END OF EJS Templates
Apply 2to3 `next` fix....
Bradley M. Froehle -
Show More
@@ -718,10 +718,10 b' class IPCompleter(Completer):'
718 isId = re.compile(r'\w+$').match
718 isId = re.compile(r'\w+$').match
719 while True:
719 while True:
720 try:
720 try:
721 ids.append(iterTokens.next())
721 ids.append(next(iterTokens))
722 if not isId(ids[-1]):
722 if not isId(ids[-1]):
723 ids.pop(); break
723 ids.pop(); break
724 if not iterTokens.next() == '.':
724 if not next(iterTokens) == '.':
725 break
725 break
726 except StopIteration:
726 except StopIteration:
727 break
727 break
@@ -930,7 +930,7 b' class spawnb(object):'
930
930
931 return self
931 return self
932
932
933 def next (self): # File-like object.
933 def __next__ (self): # File-like object.
934
934
935 """This is to support iterators over a file-like object.
935 """This is to support iterators over a file-like object.
936 """
936 """
@@ -940,6 +940,9 b' class spawnb(object):'
940 raise StopIteration
940 raise StopIteration
941 return result
941 return result
942
942
943 if not PY3:
944 next = __next__ # File-like object.
945
943 def readlines (self, sizehint = -1): # File-like object.
946 def readlines (self, sizehint = -1): # File-like object.
944
947
945 """This reads until EOF using readline() and returns a list containing
948 """This reads until EOF using readline() and returns a list containing
@@ -174,7 +174,7 b' class PygmentsHighlighter(QtGui.QSyntaxHighlighter):'
174 def _get_format_from_document(self, token, document):
174 def _get_format_from_document(self, token, document):
175 """ Returns a QTextCharFormat for token by
175 """ Returns a QTextCharFormat for token by
176 """
176 """
177 code, html = self._formatter._format_lines([(token, u'dummy')]).next()
177 code, html = next(self._formatter._format_lines([(token, u'dummy')]))
178 self._document.setHtml(html)
178 self._document.setHtml(html)
179 return QtGui.QTextCursor(self._document).charFormat()
179 return QtGui.QTextCursor(self._document).charFormat()
180
180
@@ -51,7 +51,7 b' class ParametricTestCase(unittest.TestCase):'
51 # Test execution
51 # Test execution
52 ok = False
52 ok = False
53 try:
53 try:
54 testgen.next()
54 next(testgen)
55 ok = True
55 ok = True
56 except StopIteration:
56 except StopIteration:
57 # We stop the loop
57 # We stop the loop
@@ -179,7 +179,7 b' def arg_split(s, posix=False, strict=True):'
179 tokens = []
179 tokens = []
180 while True:
180 while True:
181 try:
181 try:
182 tokens.append(lex.next())
182 tokens.append(next(lex))
183 except StopIteration:
183 except StopIteration:
184 break
184 break
185 except ValueError:
185 except ValueError:
@@ -5,6 +5,7 b' from io import StringIO'
5 from session import extract_header, Message
5 from session import extract_header, Message
6
6
7 from IPython.utils import io, text, encoding
7 from IPython.utils import io, text, encoding
8 from IPython.utils import py3compat
8
9
9 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
10 # Globals
11 # Globals
@@ -54,9 +55,12 b' class OutStream(object):'
54 def isatty(self):
55 def isatty(self):
55 return False
56 return False
56
57
57 def next(self):
58 def __next__(self):
58 raise IOError('Read not supported on a write only stream.')
59 raise IOError('Read not supported on a write only stream.')
59
60
61 if not py3compat.PY3:
62 next = __next__
63
60 def read(self, size=-1):
64 def read(self, size=-1):
61 raise IOError('Read not supported on a write only stream.')
65 raise IOError('Read not supported on a write only stream.')
62
66
@@ -272,6 +272,7 b" if 'setuptools' in sys.modules:"
272 'lib2to3.fixes.fix_except',
272 'lib2to3.fixes.fix_except',
273 'lib2to3.fixes.fix_apply',
273 'lib2to3.fixes.fix_apply',
274 'lib2to3.fixes.fix_repr',
274 'lib2to3.fixes.fix_repr',
275 'lib2to3.fixes.fix_next',
275 ]
276 ]
276 from setuptools.command.build_py import build_py
277 from setuptools.command.build_py import build_py
277 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
278 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
General Comments 0
You need to be logged in to leave comments. Login now