From e8bb208374117ef8e54e28f8fada054fbe701cc8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 11:57:20 -0400 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#1583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.284 → v0.0.285](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.284...v0.0.285) - [github.com/pre-commit/mirrors-mypy: v1.5.0 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.0...v1.5.1) * chore: add check arguments Signed-off-by: Henry Schreiner * Update bin/bump_version.py Co-authored-by: Joe Rickerby --------- Signed-off-by: Henry Schreiner Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner Co-authored-by: Joe Rickerby --- .pre-commit-config.yaml | 4 ++-- bin/bump_version.py | 5 +++-- bin/make_dependency_update_pr.py | 10 +++++----- bin/run_example_ci_configs.py | 10 +++++----- bin/sample_build.py | 6 +++++- bin/update_how_it_works_image.py | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 523245ac1..e66479bba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.284 + rev: v0.0.285 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -31,7 +31,7 @@ repos: args: [--include-version-classifiers, --min-py-version=3.8, --max-py-version=3.11] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.0 + rev: v1.5.1 hooks: - id: mypy name: mypy 3.8 on cibuildwheel/ diff --git a/bin/bump_version.py b/bin/bump_version.py index 2af6e37d8..cf0727db7 100755 --- a/bin/bump_version.py +++ b/bin/bump_version.py @@ -60,7 +60,7 @@ def bump_version() -> None: print(e) print("Failed to get previous version tag information.") - git_changes_result = subprocess.run(["git diff-index --quiet HEAD --"], shell=True) + git_changes_result = subprocess.run(["git diff-index --quiet HEAD --"], shell=True, check=False) repo_has_uncommitted_changes = git_changes_result.returncode != 0 if repo_has_uncommitted_changes: @@ -142,7 +142,8 @@ def bump_version() -> None: "pre-commit", "run", "--files=docs/changelog.md", - ] + ], + check=False, ) # run pre-commit to check that no errors occurred on the second run diff --git a/bin/make_dependency_update_pr.py b/bin/make_dependency_update_pr.py index be8a57ad5..cfbdef913 100755 --- a/bin/make_dependency_update_pr.py +++ b/bin/make_dependency_update_pr.py @@ -12,13 +12,13 @@ import click -def shell(cmd, **kwargs): - return run([cmd], shell=True, **kwargs) +def shell(cmd, *, check: bool, **kwargs): + return run([cmd], shell=True, check=check, **kwargs) def git_repo_has_changes(): - unstaged_changes = shell("git diff-index --quiet HEAD --").returncode != 0 - staged_changes = shell("git diff-index --quiet --cached HEAD --").returncode != 0 + unstaged_changes = shell("git diff-index --quiet HEAD --", check=False).returncode != 0 + staged_changes = shell("git diff-index --quiet --cached HEAD --", check=False).returncode != 0 return unstaged_changes or staged_changes @@ -73,7 +73,7 @@ def main(): print("Done.") finally: # remove any local changes - shell("git checkout -- .") + shell("git checkout -- .", check=True) shell(f"git checkout {previous_branch}", check=True) shell(f"git branch -D --force {branch_name}", check=True) diff --git a/bin/run_example_ci_configs.py b/bin/run_example_ci_configs.py index 07f3a6cde..ef3c6eaad 100755 --- a/bin/run_example_ci_configs.py +++ b/bin/run_example_ci_configs.py @@ -16,13 +16,13 @@ import click -def shell(cmd, **kwargs): - return run([cmd], shell=True, **kwargs) +def shell(cmd, *, check: bool, **kwargs): + return run([cmd], shell=True, check=check, **kwargs) def git_repo_has_changes(): - unstaged_changes = shell("git diff-index --quiet HEAD --").returncode != 0 - staged_changes = shell("git diff-index --quiet --cached HEAD --").returncode != 0 + unstaged_changes = shell("git diff-index --quiet HEAD --", check=False).returncode != 0 + staged_changes = shell("git diff-index --quiet --cached HEAD --", check=False).returncode != 0 return unstaged_changes or staged_changes @@ -163,7 +163,7 @@ def run_example_ci_configs(config_files=None): finally: # remove any local changes shutil.rmtree(example_project, ignore_errors=True) - shell("git checkout -- .") + shell("git checkout -- .", check=True) shell(f"git checkout {previous_branch}", check=True) shell(f"git branch -D --force {branch_name}", check=True) diff --git a/bin/sample_build.py b/bin/sample_build.py index 90c636ed6..9e8e64204 100755 --- a/bin/sample_build.py +++ b/bin/sample_build.py @@ -24,4 +24,8 @@ check=True, ) - sys.exit(subprocess.run([sys.executable, "-m", "cibuildwheel"], cwd=project_dir).returncode) + sys.exit( + subprocess.run( + [sys.executable, "-m", "cibuildwheel"], cwd=project_dir, check=False + ).returncode + ) diff --git a/bin/update_how_it_works_image.py b/bin/update_how_it_works_image.py index b7b433fb6..39ecfec9b 100755 --- a/bin/update_how_it_works_image.py +++ b/bin/update_how_it_works_image.py @@ -19,7 +19,7 @@ def main(): - subprocess.run(["mkdocs", "build"]) + subprocess.run(["mkdocs", "build"], check=True) hti = Html2Image(custom_flags=["--force-device-scale-factor=2"])