From 34c8cc78beeba1c1014b45032ba45f054350102f Mon Sep 17 00:00:00 2001 From: Sedat Date: Mon, 23 Mar 2026 20:20:38 +1100 Subject: [PATCH 1/4] Fix RefResolver store parameter type in jsonschema stubs --- stubs/jsonschema/jsonschema/validators.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/jsonschema/jsonschema/validators.pyi b/stubs/jsonschema/jsonschema/validators.pyi index 4e93434f1d65..fd56b2f80395 100644 --- a/stubs/jsonschema/jsonschema/validators.pyi +++ b/stubs/jsonschema/jsonschema/validators.pyi @@ -105,7 +105,7 @@ class RefResolver: self, base_uri: str, referrer: dict[str, Incomplete], - store: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]] = ..., + store: SupportsKeysAndGetItem[str, Mapping[str, Any]] | Iterable[tuple[str, Mapping[str, Any]]] = ..., cache_remote: bool = True, handlers: SupportsKeysAndGetItem[str, _Handler] | Iterable[tuple[str, _Handler]] = (), urljoin_cache=None, From 3351da57d5d46727b69276f1c290bbaebca0d728 Mon Sep 17 00:00:00 2001 From: Sedat Date: Tue, 24 Mar 2026 08:42:22 +1100 Subject: [PATCH 2/4] Update URIDict types in jsonschema _utils stubs Change URIDict to use MutableMapping[str, Any] as the value type throughout, consistent with the actual runtime behavior where store values are schema documents (JSON objects), not plain strings. Co-Authored-By: Claude Sonnet 4.6 --- stubs/jsonschema/jsonschema/_utils.pyi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stubs/jsonschema/jsonschema/_utils.pyi b/stubs/jsonschema/jsonschema/_utils.pyi index 0ddd9c689191..f9551b0b708e 100644 --- a/stubs/jsonschema/jsonschema/_utils.pyi +++ b/stubs/jsonschema/jsonschema/_utils.pyi @@ -1,15 +1,15 @@ from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsNext, SupportsRichComparison from collections.abc import Generator, Iterable, Iterator, Mapping, MutableMapping -from typing import Literal, TypeVar, overload +from typing import Any, Literal, TypeVar, overload _T = TypeVar("_T") -class URIDict(MutableMapping[str, str]): +class URIDict(MutableMapping[str, MutableMapping[str, Any]]): def normalize(self, uri: str) -> str: ... - store: dict[str, str] - def __init__(self, m: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]], /, **kwargs: str) -> None: ... - def __getitem__(self, uri: str) -> str: ... - def __setitem__(self, uri: str, value: str) -> None: ... + store: dict[str, MutableMapping[str, Any]] + def __init__(self, m: SupportsKeysAndGetItem[str, MutableMapping[str, Any]] | Iterable[tuple[str, MutableMapping[str, Any]]], /, **kwargs: MutableMapping[str, Any]) -> None: ... + def __getitem__(self, uri: str) -> MutableMapping[str, Any]: ... + def __setitem__(self, uri: str, value: MutableMapping[str, Any]) -> None: ... def __delitem__(self, uri: str) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... From 85081f829c746048f98865bd2c4a14d01024ba60 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:44:29 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/jsonschema/jsonschema/_utils.pyi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stubs/jsonschema/jsonschema/_utils.pyi b/stubs/jsonschema/jsonschema/_utils.pyi index f9551b0b708e..2f609252c2ea 100644 --- a/stubs/jsonschema/jsonschema/_utils.pyi +++ b/stubs/jsonschema/jsonschema/_utils.pyi @@ -7,7 +7,12 @@ _T = TypeVar("_T") class URIDict(MutableMapping[str, MutableMapping[str, Any]]): def normalize(self, uri: str) -> str: ... store: dict[str, MutableMapping[str, Any]] - def __init__(self, m: SupportsKeysAndGetItem[str, MutableMapping[str, Any]] | Iterable[tuple[str, MutableMapping[str, Any]]], /, **kwargs: MutableMapping[str, Any]) -> None: ... + def __init__( + self, + m: SupportsKeysAndGetItem[str, MutableMapping[str, Any]] | Iterable[tuple[str, MutableMapping[str, Any]]], + /, + **kwargs: MutableMapping[str, Any], + ) -> None: ... def __getitem__(self, uri: str) -> MutableMapping[str, Any]: ... def __setitem__(self, uri: str, value: MutableMapping[str, Any]) -> None: ... def __delitem__(self, uri: str) -> None: ... From 1036daea4563268adeab5a3e7715c66d7f6598a3 Mon Sep 17 00:00:00 2001 From: Sedat Date: Tue, 24 Mar 2026 09:04:40 +1100 Subject: [PATCH 4/4] Use Mapping instead of SupportsKeysAndGetItem for store parameter Since values() is called on the store mapping and RefResolver is deprecated, using Mapping directly is the more pragmatic approach. Co-Authored-By: Claude Opus 4.6 --- stubs/jsonschema/jsonschema/validators.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/jsonschema/jsonschema/validators.pyi b/stubs/jsonschema/jsonschema/validators.pyi index fd56b2f80395..483c870fc786 100644 --- a/stubs/jsonschema/jsonschema/validators.pyi +++ b/stubs/jsonschema/jsonschema/validators.pyi @@ -105,7 +105,7 @@ class RefResolver: self, base_uri: str, referrer: dict[str, Incomplete], - store: SupportsKeysAndGetItem[str, Mapping[str, Any]] | Iterable[tuple[str, Mapping[str, Any]]] = ..., + store: Mapping[str, Mapping[str, Any]] | Iterable[tuple[str, Mapping[str, Any]]] = ..., cache_remote: bool = True, handlers: SupportsKeysAndGetItem[str, _Handler] | Iterable[tuple[str, _Handler]] = (), urljoin_cache=None,