[Py3] Fix flake8 warnings

- was missing an import sys
- check for long
- check for xrange

This file is now flake8 warning free, and should work on both Py2 and
Py3.

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

Bug: v8:8594
Change-Id: Iae857f4686bcad509fa700954b7f30f86150739f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2288177
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68809}
This commit is contained in:
Ng Zhi An 2020-07-08 11:52:45 -07:00 committed by Commit Bot
parent 1511d95ea4
commit 0317c53bac

View File

@ -8,6 +8,20 @@ import struct
import subprocess import subprocess
import time import time
import xml.etree.ElementTree import xml.etree.ElementTree
import sys
# Python2 has both int and long, Python3 only has int, which is the same as
# Python2 long.
try:
long
except NameError:
long = int
# Python2 has xrange and range. Python3 range is Python2 xrange.
try:
xrange
except NameError:
xrange = range
SOCKET_ADDR = ('localhost', 8765) SOCKET_ADDR = ('localhost', 8765)