Skip to content

Commit

Permalink
Fix the annotation for validator_for's default.
Browse files Browse the repository at this point in the history
This still doesn't seem to satisfy mypy, so tell it to be quiet.
  • Loading branch information
Julian committed Oct 17, 2024
1 parent 328c2f1 commit d71f96a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jsonschema/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def extend(
version="draft2020-12",
)

_LATEST_VERSION = Draft202012Validator
_LATEST_VERSION: type[Validator] = Draft202012Validator


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

def validator_for(
schema,
default: Validator | _utils.Unset = _UNSET,
default: type[Validator] | _utils.Unset = _UNSET,
) -> type[Validator]:
"""
Retrieve the validator class appropriate for validating the given schema.
Expand Down Expand Up @@ -1396,7 +1396,7 @@ class is returned:
DefaultValidator = _LATEST_VERSION if default is _UNSET else default

if schema is True or schema is False or "$schema" not in schema:
return DefaultValidator
return DefaultValidator # type: ignore[return-value]
if schema["$schema"] not in _META_SCHEMAS and default is _UNSET:
warn(
(
Expand Down

0 comments on commit d71f96a

Please sign in to comment.