- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
Open
Labels
help wantedAn actionable problem of low to medium complexity where a PR would be very welcomeAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false positiveType checkers report false errorsType checkers report false errors
Description
ref: python-jsonschema/jsonschema#997
I expected the following code to work when it comes to typing
from typing import Any, Mapping
import jsonschema
store: dict[str, Mapping[str, Any]] = {}
jsonschema.RefResolver(
    base_uri=f"file://mypath.json",
    referrer={},
    store=store
)However, this gives an error:
test.py:9: error: Argument "store" to "RefResolver" has incompatible type "Dict[str, Mapping[str, Any]]"; expected "Union[SupportsKeysAndGetItem[str, str], Iterable[Tuple[str, str]]]"  [arg-type]
Found 1 error in 1 file (checked 1 source file)
defined at
typeshed/stubs/jsonschema/jsonschema/validators.pyi
Lines 66 to 80 in c1d307f
| class RefResolver: | |
| referrer: dict[str, Any] | |
| cache_remote: Any | |
| handlers: dict[str, _Handler] | |
| store: URIDict | |
| def __init__( | |
| self, | |
| base_uri: str, | |
| referrer: dict[str, Any], | |
| store: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]] = ..., | |
| cache_remote: bool = ..., | |
| handlers: SupportsKeysAndGetItem[str, _Handler] | Iterable[tuple[str, _Handler]] = ..., | |
| urljoin_cache: Any | None = ..., | |
| remote_cache: Any | None = ..., | |
| ) -> None: ... | 
store is a dict[str, str] type.
Similarly, referrer is defined as a dict (MutableMapping) but I suspect that could be changed to Mapping (generically).
Metadata
Metadata
Assignees
Labels
help wantedAn actionable problem of low to medium complexity where a PR would be very welcomeAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false positiveType checkers report false errorsType checkers report false errors