diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-10-30 10:08:25 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-11-01 12:13:18 +0000 |
| commit | 94e03dc42015df4fab4c0440d3f7c05f7eddd337 (patch) | |
| tree | d37bfdef5f270ac67a814104541ab8da21742e7d /meta/recipes-devtools/python/python3-jsonschema | |
| parent | 04fc8f49720af13eaded16d323e229fde13aa488 (diff) | |
| download | poky-94e03dc42015df4fab4c0440d3f7c05f7eddd337.tar.gz | |
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 <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3-jsonschema')
| -rw-r--r-- | meta/recipes-devtools/python/python3-jsonschema/d71f96a6523875c9694fcdf468c9f458323d07f2.patch | 44 |
1 files changed, 44 insertions, 0 deletions
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 @@ | |||
| 1 | From d71f96a6523875c9694fcdf468c9f458323d07f2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Julian Berman <Julian@GrayVines.com> | ||
| 3 | Date: Thu, 17 Oct 2024 09:36:35 -0400 | ||
| 4 | Subject: [PATCH] Fix the annotation for validator_for's default. | ||
| 5 | |||
| 6 | This still doesn't seem to satisfy mypy, so tell it to be quiet. | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://github.com/python-jsonschema/jsonschema/commit/d71f96a6523875c9694fcdf468c9f458323d07f2] | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | jsonschema/validators.py | 6 +++--- | ||
| 12 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/jsonschema/validators.py b/jsonschema/validators.py | ||
| 15 | index 85c39160..b8ca3bd4 100644 | ||
| 16 | --- a/jsonschema/validators.py | ||
| 17 | +++ b/jsonschema/validators.py | ||
| 18 | @@ -857,7 +857,7 @@ def extend( | ||
| 19 | version="draft2020-12", | ||
| 20 | ) | ||
| 21 | |||
| 22 | -_LATEST_VERSION = Draft202012Validator | ||
| 23 | +_LATEST_VERSION: type[Validator] = Draft202012Validator | ||
| 24 | |||
| 25 | |||
| 26 | class _RefResolver: | ||
| 27 | @@ -1334,7 +1334,7 @@ def validate(instance, schema, cls=None, *args, **kwargs): # noqa: D417 | ||
| 28 | |||
| 29 | def validator_for( | ||
| 30 | schema, | ||
| 31 | - default: Validator | _utils.Unset = _UNSET, | ||
| 32 | + default: type[Validator] | _utils.Unset = _UNSET, | ||
| 33 | ) -> type[Validator]: | ||
| 34 | """ | ||
| 35 | Retrieve the validator class appropriate for validating the given schema. | ||
| 36 | @@ -1396,7 +1396,7 @@ class is returned: | ||
| 37 | DefaultValidator = _LATEST_VERSION if default is _UNSET else default | ||
| 38 | |||
| 39 | if schema is True or schema is False or "$schema" not in schema: | ||
| 40 | - return DefaultValidator | ||
| 41 | + return DefaultValidator # type: ignore[return-value] | ||
| 42 | if schema["$schema"] not in _META_SCHEMAS and default is _UNSET: | ||
| 43 | warn( | ||
| 44 | ( | ||
