We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08de8c3 commit a86a1ecCopy full SHA for a86a1ec
1 file changed
lib/ts_utils/metadata.py
@@ -239,7 +239,12 @@ def read_metadata(distribution: str) -> StubMetadata:
239
"""
240
try:
241
with metadata_path(distribution).open("rb") as f:
242
- data: dict[str, object] = tomllib.load(f)
+ # This cast is necessary for pyright to understand that the
243
+ # variable is a dict with object values. Just using
244
+ # `data: dict[str, object] = tomllib.load(f)` doesn't work because
245
+ # pyright still infers TOMLDocument which derives from
246
+ # dict[Unknown, Unknown].
247
+ data = cast(dict[str, object], tomlkit.load(f))
248
except FileNotFoundError:
249
raise NoSuchStubError(f"Typeshed has no stubs for {distribution!r}!") from None
250
0 commit comments