mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Define xrange for use under Python 3
Define xrange() for Python 3. I is only used on for loops so this is safe.
This commit is contained in:
commit
89be4df26d
5
cpplint/cpplint.py
vendored
5
cpplint/cpplint.py
vendored
|
@ -52,6 +52,11 @@ import string
|
||||||
import sys
|
import sys
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
|
try:
|
||||||
|
xrange # Python 2
|
||||||
|
except NameError:
|
||||||
|
xrange = range # Python 3
|
||||||
|
|
||||||
|
|
||||||
_USAGE = """
|
_USAGE = """
|
||||||
Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
|
Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
|
||||||
|
|
|
@ -43,6 +43,11 @@ import unittest
|
||||||
|
|
||||||
import cpplint
|
import cpplint
|
||||||
|
|
||||||
|
try:
|
||||||
|
xrange # Python 2
|
||||||
|
except NameError:
|
||||||
|
xrange = range # Python 3
|
||||||
|
|
||||||
|
|
||||||
# This class works as an error collector and replaces cpplint.Error
|
# This class works as an error collector and replaces cpplint.Error
|
||||||
# function for the unit tests. We also verify each category we see
|
# function for the unit tests. We also verify each category we see
|
||||||
|
|
Loading…
Reference in New Issue
Block a user