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:
Charles Kerr 2024-03-21 08:48:23 -05:00 committed by GitHub
parent 00da7279cb
commit 61ddb1aa07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 193 additions and 205 deletions

View file

@ -77,8 +77,8 @@ def set_mtimes(patches_config, mtime):
mtime_cache[file_path] = mtime
for file_path in mtime_cache:
os.utime(file_path, (mtime_cache[file_path], mtime_cache[file_path]))
for file_path, file_mtime in mtime_cache.items():
os.utime(file_path, (file_mtime, file_mtime))
def main():
@ -131,17 +131,17 @@ def main():
if args.operation == "generate":
try:
# Cache file may exist from a previously aborted sync. Reuse it.
with open(args.cache_file, mode="r") as f:
json.load(f) # Make sure it's not an empty file
with open(args.cache_file, mode='r', encoding='utf-8') as fin:
json.load(fin) # Make sure it's not an empty file
print("Using existing mtime cache for patches")
return 0
except Exception:
pass
try:
with open(args.cache_file, mode="w") as f:
with open(args.cache_file, mode="w", encoding='utf-8') as fin:
mtime_cache = generate_cache(json.load(args.patches_config))
json.dump(mtime_cache, f, indent=2)
json.dump(mtime_cache, fin, indent=2)
except Exception:
print(
"ERROR: failed to generate mtime cache for patches",
@ -155,8 +155,8 @@ def main():
return 0 # Cache file may not exist, fail more gracefully
try:
with open(args.cache_file, mode="r") as f:
apply_mtimes(json.load(f))
with open(args.cache_file, mode='r', encoding='utf-8') as file_in:
apply_mtimes(json.load(file_in))
if not args.preserve_cache:
os.remove(args.cache_file)