Skip to content

Commit 2eca64b

Browse files
authored
Merge pull request #634 from python-jsonschema/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents 388b281 + 1b5efff commit 2eca64b

File tree

9 files changed

+23
-51
lines changed

9 files changed

+23
-51
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
# dogfood
33
- repo: https://github.com/python-jsonschema/check-jsonschema
4-
rev: 0.35.0
4+
rev: 0.36.0
55
hooks:
66
- id: check-dependabot
77
- id: check-github-workflows
@@ -24,7 +24,7 @@ repos:
2424
- id: check-merge-conflict
2525
- id: trailing-whitespace
2626
- repo: https://github.com/psf/black-pre-commit-mirror
27-
rev: 25.12.0
27+
rev: 26.1.0
2828
hooks:
2929
- id: black
3030
- repo: https://github.com/PyCQA/flake8

scripts/bump-version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def update_changelog(new_version):
3333
r"""
3434
Unreleased
3535
----------
36-
(\s*\n)+"""
37-
+ re.escape(vendor_marker),
36+
(\s*\n)+""" + re.escape(vendor_marker),
3837
f"""
3938
Unreleased
4039
----------

scripts/changelog2md.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
1010
./scripts/changelog2md.py --target 3.20.0
1111
"""
12+
1213
from __future__ import annotations
1314

1415
import argparse

scripts/generate-hooks-config.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,10 @@ def generate_hook_lines(config) -> t.Iterator[str]:
6060
yield " language: python"
6161

6262
if isinstance(config["files"], list):
63-
config["files"] = (
64-
r""">
63+
config["files"] = r""">
6564
(?x)^(
6665
{}
67-
)$""".format(
68-
"|\n ".join(config["files"])
69-
)
70-
)
66+
)$""".format("|\n ".join(config["files"]))
7167

7268
yield f" files: {config['files']}"
7369

@@ -121,10 +117,7 @@ def update_precommit_usage_supported_hooks() -> None:
121117
content_head = content.split(generated_list_start)[0]
122118
content_tail = content.split(generated_list_end)[-1]
123119

124-
generated_list = "\n\n".join(
125-
[generated_list_start]
126-
+ [
127-
f"""\
120+
generated_list = "\n\n".join([generated_list_start] + [f"""\
128121
``{config["id"]}``
129122
{"~" * (len(config["id"]) + 4)}
130123
@@ -137,11 +130,7 @@ def update_precommit_usage_supported_hooks() -> None:
137130
rev: {version}
138131
hooks:
139132
- id: {config["id"]}
140-
"""
141-
for config in iter_catalog_hooks()
142-
]
143-
+ [generated_list_end]
144-
)
133+
""" for config in iter_catalog_hooks()] + [generated_list_end])
145134

146135
content = content_head + generated_list + content_tail
147136
with open("docs/precommit_usage.rst", "w") as fp:

src/check_jsonschema/formats/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_base_format_checker(schema_dialect: str | None) -> jsonschema.FormatChec
5353
# mypy does not consider a class whose instances match a protocol to match
5454
# `type[$PROTOCOL]` so this is considered a mismatch
5555
default_validator_cls: type[jsonschema.Validator] = (
56-
jsonschema.Draft202012Validator # type:ignore[assignment]
56+
jsonschema.Draft202012Validator # type: ignore[assignment]
5757
)
5858
# resolve the dialect, if given, to a validator class
5959
# default to the latest draft

tests/acceptance/test_gitlab_reference_handling.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
def test_gitlab_reference_handling_on_bad_data(run_line, tmp_path):
22
doc = tmp_path / "data.yml"
3-
doc.write_text(
4-
"""\
3+
doc.write_text("""\
54
include:
65
- local: setup.yml
76
@@ -10,8 +9,7 @@ def test_gitlab_reference_handling_on_bad_data(run_line, tmp_path):
109
# !reference not a list, error
1110
- !reference .setup
1211
- echo running my own command
13-
"""
14-
)
12+
""")
1513

1614
res = run_line(
1715
[

tests/unit/test_instance_loader.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ def test_instanceloader_json_data(tmp_path, filename, default_filetype, open_wid
5555
)
5656
def test_instanceloader_yaml_data(tmp_path, filename, default_filetype, open_wide):
5757
f = tmp_path / filename
58-
f.write_text(
59-
"""\
58+
f.write_text("""\
6059
a:
6160
b:
6261
- 1
6362
- 2
6463
c: d
65-
"""
66-
)
64+
""")
6765
loader = InstanceLoader(open_wide(f), default_filetype=default_filetype)
6866
data = list(loader.iter_files())
6967
assert data == [(str(f), {"a": {"b": [1, 2], "c": "d"}})]
@@ -178,15 +176,13 @@ def test_instanceloader_optional_format_handling(
178176

179177
def test_instanceloader_yaml_dup_anchor(tmp_path, open_wide):
180178
f = tmp_path / "foo.yaml"
181-
f.write_text(
182-
"""\
179+
f.write_text("""\
183180
a:
184181
b: &anchor
185182
- 1
186183
- 2
187184
c: &anchor d
188-
"""
189-
)
185+
""")
190186
loader = InstanceLoader(open_wide(f))
191187
data = list(loader.iter_files())
192188
assert data == [(str(f), {"a": {"b": [1, 2], "c": "d"}})]

tests/unit/test_reporters.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ def test_text_format_success(capsys, verbosity, use_report_result_path):
3030
elif verbosity == 1:
3131
assert captured.out == "ok -- validation done\n"
3232
else:
33-
assert captured.out == textwrap.dedent(
34-
"""\
33+
assert captured.out == textwrap.dedent("""\
3534
ok -- validation done
3635
The following files were checked:
3736
foo.json
38-
"""
39-
)
37+
""")
4038

4139

4240
@pytest.mark.parametrize("verbosity", (0, 1, 2))
@@ -258,13 +256,8 @@ def test_text_print_parse_error_with_cause(capsys):
258256
# nothing to stderr
259257
assert captured.err == ""
260258
# stdout contains a nicely formatted error
261-
assert (
262-
textwrap.dedent(
263-
"""\
259+
assert textwrap.dedent("""\
264260
Several files failed to parse.
265261
whoopsie during parsing
266262
JSONDecodeError: a bad thing happened: line 1 column 2 (char 1)
267-
"""
268-
)
269-
in captured.out
270-
)
263+
""") in captured.out

tests/unit/test_schema_loader.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ def test_schemaloader_remote_path(schemafile):
100100

101101
def test_schemaloader_local_yaml_dup_anchor(tmp_path):
102102
f = tmp_path / "schema.yaml"
103-
f.write_text(
104-
"""
103+
f.write_text("""
105104
---
106105
"$schema": https://json-schema.org/draft/2020-12/schema
107106
type: object
@@ -115,8 +114,7 @@ def test_schemaloader_local_yaml_dup_anchor(tmp_path):
115114
type: integer
116115
c: &anchor
117116
type: string
118-
"""
119-
)
117+
""")
120118
sl = SchemaLoader(str(f))
121119
schema = sl.get_schema()
122120
assert schema == {
@@ -136,11 +134,9 @@ def test_schemaloader_local_yaml_dup_anchor(tmp_path):
136134

137135
def test_schemaloader_invalid_yaml_data(tmp_path):
138136
f = tmp_path / "foo.yaml"
139-
f.write_text(
140-
"""\
137+
f.write_text("""\
141138
a: {b
142-
"""
143-
)
139+
""")
144140
sl = SchemaLoader(str(f))
145141
with pytest.raises(SchemaParseError):
146142
sl.get_schema()

0 commit comments

Comments
 (0)