From aa54883b838c6bed73c85310af41c36cc22134ef Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:35:45 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.35.0 → 0.36.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.35.0...0.36.0) - [github.com/psf/black-pre-commit-mirror: 25.12.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/25.12.0...26.1.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 079a94d9d..34c1e919c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # dogfood - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.35.0 + rev: 0.36.0 hooks: - id: check-dependabot - id: check-github-workflows @@ -24,7 +24,7 @@ repos: - id: check-merge-conflict - id: trailing-whitespace - repo: https://github.com/psf/black-pre-commit-mirror - rev: 25.12.0 + rev: 26.1.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 From 1b5efffe5f20198299b00d64281d485ec38a3ae1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:36:04 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/bump-version.py | 3 +-- scripts/changelog2md.py | 1 + scripts/generate-hooks-config.py | 19 ++++--------------- src/check_jsonschema/formats/__init__.py | 2 +- .../test_gitlab_reference_handling.py | 6 ++---- tests/unit/test_instance_loader.py | 12 ++++-------- tests/unit/test_reporters.py | 15 ++++----------- tests/unit/test_schema_loader.py | 12 ++++-------- 8 files changed, 21 insertions(+), 49 deletions(-) diff --git a/scripts/bump-version.py b/scripts/bump-version.py index e8d8043c9..f8cadaf9c 100755 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -33,8 +33,7 @@ def update_changelog(new_version): r""" Unreleased ---------- -(\s*\n)+""" - + re.escape(vendor_marker), +(\s*\n)+""" + re.escape(vendor_marker), f""" Unreleased ---------- diff --git a/scripts/changelog2md.py b/scripts/changelog2md.py index b26500d37..ef48bc821 100755 --- a/scripts/changelog2md.py +++ b/scripts/changelog2md.py @@ -9,6 +9,7 @@ ./scripts/changelog2md.py --target 3.20.0 """ + from __future__ import annotations import argparse diff --git a/scripts/generate-hooks-config.py b/scripts/generate-hooks-config.py index d5d3c5532..b63ee651e 100644 --- a/scripts/generate-hooks-config.py +++ b/scripts/generate-hooks-config.py @@ -60,14 +60,10 @@ def generate_hook_lines(config) -> t.Iterator[str]: yield " language: python" if isinstance(config["files"], list): - config["files"] = ( - r"""> + config["files"] = r"""> (?x)^( {} - )$""".format( - "|\n ".join(config["files"]) - ) - ) + )$""".format("|\n ".join(config["files"])) yield f" files: {config['files']}" @@ -121,10 +117,7 @@ def update_precommit_usage_supported_hooks() -> None: content_head = content.split(generated_list_start)[0] content_tail = content.split(generated_list_end)[-1] - generated_list = "\n\n".join( - [generated_list_start] - + [ - f"""\ + generated_list = "\n\n".join([generated_list_start] + [f"""\ ``{config["id"]}`` {"~" * (len(config["id"]) + 4)} @@ -137,11 +130,7 @@ def update_precommit_usage_supported_hooks() -> None: rev: {version} hooks: - id: {config["id"]} -""" - for config in iter_catalog_hooks() - ] - + [generated_list_end] - ) +""" for config in iter_catalog_hooks()] + [generated_list_end]) content = content_head + generated_list + content_tail with open("docs/precommit_usage.rst", "w") as fp: diff --git a/src/check_jsonschema/formats/__init__.py b/src/check_jsonschema/formats/__init__.py index 55989c6a7..86ff1ebb7 100644 --- a/src/check_jsonschema/formats/__init__.py +++ b/src/check_jsonschema/formats/__init__.py @@ -53,7 +53,7 @@ def get_base_format_checker(schema_dialect: str | None) -> jsonschema.FormatChec # mypy does not consider a class whose instances match a protocol to match # `type[$PROTOCOL]` so this is considered a mismatch default_validator_cls: type[jsonschema.Validator] = ( - jsonschema.Draft202012Validator # type:ignore[assignment] + jsonschema.Draft202012Validator # type: ignore[assignment] ) # resolve the dialect, if given, to a validator class # default to the latest draft diff --git a/tests/acceptance/test_gitlab_reference_handling.py b/tests/acceptance/test_gitlab_reference_handling.py index 1b6b395eb..1eb567965 100644 --- a/tests/acceptance/test_gitlab_reference_handling.py +++ b/tests/acceptance/test_gitlab_reference_handling.py @@ -1,7 +1,6 @@ def test_gitlab_reference_handling_on_bad_data(run_line, tmp_path): doc = tmp_path / "data.yml" - doc.write_text( - """\ + doc.write_text("""\ include: - local: setup.yml @@ -10,8 +9,7 @@ def test_gitlab_reference_handling_on_bad_data(run_line, tmp_path): # !reference not a list, error - !reference .setup - echo running my own command -""" - ) +""") res = run_line( [ diff --git a/tests/unit/test_instance_loader.py b/tests/unit/test_instance_loader.py index b7dc25667..4835b814a 100644 --- a/tests/unit/test_instance_loader.py +++ b/tests/unit/test_instance_loader.py @@ -55,15 +55,13 @@ def test_instanceloader_json_data(tmp_path, filename, default_filetype, open_wid ) def test_instanceloader_yaml_data(tmp_path, filename, default_filetype, open_wide): f = tmp_path / filename - f.write_text( - """\ + f.write_text("""\ a: b: - 1 - 2 c: d -""" - ) +""") loader = InstanceLoader(open_wide(f), default_filetype=default_filetype) data = list(loader.iter_files()) assert data == [(str(f), {"a": {"b": [1, 2], "c": "d"}})] @@ -178,15 +176,13 @@ def test_instanceloader_optional_format_handling( def test_instanceloader_yaml_dup_anchor(tmp_path, open_wide): f = tmp_path / "foo.yaml" - f.write_text( - """\ + f.write_text("""\ a: b: &anchor - 1 - 2 c: &anchor d -""" - ) +""") loader = InstanceLoader(open_wide(f)) data = list(loader.iter_files()) assert data == [(str(f), {"a": {"b": [1, 2], "c": "d"}})] diff --git a/tests/unit/test_reporters.py b/tests/unit/test_reporters.py index d1bdf486e..104fd115f 100644 --- a/tests/unit/test_reporters.py +++ b/tests/unit/test_reporters.py @@ -30,13 +30,11 @@ def test_text_format_success(capsys, verbosity, use_report_result_path): elif verbosity == 1: assert captured.out == "ok -- validation done\n" else: - assert captured.out == textwrap.dedent( - """\ + assert captured.out == textwrap.dedent("""\ ok -- validation done The following files were checked: foo.json - """ - ) + """) @pytest.mark.parametrize("verbosity", (0, 1, 2)) @@ -258,13 +256,8 @@ def test_text_print_parse_error_with_cause(capsys): # nothing to stderr assert captured.err == "" # stdout contains a nicely formatted error - assert ( - textwrap.dedent( - """\ + assert textwrap.dedent("""\ Several files failed to parse. whoopsie during parsing JSONDecodeError: a bad thing happened: line 1 column 2 (char 1) - """ - ) - in captured.out - ) + """) in captured.out diff --git a/tests/unit/test_schema_loader.py b/tests/unit/test_schema_loader.py index ddc487fa6..cf1c49598 100644 --- a/tests/unit/test_schema_loader.py +++ b/tests/unit/test_schema_loader.py @@ -100,8 +100,7 @@ def test_schemaloader_remote_path(schemafile): def test_schemaloader_local_yaml_dup_anchor(tmp_path): f = tmp_path / "schema.yaml" - f.write_text( - """ + f.write_text(""" --- "$schema": https://json-schema.org/draft/2020-12/schema type: object @@ -115,8 +114,7 @@ def test_schemaloader_local_yaml_dup_anchor(tmp_path): type: integer c: &anchor type: string -""" - ) +""") sl = SchemaLoader(str(f)) schema = sl.get_schema() assert schema == { @@ -136,11 +134,9 @@ def test_schemaloader_local_yaml_dup_anchor(tmp_path): def test_schemaloader_invalid_yaml_data(tmp_path): f = tmp_path / "foo.yaml" - f.write_text( - """\ + f.write_text("""\ a: {b -""" - ) +""") sl = SchemaLoader(str(f)) with pytest.raises(SchemaParseError): sl.get_schema()