chore: fix pylint-2.7 errors (#33233)

This commit is contained in:
David Sanders 2022-03-20 19:11:21 -07:00 committed by GitHub
parent fdb60240f3
commit 45e2f86fe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 30 additions and 32 deletions

View file

@ -31,8 +31,8 @@ verbose_mode = False
def get_platform_key():
if 'MAS_BUILD' in os.environ:
return 'mas'
else:
return PLATFORM
return PLATFORM
def get_target_arch():

View file

@ -233,8 +233,8 @@ def to_utf8(patch):
"""Python 2/3 compatibility: unicode has been renamed to str in Python3"""
if sys.version_info[0] >= 3:
return str(patch, "utf-8")
else:
return unicode(patch, "utf-8")
return unicode(patch, "utf-8")
def export_patches(repo, out_dir, patch_range=None, dry_run=False):
@ -268,7 +268,7 @@ def export_patches(repo, out_dir, patch_range=None, dry_run=False):
out_dir, len(bad_patches), "\n-- ".join(bad_patches)
)
)
exit(1)
sys.exit(1)
else:
# Remove old patches so that deleted commits are correctly reflected in the
# patch files (as a removed file)
@ -291,4 +291,3 @@ def export_patches(repo, out_dir, patch_range=None, dry_run=False):
) as f:
f.write(formatted_patch.encode('utf-8'))
pl.write(filename + '\n')

View file

@ -69,7 +69,8 @@ class Platform:
if platform in ('cygwin', 'win32'):
return Platform.WINDOWS
assert False, "unexpected current platform '{}'".format(platform)
raise AssertionError(
"unexpected current platform '{}'".format(platform))
@staticmethod
def get_all():
@ -155,7 +156,7 @@ class TestsList():
if isinstance(value, basestring):
return {value: None}
assert False, "unexpected shorthand type: {}".format(type(value))
raise AssertionError("unexpected shorthand type: {}".format(type(value)))
@staticmethod
def __make_a_list(value):
@ -174,7 +175,8 @@ class TestsList():
# It looks ugly as hell, but it does the job.
return [list_item for key in value for list_item in value[key]]
assert False, "unexpected type for list merging: {}".format(type(value))
raise AssertionError(
"unexpected type for list merging: {}".format(type(value)))
def __platform_supports(self, binary_name):
return Platform.get_current() in self.tests[binary_name]['platforms']

View file

@ -186,9 +186,9 @@ def get_electron_exec():
if sys.platform == 'darwin':
return '{0}/Electron.app/Contents/MacOS/Electron'.format(out_dir)
elif sys.platform == 'win32':
if sys.platform == 'win32':
return '{0}/electron.exe'.format(out_dir)
elif sys.platform == 'linux':
if sys.platform == 'linux':
return '{0}/electron'.format(out_dir)
raise Exception(