mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Fix type of linecache.cache (#10447)
An entry of linecache.cache is either a lazy entry or a full entry. The full entries are typed correctly but the lazy entry is supposed to be a one-tuple consisting of a function that takes zero arguments and returns either a string or None.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, Protocol
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -10,8 +11,7 @@ else:
|
||||
_ModuleGlobals: TypeAlias = dict[str, Any]
|
||||
_ModuleMetadata: TypeAlias = tuple[int, float | None, list[str], str]
|
||||
|
||||
class _SourceLoader(Protocol):
|
||||
def __call__(self) -> str | None: ...
|
||||
_SourceLoader: TypeAlias = tuple[Callable[[], str | None]]
|
||||
|
||||
cache: dict[str, _SourceLoader | _ModuleMetadata] # undocumented
|
||||
|
||||
|
||||
Reference in New Issue
Block a user