Use lowercase type everywhere (#6853)

This commit is contained in:
Alex Waygood
2022-01-08 15:09:29 +00:00
committed by GitHub
parent f8501d33c7
commit a40d79a4e6
172 changed files with 728 additions and 761 deletions

View File

@@ -8,7 +8,7 @@ from multiprocessing import queues, synchronize
from multiprocessing.pool import Pool as _Pool
from multiprocessing.process import BaseProcess
from multiprocessing.sharedctypes import SynchronizedArray, SynchronizedBase
from typing import Any, Type, TypeVar, Union, overload
from typing import Any, TypeVar, Union, overload
from typing_extensions import Literal
_LockLike = Union[synchronize.Lock, synchronize.RLock]
@@ -20,11 +20,11 @@ class TimeoutError(ProcessError): ...
class AuthenticationError(ProcessError): ...
class BaseContext:
Process: Type[BaseProcess]
ProcessError: Type[Exception]
BufferTooShort: Type[Exception]
TimeoutError: Type[Exception]
AuthenticationError: Type[Exception]
Process: type[BaseProcess]
ProcessError: type[Exception]
BufferTooShort: type[Exception]
TimeoutError: type[Exception]
AuthenticationError: type[Exception]
# N.B. The methods below are applied at runtime to generate
# multiprocessing.*, so the signatures should be identical (modulo self).
@@ -60,26 +60,26 @@ class BaseContext:
maxtasksperchild: int | None = ...,
) -> _Pool: ...
@overload
def RawValue(self, typecode_or_type: Type[_CT], *args: Any) -> _CT: ...
def RawValue(self, typecode_or_type: type[_CT], *args: Any) -> _CT: ...
@overload
def RawValue(self, typecode_or_type: str, *args: Any) -> Any: ...
@overload
def RawArray(self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ...
def RawArray(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: ...
@overload
def RawArray(self, typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ...
@overload
def Value(self, typecode_or_type: Type[_CT], *args: Any, lock: Literal[False]) -> _CT: ...
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> _CT: ...
@overload
def Value(self, typecode_or_type: Type[_CT], *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[_CT]: ...
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[_CT]: ...
@overload
def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike) -> SynchronizedBase[Any]: ...
@overload
def Value(self, typecode_or_type: str | Type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ...
def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ...
@overload
def Array(self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ...
def Array(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ...
@overload
def Array(
self, typecode_or_type: Type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike
self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike
) -> SynchronizedArray[_CT]: ...
@overload
def Array(
@@ -87,7 +87,7 @@ class BaseContext:
) -> SynchronizedArray[Any]: ...
@overload
def Array(
self, typecode_or_type: str | Type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ...
self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ...
) -> Any: ...
def freeze_support(self) -> None: ...
def get_logger(self) -> Logger: ...
@@ -127,7 +127,7 @@ class Process(BaseProcess):
def _Popen(process_obj: BaseProcess) -> DefaultContext: ...
class DefaultContext(BaseContext):
Process: Type[multiprocessing.Process]
Process: type[multiprocessing.Process]
def __init__(self, context: BaseContext) -> None: ...
def set_start_method(self, method: str | None, force: bool = ...) -> None: ...
def get_start_method(self, allow_none: bool = ...) -> str: ...
@@ -150,13 +150,13 @@ if sys.platform != "win32":
def _Popen(process_obj: BaseProcess) -> Any: ...
class ForkContext(BaseContext):
_name: str
Process: Type[ForkProcess]
Process: type[ForkProcess]
class SpawnContext(BaseContext):
_name: str
Process: Type[SpawnProcess]
Process: type[SpawnProcess]
class ForkServerContext(BaseContext):
_name: str
Process: Type[ForkServerProcess]
Process: type[ForkServerProcess]
else:
class SpawnProcess(BaseProcess):
@@ -165,7 +165,7 @@ else:
def _Popen(process_obj: BaseProcess) -> Any: ...
class SpawnContext(BaseContext):
_name: str
Process: Type[SpawnProcess]
Process: type[SpawnProcess]
def _force_start_method(method: str) -> None: ...
def get_spawning_popen() -> Any | None: ...