From ab33cd731fae459e8cf121d28aa0a092362ef049 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 24 Jun 2023 05:18:40 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deployer/cluster.py | 6 ++---- reports/run.py | 43 ++++++++++++++++--------------------------- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/deployer/cluster.py b/deployer/cluster.py index 17c7edc47b..1e2ce9fc26 100644 --- a/deployer/cluster.py +++ b/deployer/cluster.py @@ -1,7 +1,7 @@ import json import os -import sys import subprocess +import sys import tempfile from contextlib import contextmanager from pathlib import Path @@ -153,7 +153,7 @@ def auth_aws(self): f"--region={region}", ], stderr=subprocess.PIPE, - stdout=subprocess.PIPE + stdout=subprocess.PIPE, ) if proc.returncode != 0: @@ -162,7 +162,6 @@ def auth_aws(self): print(proc.stderr.decode(), file=sys.stderr) proc.check_returncode() - yield def auth_azure(self): @@ -259,7 +258,6 @@ def auth_gcp(self): print(proc.stdout.decode()) print(proc.stderr.decode(), file=sys.stderr) proc.check_returncode() - proc = subprocess.run( [ diff --git a/reports/run.py b/reports/run.py index 82606458a7..194ecd68c1 100644 --- a/reports/run.py +++ b/reports/run.py @@ -1,49 +1,38 @@ """ Execute the reports in this directory with papermill & output them to a github repo """ -import papermill as pm +import argparse import os -from datetime import datetime import pathlib -from contextlib import contextmanager -import argparse import subprocess +from contextlib import contextmanager +from datetime import datetime from tempfile import TemporaryDirectory +import papermill as pm + HERE = pathlib.Path(__file__).parent + @contextmanager def auto_commit_git_repo(clone_url, message): with TemporaryDirectory() as d: - subprocess.check_call([ - 'git', 'clone', - clone_url, - '--depth', '1', - d - ]) + subprocess.check_call(["git", "clone", clone_url, "--depth", "1", d]) try: yield d finally: - subprocess.check_call([ - 'git', 'add', '.' - ], cwd=d) - subprocess.check_call([ - 'git', 'commit', '-m', message - ], cwd=d) - subprocess.check_call([ - 'git', 'push' - ], cwd=d) - + subprocess.check_call(["git", "add", "."], cwd=d) + subprocess.check_call(["git", "commit", "-m", message], cwd=d) + subprocess.check_call(["git", "push"], cwd=d) -reports = HERE.glob('*.ipynb') +reports = HERE.glob("*.ipynb") -with auto_commit_git_repo('git@github.com:yuvipanda/2i2c-reports.git', 'Test commits') as d: +with auto_commit_git_repo( + "git@github.com:yuvipanda/2i2c-reports.git", "Test commits" +) as d: output_base = pathlib.Path(d) for report in reports: - output_file = output_base / report.stem / datetime.now().isoformat() + output_file = output_base / report.stem / datetime.now().isoformat() os.makedirs(output_file.parent, exist_ok=True) - pm.execute_notebook( - report, - str(output_file) + ".ipynb" - ) + pm.execute_notebook(report, str(output_file) + ".ipynb")