Remove Python 3.6 branches from typeshed (#8269)

This commit is contained in:
Alex Waygood
2022-07-11 09:55:17 +01:00
committed by GitHub
parent 29c17ffb47
commit edc0ecd857
114 changed files with 1016 additions and 2642 deletions

View File

@@ -1,25 +1,10 @@
import sys
if sys.version_info >= (3, 7):
__all__ = (
"FIRST_COMPLETED",
"FIRST_EXCEPTION",
"ALL_COMPLETED",
"CancelledError",
"TimeoutError",
"BrokenExecutor",
"Future",
"Executor",
"wait",
"as_completed",
"ProcessPoolExecutor",
"ThreadPoolExecutor",
)
from ._base import (
ALL_COMPLETED as ALL_COMPLETED,
FIRST_COMPLETED as FIRST_COMPLETED,
FIRST_EXCEPTION as FIRST_EXCEPTION,
BrokenExecutor as BrokenExecutor,
CancelledError as CancelledError,
Executor as Executor,
Future as Future,
@@ -32,5 +17,18 @@ from .thread import ThreadPoolExecutor as ThreadPoolExecutor
if sys.version_info >= (3, 8):
from ._base import InvalidStateError as InvalidStateError
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor as BrokenExecutor
__all__ = (
"FIRST_COMPLETED",
"FIRST_EXCEPTION",
"ALL_COMPLETED",
"CancelledError",
"TimeoutError",
"BrokenExecutor",
"Future",
"Executor",
"wait",
"as_completed",
"ProcessPoolExecutor",
"ThreadPoolExecutor",
)

View File

@@ -30,8 +30,7 @@ class TimeoutError(Error): ...
if sys.version_info >= (3, 8):
class InvalidStateError(Error): ...
if sys.version_info >= (3, 7):
class BrokenExecutor(RuntimeError): ...
class BrokenExecutor(RuntimeError): ...
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)

View File

@@ -8,7 +8,7 @@ from types import TracebackType
from typing import Any, Generic, TypeVar
from weakref import ref
from ._base import Executor, Future
from ._base import BrokenExecutor, Executor, Future
_threads_wakeups: MutableMapping[Any, Any]
_global_shutdown: bool
@@ -68,27 +68,26 @@ class _CallItem:
kwargs: Mapping[str, Any]
def __init__(self, work_id: int, fn: Callable[..., Any], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
if sys.version_info >= (3, 7):
class _SafeQueue(Queue[Future[Any]]):
pending_work_items: dict[int, _WorkItem[Any]]
shutdown_lock: Lock
thread_wakeup: _ThreadWakeup
if sys.version_info >= (3, 9):
def __init__(
self,
max_size: int | None = ...,
*,
ctx: BaseContext,
pending_work_items: dict[int, _WorkItem[Any]],
shutdown_lock: Lock,
thread_wakeup: _ThreadWakeup,
) -> None: ...
else:
def __init__(
self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
) -> None: ...
class _SafeQueue(Queue[Future[Any]]):
pending_work_items: dict[int, _WorkItem[Any]]
shutdown_lock: Lock
thread_wakeup: _ThreadWakeup
if sys.version_info >= (3, 9):
def __init__(
self,
max_size: int | None = ...,
*,
ctx: BaseContext,
pending_work_items: dict[int, _WorkItem[Any]],
shutdown_lock: Lock,
thread_wakeup: _ThreadWakeup,
) -> None: ...
else:
def __init__(
self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
) -> None: ...
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...], None, None]: ...
def _process_chunk(fn: Callable[..., Any], chunk: tuple[Any, None, None]) -> Generator[Any, None, None]: ...
@@ -116,7 +115,7 @@ if sys.version_info >= (3, 11):
max_tasks: int | None = ...,
) -> None: ...
elif sys.version_info >= (3, 7):
else:
def _process_worker(
call_queue: Queue[_CallItem],
result_queue: SimpleQueue[_ResultItem],
@@ -124,9 +123,6 @@ elif sys.version_info >= (3, 7):
initargs: tuple[Any, ...],
) -> None: ...
else:
def _process_worker(call_queue: Queue[_CallItem], result_queue: SimpleQueue[_ResultItem]) -> None: ...
if sys.version_info >= (3, 9):
class _ExecutorManagerThread(Thread):
thread_wakeup: _ThreadWakeup
@@ -155,13 +151,7 @@ _system_limited: bool | None
def _check_system_limits() -> None: ...
def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> Any: ...
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenProcessPool(BrokenExecutor): ...
else:
class BrokenProcessPool(RuntimeError): ...
class BrokenProcessPool(BrokenExecutor): ...
class ProcessPoolExecutor(Executor):
_mp_context: BaseContext | None = ...
@@ -189,7 +179,7 @@ class ProcessPoolExecutor(Executor):
*,
max_tasks_per_child: int | None = ...,
) -> None: ...
elif sys.version_info >= (3, 7):
else:
def __init__(
self,
max_workers: int | None = ...,
@@ -197,8 +187,6 @@ class ProcessPoolExecutor(Executor):
initializer: Callable[..., object] | None = ...,
initargs: tuple[Any, ...] = ...,
) -> None: ...
else:
def __init__(self, max_workers: int | None = ...) -> None: ...
if sys.version_info >= (3, 9):
def _start_executor_manager_thread(self) -> None: ...

View File

@@ -5,7 +5,7 @@ from threading import Lock, Semaphore, Thread
from typing import Any, Generic, TypeVar
from weakref import ref
from ._base import Executor, Future
from ._base import BrokenExecutor, Executor, Future
_threads_queues: Mapping[Any, Any]
_shutdown: bool
@@ -28,21 +28,14 @@ class _WorkItem(Generic[_S]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
if sys.version_info >= (3, 7):
def _worker(
executor_reference: ref[Any],
work_queue: queue.SimpleQueue[Any],
initializer: Callable[..., object],
initargs: tuple[Any, ...],
) -> None: ...
def _worker(
executor_reference: ref[Any],
work_queue: queue.SimpleQueue[Any],
initializer: Callable[..., object],
initargs: tuple[Any, ...],
) -> None: ...
else:
def _worker(executor_reference: ref[Any], work_queue: queue.Queue[Any]) -> None: ...
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenThreadPool(BrokenExecutor): ...
class BrokenThreadPool(BrokenExecutor): ...
class ThreadPoolExecutor(Executor):
_max_workers: int
@@ -54,21 +47,13 @@ class ThreadPoolExecutor(Executor):
_thread_name_prefix: str | None = ...
_initializer: Callable[..., None] | None = ...
_initargs: tuple[Any, ...] = ...
if sys.version_info >= (3, 7):
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
else:
_work_queue: queue.Queue[_WorkItem[Any]]
if sys.version_info >= (3, 7):
def __init__(
self,
max_workers: int | None = ...,
thread_name_prefix: str = ...,
initializer: Callable[..., object] | None = ...,
initargs: tuple[Any, ...] = ...,
) -> None: ...
else:
def __init__(self, max_workers: int | None = ..., thread_name_prefix: str = ...) -> None: ...
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
def __init__(
self,
max_workers: int | None = ...,
thread_name_prefix: str = ...,
initializer: Callable[..., object] | None = ...,
initargs: tuple[Any, ...] = ...,
) -> None: ...
def _adjust_thread_count(self) -> None: ...
if sys.version_info >= (3, 7):
def _initializer_failed(self) -> None: ...
def _initializer_failed(self) -> None: ...