mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
multiprocessing.pool: Use Literal and add __all__ (#6815)
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user