Use TypeAlias for type aliases where possible, part II (#7667)

This commit is contained in:
Alex Waygood
2022-04-20 20:02:47 +01:00
committed by GitHub
parent c653be73b8
commit b093c90a94
41 changed files with 91 additions and 90 deletions

View File

@@ -2,20 +2,20 @@ import queue
import sys
import threading
from _typeshed import Self
from builtins import dict as _dict, list as _list # Conflicts with method names
from collections.abc import Callable, Iterable, Mapping, Sequence
from types import TracebackType
from typing import Any, AnyStr, Generic, TypeVar
from typing_extensions import TypeAlias
from .connection import Connection
from .context import BaseContext
if sys.version_info >= (3, 8):
from .shared_memory import _SLT, ShareableList, SharedMemory
from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"]
_SharedMemory = SharedMemory
_ShareableList = ShareableList
else:
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token"]
@@ -31,7 +31,7 @@ class Namespace:
def __getattr__(self, __name: str) -> Any: ...
def __setattr__(self, __name: str, __value: Any) -> None: ...
_Namespace = Namespace
_Namespace: TypeAlias = Namespace
class Token:
typeid: str | bytes | None
@@ -101,10 +101,6 @@ class BaseManager:
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
# Conflicts with method names
_dict = dict
_list = list
class SyncManager(BaseManager):
def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ...
def Condition(self, lock: Any = ...) -> threading.Condition: ...