Skip to content

Commit d71f96a

Browse files
committed
Fix the annotation for validator_for's default.
This still doesn't seem to satisfy mypy, so tell it to be quiet.
1 parent 328c2f1 commit d71f96a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

jsonschema/validators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ def extend(
857857
version="draft2020-12",
858858
)
859859

860-
_LATEST_VERSION = Draft202012Validator
860+
_LATEST_VERSION: type[Validator] = Draft202012Validator
861861

862862

863863
class _RefResolver:
@@ -1334,7 +1334,7 @@ def validate(instance, schema, cls=None, *args, **kwargs): # noqa: D417
13341334

13351335
def validator_for(
13361336
schema,
1337-
default: Validator | _utils.Unset = _UNSET,
1337+
default: type[Validator] | _utils.Unset = _UNSET,
13381338
) -> type[Validator]:
13391339
"""
13401340
Retrieve the validator class appropriate for validating the given schema.
@@ -1396,7 +1396,7 @@ class is returned:
13961396
DefaultValidator = _LATEST_VERSION if default is _UNSET else default
13971397

13981398
if schema is True or schema is False or "$schema" not in schema:
1399-
return DefaultValidator
1399+
return DefaultValidator # type: ignore[return-value]
14001400
if schema["$schema"] not in _META_SCHEMAS and default is _UNSET:
14011401
warn(
14021402
(

0 commit comments

Comments
 (0)