mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 08:47:39 +08:00
Fix a couple of type name collisions (#4419)
PEP 484 indicates that all type annotations within a stub file are supposed to be considered forward references even if they are not quoted. This means a type checker needs to use scope-based symbol resolution without regard for code flow order. Lookups will find same-named symbols within the same scope even if they are declared after the type annotation. This change fixes a couple of cases where this occurs and confuses pyright. Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
@@ -27,6 +27,9 @@ from .context import BaseContext
|
||||
if sys.version_info >= (3, 8):
|
||||
from .shared_memory import _SLT, ShareableList, SharedMemory
|
||||
|
||||
_SharedMemory = SharedMemory
|
||||
_ShareableList = ShareableList
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
@@ -138,5 +141,5 @@ if sys.version_info >= (3, 8):
|
||||
class SharedMemoryServer(Server): ...
|
||||
class SharedMemoryManager(BaseManager):
|
||||
def get_server(self) -> SharedMemoryServer: ...
|
||||
def SharedMemory(self, size: int) -> SharedMemory: ... # noqa: F811
|
||||
def ShareableList(self, sequence: Optional[Iterable[_SLT]]) -> ShareableList[_SLT]: ... # noqa: F811
|
||||
def SharedMemory(self, size: int) -> _SharedMemory: ...
|
||||
def ShareableList(self, sequence: Optional[Iterable[_SLT]]) -> _ShareableList[_SLT]: ...
|
||||
|
||||
Reference in New Issue
Block a user