Merged
Conversation
added 2 commits
March 12, 2018 18:13
flake8 testing of https://github.com/google/styleguide on Python 3.6.3 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./cpplint/cpplint.py:1526:12: F821 undefined name 'xrange' for i in xrange(startpos, len(line)): ^ ./cpplint/cpplint.py:1755:15: F821 undefined name 'xrange' for line in xrange(1, min(len(lines), 11)): ^ ./cpplint/cpplint.py:1957:12: F821 undefined name 'xrange' for i in xrange(1, len(raw_lines) - 1): ^ ./cpplint/cpplint.py:2298:14: F821 undefined name 'xrange' for i in xrange(linenum - 1, self.starting_linenum, -1): ^ ./cpplint/cpplint.py:3080:26: F821 undefined name 'xrange' for start_linenum in xrange(linenum, clean_lines.NumLines()): ^ ./cpplint/cpplint.py:3537:14: F821 undefined name 'xrange' for i in xrange(first_line, last_line + 1, 1): ^ ./cpplint/cpplint.py:3601:19: F821 undefined name 'xrange' for offset in xrange(endlinenum + 1, ^ ./cpplint/cpplint.py:4155:14: F821 undefined name 'xrange' for i in xrange(linenum + 1, end_line): ^ ./cpplint/cpplint.py:4283:23: F821 undefined name 'unicode' if isinstance(line, unicode): ^ ./cpplint/cpplint.py:4928:12: F821 undefined name 'xrange' for i in xrange(linenum, max(-1, linenum - 10), -1): ^ ./cpplint/cpplint.py:4949:12: F821 undefined name 'xrange' for i in xrange(linenum, max(-1, linenum - 10), -1): ^ ./cpplint/cpplint.py:4965:12: F821 undefined name 'xrange' for i in xrange(linenum, 1, -1): ^ ./cpplint/cpplint.py:5066:20: F821 undefined name 'xrange' for i in xrange(startline, linenum + 1): ^ ./cpplint/cpplint.py:5090:14: F821 undefined name 'xrange' for i in xrange(linenum - 1, max(0, linenum - 10), -1): ^ ./cpplint/cpplint.py:5121:14: F821 undefined name 'xrange' for i in xrange(2): ^ ./cpplint/cpplint.py:5284:14: F821 undefined name 'xrange' for i in xrange(linenum - 1, max(0, linenum - 5), -1): ^ ./cpplint/cpplint.py:5503:18: F821 undefined name 'xrange' for linenum in xrange(clean_lines.NumLines()): ^ ./cpplint/cpplint.py:5639:21: F821 undefined name 'xrange' for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())): ^ ./cpplint/cpplint.py:5654:12: F821 undefined name 'xrange' for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())): ^ ./cpplint/cpplint.py:5911:15: F821 undefined name 'xrange' for line in xrange(clean_lines.NumLines()): ^ ```
gpshead
reviewed
Mar 12, 2018
| import sys | ||
| import unicodedata | ||
|
|
||
| try: |
Contributor
There was a problem hiding this comment.
prefer an explicit version check rather than an exception, something like this:
if sys.version_info >= (3,):
xrange = range # xrange is only used on for loops so this is fine.
Contributor
Author
There was a problem hiding this comment.
The Python porting best practice is Use feature detection instead of version detection.
Contributor
|
I won't be picky about this, both work. :) accepting. |
Contributor
Author
|
Cool, thanks. The eventual option would be to just switch the source to use |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
flake8 testing of https://github.com/google/styleguide on Python 3.6.3
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics