Skip to content

Commit 2f5f7a6

Browse files
authored
Merge pull request #2124 from bids-standard/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents 678e02b + 8138696 commit 2f5f7a6

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ repos:
4949
- id: codespell
5050
args: ["--config=.codespellrc", "--dictionary=-", "--dictionary=.codespell_dict"]
5151
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: v1.15.0
52+
rev: v1.16.0
5353
hooks:
5454
- id: mypy
5555
# Sync with project.optional-dependencies.typing

tools/schemacode/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ source = [
9595
[tool.coverage.run]
9696
parallel = true
9797

98+
[tool.coverage.report]
99+
exclude_also = [
100+
"if.*TYPE_CHECKING:",
101+
]
102+
98103
# Release process:
99104
# cd tools/schemacode
100105
# uvx bump-my-version bump pre_label --tag

tools/schemacode/src/bidsschematools/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@
1010

1111
TYPE_CHECKING = False
1212
if TYPE_CHECKING:
13-
from typing import Any
13+
from typing import Any, NotRequired, TypedDict
1414

15+
from jsonschema import FormatChecker
1516
from jsonschema.protocols import Validator as JsonschemaValidator
1617

18+
class ValidatorKwargs(TypedDict):
19+
"""Type for the keyword arguments used to create a JSON schema validator."""
20+
21+
format_checker: NotRequired[FormatChecker]
22+
1723

1824
def get_bundled_schema_path():
1925
"""Get the path to the schema directory.
@@ -140,5 +146,6 @@ def jsonschema_validator(
140146
# Ensure the schema is valid
141147
validator_cls.check_schema(schema)
142148

149+
validator_kwargs: ValidatorKwargs
143150
validator_kwargs = {"format_checker": validator_cls.FORMAT_CHECKER} if check_format else {}
144151
return validator_cls(schema, **validator_kwargs)

0 commit comments

Comments
 (0)