flake8: Suppress "F821 undefined name" inline for Python 2 names

All of the instances of this are related to Python 2 names that
don't exist in Python 3, and the warnings are raised when running
flake8 on Python 3.

All of these will go away once we completely remove support for
Python 2, so just suppress them inline. We don't globally suppress
the check so that we will still see legitimate errors if/when they
occur in new code.

Change-Id: Iccf955f50abfc9f83b371fc0af6cceb51037456f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255039
Tested-by: David Pursehouse <dpursehouse@collab.net>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
David Pursehouse 2020-02-15 12:45:53 +09:00
parent 19a1f22cd0
commit a46bf7dc2a
5 changed files with 6 additions and 6 deletions

View File

@ -69,7 +69,7 @@ from wrapper import WrapperPath, Wrapper
from subcmds import all_commands from subcmds import all_commands
if not is_python3(): if not is_python3():
input = raw_input input = raw_input # noqa: F821
global_options = optparse.OptionParser( global_options = optparse.OptionParser(
usage='repo [-p|--paginate|--no-pager] COMMAND [ARGS]', usage='repo [-p|--paginate|--no-pager] COMMAND [ARGS]',

View File

@ -219,8 +219,8 @@ def _preserve_encoding(source, target):
if is_python3(): if is_python3():
return target return target
if isinstance(source, unicode): if isinstance(source, unicode): # noqa: F821
return unicode(target) return unicode(target) # noqa: F821
return str(target) return str(target)

View File

@ -52,7 +52,7 @@ else:
import urlparse import urlparse
urllib = imp.new_module('urllib') urllib = imp.new_module('urllib')
urllib.parse = urlparse urllib.parse = urlparse
input = raw_input input = raw_input # noqa: F821
def _lwrite(path, content): def _lwrite(path, content):

View File

@ -22,7 +22,7 @@ import platform_utils
from pyversion import is_python3 from pyversion import is_python3
if not is_python3(): if not is_python3():
input = raw_input input = raw_input # noqa: F821
class GitcDelete(Command, GitcClientCommand): class GitcDelete(Command, GitcClientCommand):

View File

@ -27,7 +27,7 @@ from project import RepoHook
from pyversion import is_python3 from pyversion import is_python3
if not is_python3(): if not is_python3():
input = raw_input input = raw_input # noqa: F821
else: else:
unicode = str unicode = str