multiprocessing.pool: Use Literal and add __all__ (#6815)

This commit is contained in:
Nikita Sobolev
2022-01-04 19:20:06 +03:00
committed by GitHub
parent 582f1e9c5f
commit 4c61bdbccb

View File

@@ -2,10 +2,13 @@ import sys
from _typeshed import Self
from contextlib import AbstractContextManager
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, TypeVar
from typing_extensions import Literal
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = ["Pool", "ThreadPool"]
_PT = TypeVar("_PT", bound=Pool)
_S = TypeVar("_S")
_T = TypeVar("_T")
@@ -115,11 +118,11 @@ class ThreadPool(Pool, AbstractContextManager[ThreadPool]):
# undocumented
if sys.version_info >= (3, 8):
INIT: str
RUN: str
CLOSE: str
TERMINATE: str
INIT: Literal["INIT"]
RUN: Literal["RUN"]
CLOSE: Literal["CLOSE"]
TERMINATE: Literal["TERMINATE"]
else:
RUN: int
CLOSE: int
TERMINATE: int
RUN: Literal[0]
CLOSE: Literal[1]
TERMINATE: Literal[2]