From 857b5bade0d71326d43036b4d9b1294caf03f265 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Tue, 11 Apr 2023 04:57:29 -0400 Subject: ci: run black on Python scripts (#1094) * ci: run black on Python scripts * comments --- scripts/cirrus/build.py | 15 +++++++++++---- scripts/packager.py | 5 ++++- scripts/windows/choco/choco_packager.py | 4 +++- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/cirrus/build.py b/scripts/cirrus/build.py index d2440a61..27d93ccf 100644 --- a/scripts/cirrus/build.py +++ b/scripts/cirrus/build.py @@ -31,7 +31,9 @@ def make_query_request(key: str, branch: str, build_type: str): # Dumb but if it works... config_override = ( - Path(".cirrus.yml").read_text().replace("# -PLACEHOLDER FOR CI-", 'BTM_BUILD_RELEASE_CALLER: "nightly"') + Path(".cirrus.yml") + .read_text() + .replace("# -PLACEHOLDER FOR CI-", 'BTM_BUILD_RELEASE_CALLER: "nightly"') ) query = """ mutation CreateCirrusCIBuild ( @@ -102,7 +104,7 @@ def check_build_status(key: str, id: str) -> Optional[str]: def try_download(build_id: str, dl_path: Path): - for (task, file) in TASKS: + for task, file in TASKS: url = DL_URL_TEMPLATE % (build_id, task, file) out = dl_path / file print("Downloading {} to {}".format(file, out)) @@ -187,9 +189,14 @@ def main(): print("Unexpected error:") print(ex) print(traceback.format_exc()) - sleep(60) # Sleep for a minute if something went wrong, just in case. + # Sleep for a minute if something went wrong, just in case. + sleep(60) else: - print("Build failed to complete after {} minutes, bailing.".format(MINUTES)) + print( + "Build failed to complete after {} minutes, bailing.".format( + MINUTES + ) + ) if not success: exit(2) diff --git a/scripts/packager.py b/scripts/packager.py index 8a4a8b4e..f4e147df 100644 --- a/scripts/packager.py +++ b/scripts/packager.py @@ -34,7 +34,10 @@ def get_hash(deployment_file): elif str.lower(hash_type) == "sha1": deployment_hash = hashlib.sha1(deployment_file.read()).hexdigest() else: - print('Unsupported hash format "%s". Please use SHA512, SHA256, or SHA1.', hash_type) + print( + 'Unsupported hash format "%s". Please use SHA512, SHA256, or SHA1.', + hash_type, + ) exit(1) print("Generated hash: %s" % str(deployment_hash)) diff --git a/scripts/windows/choco/choco_packager.py b/scripts/windows/choco/choco_packager.py index daf3f15f..3e96cba9 100644 --- a/scripts/windows/choco/choco_packager.py +++ b/scripts/windows/choco/choco_packager.py @@ -43,7 +43,9 @@ with open(deployment_file_path_64, "rb") as deployment_file_64: with open(ps1_template, "r") as template_file: template = Template(template_file.read()) substitute = template.safe_substitute(version=version, hash_64=hash_64) - print("\n================== Generated chocolatey-install file ==================\n") + print( + "\n================== Generated chocolatey-install file ==================\n" + ) print(substitute) print("\n============================================================\n") -- cgit v1.2.3