File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,7 +238,12 @@ def read_metadata(distribution: str) -> StubMetadata:
238238 """
239239 try :
240240 with metadata_path (distribution ).open ("rb" ) as f :
241- data : dict [str , object ] = tomllib .load (f )
241+ # This cast is necessary for pyright to understand that the
242+ # variable is a dict with object values. Just using
243+ # `data: dict[str, object] = tomlkit.load(f)` doesn't work because
244+ # pyright still infers TOMLDocument which derives from
245+ # dict[Unknown, Unknown].
246+ data = cast (dict [str , object ], tomlkit .load (f ))
242247 except FileNotFoundError :
243248 raise NoSuchStubError (f"Typeshed has no stubs for { distribution !r} !" ) from None
244249
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ class BlockingConnection:
7171 def remove_timeout (self , timeout_id ) -> None : ...
7272 def update_secret (self , new_secret , reason ) -> None : ...
7373 def close (self , reply_code : int = 200 , reply_text : str = "Normal shutdown" ) -> None : ...
74- def process_data_events (self , time_limit : int = 0 ): ...
74+ def process_data_events (self , time_limit : int | None = 0 ) -> None : ...
7575 def sleep (self , duration : float ) -> None : ...
7676 def channel (self , channel_number : int | None = None ) -> BlockingChannel : ...
7777 @property
You can’t perform that action at this time.
0 commit comments