[jsonschema] Fix RefResolver store parameter type (#15542)

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.
This commit is contained in:
sedat4ras
2026-03-25 02:09:54 +11:00
committed by GitHub
parent 26380ee31c
commit dc981ee66f
2 changed files with 13 additions and 8 deletions
+12 -7
View File
@@ -1,15 +1,20 @@
from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsNext, SupportsRichComparison
from _typeshed import Incomplete, 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: Mapping[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: ...
+1 -1
View File
@@ -113,7 +113,7 @@ class RefResolver:
self,
base_uri: str,
referrer: dict[str, Incomplete],
store: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]] = ...,
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,