chore: bump pylint to 2.17 (#41576)
* build: bump pylint to 2.17
Xref: 5062345
* fix pylint consider-using-f-string warnings pt 1: use flynt for automated fixes
* fix pylint consider-using-f-string warnings pt 2: manual fixes
* fix pylint consider-using-with warnings
* fix pylint line-too-long warnings
* fix pylint unspecified-encoding warnings
* fix py lint consider-using-generator warning
* fixup! fix pylint unspecified-encoding warnings
* fix pylint line-too-long warnings
This commit is contained in:
parent
00da7279cb
commit
61ddb1aa07
25 changed files with 193 additions and 205 deletions
|
@ -35,9 +35,8 @@ def scoped_cwd(path):
|
|||
|
||||
def download(text, url, path):
|
||||
safe_mkdir(os.path.dirname(path))
|
||||
with open(path, 'wb') as local_file:
|
||||
print("Downloading %s to %s" % (url, path))
|
||||
web_file = urlopen(url)
|
||||
with open(path, 'wb') as local_file, urlopen(url) as web_file:
|
||||
print(f"Downloading {url} to {path}")
|
||||
info = web_file.info()
|
||||
if hasattr(info, 'getheader'):
|
||||
file_size = int(info.getheaders("Content-Length")[0])
|
||||
|
@ -58,11 +57,11 @@ def download(text, url, path):
|
|||
|
||||
if not ci:
|
||||
percent = downloaded_size * 100. / file_size
|
||||
status = "\r%s %10d [%3.1f%%]" % (text, downloaded_size, percent)
|
||||
status = f"\r{text} {downloaded_size:10d} [{percent:3.1f}%]"
|
||||
print(status, end=' ')
|
||||
|
||||
if ci:
|
||||
print("%s done." % (text))
|
||||
print(f"{text} done.")
|
||||
else:
|
||||
print()
|
||||
return path
|
||||
|
@ -74,15 +73,16 @@ def make_zip(zip_file_path, files, dirs):
|
|||
allfiles = files + dirs
|
||||
execute(['zip', '-r', '-y', zip_file_path] + allfiles)
|
||||
else:
|
||||
zip_file = zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED,
|
||||
allowZip64=True)
|
||||
for filename in files:
|
||||
zip_file.write(filename, filename)
|
||||
for dirname in dirs:
|
||||
for root, _, filenames in os.walk(dirname):
|
||||
for f in filenames:
|
||||
zip_file.write(os.path.join(root, f))
|
||||
zip_file.close()
|
||||
with zipfile.ZipFile(zip_file_path, "w",
|
||||
zipfile.ZIP_DEFLATED,
|
||||
allowZip64=True) as zip_file:
|
||||
for filename in files:
|
||||
zip_file.write(filename, filename)
|
||||
for dirname in dirs:
|
||||
for root, _, filenames in os.walk(dirname):
|
||||
for f in filenames:
|
||||
zip_file.write(os.path.join(root, f))
|
||||
zip_file.close()
|
||||
|
||||
|
||||
def rm_rf(path):
|
||||
|
@ -128,8 +128,8 @@ def get_electron_branding():
|
|||
SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
|
||||
branding_file_path = os.path.join(
|
||||
SOURCE_ROOT, 'shell', 'app', 'BRANDING.json')
|
||||
with open(branding_file_path) as f:
|
||||
return json.load(f)
|
||||
with open(branding_file_path, encoding='utf-8') as file_in:
|
||||
return json.load(file_in)
|
||||
|
||||
|
||||
cached_electron_version = None
|
||||
|
@ -173,14 +173,14 @@ def get_electron_exec():
|
|||
out_dir = get_out_dir()
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
return '{0}/Electron.app/Contents/MacOS/Electron'.format(out_dir)
|
||||
return f'{out_dir}/Electron.app/Contents/MacOS/Electron'
|
||||
if sys.platform == 'win32':
|
||||
return '{0}/electron.exe'.format(out_dir)
|
||||
return f'{out_dir}/electron.exe'
|
||||
if sys.platform == 'linux':
|
||||
return '{0}/electron'.format(out_dir)
|
||||
return f'{out_dir}/electron'
|
||||
|
||||
raise Exception(
|
||||
"get_electron_exec: unexpected platform '{0}'".format(sys.platform))
|
||||
f"get_electron_exec: unexpected platform '{sys.platform}'")
|
||||
|
||||
def get_buildtools_executable(name):
|
||||
buildtools = os.path.realpath(os.path.join(ELECTRON_DIR, '..', 'buildtools'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue