diff options
author | Gregory P. Smith <greg@krypto.org> | 2018-03-12 10:24:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-12 10:24:37 -0700 |
commit | 89be4df26da2a8c50853d2e82ed4b3cc29abc8e2 (patch) | |
tree | 4edad40c0355cf7962f6a760bf6f7b375efa34ba | |
parent | 209d38166b1a56b177de486d894d39ae6822eee6 (diff) | |
parent | 099f059086b4250aa0d2546ea3115aae95597ffd (diff) | |
download | google-styleguide-89be4df26da2a8c50853d2e82ed4b3cc29abc8e2.tar.gz |
Define xrange for use under Python 3
Define xrange() for Python 3. I is only used on for loops so this is safe.
-rwxr-xr-x | cpplint/cpplint.py | 5 | ||||
-rwxr-xr-x | cpplint/cpplint_unittest.py | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index 53dbe81..8e07cab 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -52,6 +52,11 @@ import string import sys import unicodedata +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + _USAGE = """ Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...] diff --git a/cpplint/cpplint_unittest.py b/cpplint/cpplint_unittest.py index 50d1d82..b3c7725 100755 --- a/cpplint/cpplint_unittest.py +++ b/cpplint/cpplint_unittest.py @@ -43,6 +43,11 @@ import unittest import cpplint +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + # This class works as an error collector and replaces cpplint.Error # function for the unit tests. We also verify each category we see |