From 94e03dc42015df4fab4c0440d3f7c05f7eddd337 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 30 Oct 2024 10:08:25 -0700 Subject: python3-jsonschema: Fix annotation for validator_for's default Backport the fix, it helps some ptests on meta-python packages e.g. pydantic (From OE-Core rev: 3bf9241787574bad15e685d8f956f33719bac749) Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- .../d71f96a6523875c9694fcdf468c9f458323d07f2.patch | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 meta/recipes-devtools/python/python3-jsonschema/d71f96a6523875c9694fcdf468c9f458323d07f2.patch (limited to 'meta/recipes-devtools/python/python3-jsonschema') diff --git a/meta/recipes-devtools/python/python3-jsonschema/d71f96a6523875c9694fcdf468c9f458323d07f2.patch b/meta/recipes-devtools/python/python3-jsonschema/d71f96a6523875c9694fcdf468c9f458323d07f2.patch new file mode 100644 index 0000000000..65cc2b4cf0 --- /dev/null +++ b/meta/recipes-devtools/python/python3-jsonschema/d71f96a6523875c9694fcdf468c9f458323d07f2.patch @@ -0,0 +1,44 @@ +From d71f96a6523875c9694fcdf468c9f458323d07f2 Mon Sep 17 00:00:00 2001 +From: Julian Berman +Date: Thu, 17 Oct 2024 09:36:35 -0400 +Subject: [PATCH] Fix the annotation for validator_for's default. + +This still doesn't seem to satisfy mypy, so tell it to be quiet. + +Upstream-Status: Backport [https://github.com/python-jsonschema/jsonschema/commit/d71f96a6523875c9694fcdf468c9f458323d07f2] +Signed-off-by: Khem Raj +--- + jsonschema/validators.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/jsonschema/validators.py b/jsonschema/validators.py +index 85c39160..b8ca3bd4 100644 +--- a/jsonschema/validators.py ++++ b/jsonschema/validators.py +@@ -857,7 +857,7 @@ def extend( + version="draft2020-12", + ) + +-_LATEST_VERSION = Draft202012Validator ++_LATEST_VERSION: type[Validator] = Draft202012Validator + + + class _RefResolver: +@@ -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. +@@ -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( + ( -- cgit v1.2.3-54-g00ecf