mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-11 19:00:52 +08:00
Drop Python 3.8 branches (#13776)
This commit is contained in:
+3
-178
@@ -18,11 +18,9 @@ from .runners import *
|
||||
from .streams import *
|
||||
from .subprocess import *
|
||||
from .tasks import *
|
||||
from .threads import *
|
||||
from .transports import *
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from .threads import *
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from .taskgroups import *
|
||||
from .timeouts import *
|
||||
@@ -412,7 +410,7 @@ if sys.platform == "win32":
|
||||
"WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"WindowsProactorEventLoopPolicy", # from windows_events
|
||||
)
|
||||
elif sys.version_info >= (3, 9):
|
||||
else:
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
"Server", # from base_events
|
||||
@@ -499,91 +497,6 @@ if sys.platform == "win32":
|
||||
"WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"WindowsProactorEventLoopPolicy", # from windows_events
|
||||
)
|
||||
else:
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
"coroutine", # from coroutines
|
||||
"iscoroutinefunction", # from coroutines
|
||||
"iscoroutine", # from coroutines
|
||||
"AbstractEventLoopPolicy", # from events
|
||||
"AbstractEventLoop", # from events
|
||||
"AbstractServer", # from events
|
||||
"Handle", # from events
|
||||
"TimerHandle", # from events
|
||||
"get_event_loop_policy", # from events
|
||||
"set_event_loop_policy", # from events
|
||||
"get_event_loop", # from events
|
||||
"set_event_loop", # from events
|
||||
"new_event_loop", # from events
|
||||
"get_child_watcher", # from events
|
||||
"set_child_watcher", # from events
|
||||
"_set_running_loop", # from events
|
||||
"get_running_loop", # from events
|
||||
"_get_running_loop", # from events
|
||||
"CancelledError", # from exceptions
|
||||
"InvalidStateError", # from exceptions
|
||||
"TimeoutError", # from exceptions
|
||||
"IncompleteReadError", # from exceptions
|
||||
"LimitOverrunError", # from exceptions
|
||||
"SendfileNotAvailableError", # from exceptions
|
||||
"Future", # from futures
|
||||
"wrap_future", # from futures
|
||||
"isfuture", # from futures
|
||||
"Lock", # from locks
|
||||
"Event", # from locks
|
||||
"Condition", # from locks
|
||||
"Semaphore", # from locks
|
||||
"BoundedSemaphore", # from locks
|
||||
"BaseProtocol", # from protocols
|
||||
"Protocol", # from protocols
|
||||
"DatagramProtocol", # from protocols
|
||||
"SubprocessProtocol", # from protocols
|
||||
"BufferedProtocol", # from protocols
|
||||
"run", # from runners
|
||||
"Queue", # from queues
|
||||
"PriorityQueue", # from queues
|
||||
"LifoQueue", # from queues
|
||||
"QueueFull", # from queues
|
||||
"QueueEmpty", # from queues
|
||||
"StreamReader", # from streams
|
||||
"StreamWriter", # from streams
|
||||
"StreamReaderProtocol", # from streams
|
||||
"open_connection", # from streams
|
||||
"start_server", # from streams
|
||||
"create_subprocess_exec", # from subprocess
|
||||
"create_subprocess_shell", # from subprocess
|
||||
"Task", # from tasks
|
||||
"create_task", # from tasks
|
||||
"FIRST_COMPLETED", # from tasks
|
||||
"FIRST_EXCEPTION", # from tasks
|
||||
"ALL_COMPLETED", # from tasks
|
||||
"wait", # from tasks
|
||||
"wait_for", # from tasks
|
||||
"as_completed", # from tasks
|
||||
"sleep", # from tasks
|
||||
"gather", # from tasks
|
||||
"shield", # from tasks
|
||||
"ensure_future", # from tasks
|
||||
"run_coroutine_threadsafe", # from tasks
|
||||
"current_task", # from tasks
|
||||
"all_tasks", # from tasks
|
||||
"_register_task", # from tasks
|
||||
"_unregister_task", # from tasks
|
||||
"_enter_task", # from tasks
|
||||
"_leave_task", # from tasks
|
||||
"BaseTransport", # from transports
|
||||
"ReadTransport", # from transports
|
||||
"WriteTransport", # from transports
|
||||
"Transport", # from transports
|
||||
"DatagramTransport", # from transports
|
||||
"SubprocessTransport", # from transports
|
||||
"SelectorEventLoop", # from windows_events
|
||||
"ProactorEventLoop", # from windows_events
|
||||
"IocpProactor", # from windows_events
|
||||
"DefaultEventLoopPolicy", # from windows_events
|
||||
"WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"WindowsProactorEventLoopPolicy", # from windows_events
|
||||
)
|
||||
else:
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = (
|
||||
@@ -974,7 +887,7 @@ else:
|
||||
"ThreadedChildWatcher", # from unix_events
|
||||
"DefaultEventLoopPolicy", # from unix_events
|
||||
)
|
||||
elif sys.version_info >= (3, 9):
|
||||
else:
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
"Server", # from base_events
|
||||
@@ -1065,94 +978,6 @@ else:
|
||||
"ThreadedChildWatcher", # from unix_events
|
||||
"DefaultEventLoopPolicy", # from unix_events
|
||||
)
|
||||
else:
|
||||
__all__ = (
|
||||
"BaseEventLoop", # from base_events
|
||||
"coroutine", # from coroutines
|
||||
"iscoroutinefunction", # from coroutines
|
||||
"iscoroutine", # from coroutines
|
||||
"AbstractEventLoopPolicy", # from events
|
||||
"AbstractEventLoop", # from events
|
||||
"AbstractServer", # from events
|
||||
"Handle", # from events
|
||||
"TimerHandle", # from events
|
||||
"get_event_loop_policy", # from events
|
||||
"set_event_loop_policy", # from events
|
||||
"get_event_loop", # from events
|
||||
"set_event_loop", # from events
|
||||
"new_event_loop", # from events
|
||||
"get_child_watcher", # from events
|
||||
"set_child_watcher", # from events
|
||||
"_set_running_loop", # from events
|
||||
"get_running_loop", # from events
|
||||
"_get_running_loop", # from events
|
||||
"CancelledError", # from exceptions
|
||||
"InvalidStateError", # from exceptions
|
||||
"TimeoutError", # from exceptions
|
||||
"IncompleteReadError", # from exceptions
|
||||
"LimitOverrunError", # from exceptions
|
||||
"SendfileNotAvailableError", # from exceptions
|
||||
"Future", # from futures
|
||||
"wrap_future", # from futures
|
||||
"isfuture", # from futures
|
||||
"Lock", # from locks
|
||||
"Event", # from locks
|
||||
"Condition", # from locks
|
||||
"Semaphore", # from locks
|
||||
"BoundedSemaphore", # from locks
|
||||
"BaseProtocol", # from protocols
|
||||
"Protocol", # from protocols
|
||||
"DatagramProtocol", # from protocols
|
||||
"SubprocessProtocol", # from protocols
|
||||
"BufferedProtocol", # from protocols
|
||||
"run", # from runners
|
||||
"Queue", # from queues
|
||||
"PriorityQueue", # from queues
|
||||
"LifoQueue", # from queues
|
||||
"QueueFull", # from queues
|
||||
"QueueEmpty", # from queues
|
||||
"StreamReader", # from streams
|
||||
"StreamWriter", # from streams
|
||||
"StreamReaderProtocol", # from streams
|
||||
"open_connection", # from streams
|
||||
"start_server", # from streams
|
||||
"open_unix_connection", # from streams
|
||||
"start_unix_server", # from streams
|
||||
"create_subprocess_exec", # from subprocess
|
||||
"create_subprocess_shell", # from subprocess
|
||||
"Task", # from tasks
|
||||
"create_task", # from tasks
|
||||
"FIRST_COMPLETED", # from tasks
|
||||
"FIRST_EXCEPTION", # from tasks
|
||||
"ALL_COMPLETED", # from tasks
|
||||
"wait", # from tasks
|
||||
"wait_for", # from tasks
|
||||
"as_completed", # from tasks
|
||||
"sleep", # from tasks
|
||||
"gather", # from tasks
|
||||
"shield", # from tasks
|
||||
"ensure_future", # from tasks
|
||||
"run_coroutine_threadsafe", # from tasks
|
||||
"current_task", # from tasks
|
||||
"all_tasks", # from tasks
|
||||
"_register_task", # from tasks
|
||||
"_unregister_task", # from tasks
|
||||
"_enter_task", # from tasks
|
||||
"_leave_task", # from tasks
|
||||
"BaseTransport", # from transports
|
||||
"ReadTransport", # from transports
|
||||
"WriteTransport", # from transports
|
||||
"Transport", # from transports
|
||||
"DatagramTransport", # from transports
|
||||
"SubprocessTransport", # from transports
|
||||
"SelectorEventLoop", # from unix_events
|
||||
"AbstractChildWatcher", # from unix_events
|
||||
"SafeChildWatcher", # from unix_events
|
||||
"FastChildWatcher", # from unix_events
|
||||
"MultiLoopChildWatcher", # from unix_events
|
||||
"ThreadedChildWatcher", # from unix_events
|
||||
"DefaultEventLoopPolicy", # from unix_events
|
||||
)
|
||||
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ from typing import IO, Any, Literal, TypeVar, overload
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 9):
|
||||
__all__ = ("BaseEventLoop", "Server")
|
||||
else:
|
||||
__all__ = ("BaseEventLoop",)
|
||||
__all__ = ("BaseEventLoop", "Server")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
@@ -485,7 +482,7 @@ class BaseEventLoop(AbstractEventLoop):
|
||||
def set_debug(self, enabled: bool) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
async def shutdown_default_executor(self, timeout: float | None = None) -> None: ...
|
||||
elif sys.version_info >= (3, 9):
|
||||
else:
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
+20
-33
@@ -138,27 +138,19 @@ class AbstractEventLoop:
|
||||
@abstractmethod
|
||||
async def shutdown_asyncgens(self) -> None: ...
|
||||
# Methods scheduling callbacks. All these return Handles.
|
||||
if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2
|
||||
@abstractmethod
|
||||
def call_soon(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_later(
|
||||
self, delay: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def call_at(
|
||||
self, when: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def call_soon(self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_later(self, delay: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def call_at(self, when: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> TimerHandle: ...
|
||||
|
||||
# "context" added in 3.9.10/3.10.2 for call_*
|
||||
@abstractmethod
|
||||
def call_soon(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_later(
|
||||
self, delay: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def call_at(
|
||||
self, when: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def time(self) -> float: ...
|
||||
# Future methods
|
||||
@@ -179,15 +171,11 @@ class AbstractEventLoop:
|
||||
@abstractmethod
|
||||
def get_task_factory(self) -> _TaskFactory | None: ...
|
||||
# Methods for interacting with threads
|
||||
if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> Handle: ...
|
||||
|
||||
# "context" added in 3.9.10/3.10.2
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
@abstractmethod
|
||||
def run_in_executor(self, executor: Executor | None, func: Callable[[Unpack[_Ts]], _T], *args: Unpack[_Ts]) -> Future[_T]: ...
|
||||
@abstractmethod
|
||||
@@ -607,9 +595,8 @@ class AbstractEventLoop:
|
||||
def get_debug(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def set_debug(self, enabled: bool) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@abstractmethod
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
@abstractmethod
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
|
||||
class AbstractEventLoopPolicy:
|
||||
@abstractmethod
|
||||
|
||||
@@ -2,7 +2,7 @@ import enum
|
||||
import sys
|
||||
from _typeshed import Unused
|
||||
from collections import deque
|
||||
from collections.abc import Callable, Generator
|
||||
from collections.abc import Callable
|
||||
from types import TracebackType
|
||||
from typing import Any, Literal, TypeVar
|
||||
from typing_extensions import Self
|
||||
@@ -23,29 +23,11 @@ else:
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
class _ContextManagerMixin:
|
||||
async def __aenter__(self) -> None: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
class _ContextManager:
|
||||
def __init__(self, lock: Lock | Semaphore) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, *args: Unused) -> None: ...
|
||||
|
||||
class _ContextManagerMixin:
|
||||
# Apparently this exists to *prohibit* use as a context manager.
|
||||
# def __enter__(self) -> NoReturn: ... see: https://github.com/python/typing/issues/1043
|
||||
# def __exit__(self, *args: Any) -> None: ...
|
||||
def __iter__(self) -> Generator[Any, None, _ContextManager]: ...
|
||||
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
|
||||
async def __aenter__(self) -> None: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
) -> None: ...
|
||||
class _ContextManagerMixin:
|
||||
async def __aenter__(self) -> None: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
class Lock(_ContextManagerMixin, _LoopBoundMixin):
|
||||
_waiters: deque[Future[Any]] | None
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import sys
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from .mixins import _LoopBoundMixin
|
||||
else:
|
||||
@@ -48,8 +46,7 @@ class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
|
||||
def get_nowait(self) -> _T: ...
|
||||
async def join(self) -> None: ...
|
||||
def task_done(self) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, type: Any, /) -> GenericAlias: ...
|
||||
def __class_getitem__(cls, type: Any, /) -> GenericAlias: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def shutdown(self, immediate: bool = False) -> None: ...
|
||||
|
||||
|
||||
@@ -407,10 +407,8 @@ else:
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
_TaskCompatibleCoro: TypeAlias = Coroutine[Any, Any, _T_co]
|
||||
elif sys.version_info >= (3, 9):
|
||||
_TaskCompatibleCoro: TypeAlias = Generator[_TaskYieldType, None, _T_co] | Coroutine[Any, Any, _T_co]
|
||||
else:
|
||||
_TaskCompatibleCoro: TypeAlias = Generator[_TaskYieldType, None, _T_co] | Awaitable[_T_co]
|
||||
_TaskCompatibleCoro: TypeAlias = Generator[_TaskYieldType, None, _T_co] | Coroutine[Any, Any, _T_co]
|
||||
|
||||
def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ if sys.platform != "win32":
|
||||
"DefaultEventLoopPolicy",
|
||||
"EventLoop",
|
||||
)
|
||||
elif sys.version_info >= (3, 9):
|
||||
else:
|
||||
# adds PidfdChildWatcher
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
@@ -42,16 +42,6 @@ if sys.platform != "win32":
|
||||
"ThreadedChildWatcher",
|
||||
"DefaultEventLoopPolicy",
|
||||
)
|
||||
else:
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"AbstractChildWatcher",
|
||||
"SafeChildWatcher",
|
||||
"FastChildWatcher",
|
||||
"MultiLoopChildWatcher",
|
||||
"ThreadedChildWatcher",
|
||||
"DefaultEventLoopPolicy",
|
||||
)
|
||||
|
||||
# This is also technically not available on Win,
|
||||
# but other parts of typeshed need this definition.
|
||||
@@ -239,16 +229,15 @@ if sys.platform != "win32":
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
class PidfdChildWatcher(AbstractChildWatcher):
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
|
||||
) -> None: ...
|
||||
def is_active(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def add_child_handler(
|
||||
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
|
||||
) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
class PidfdChildWatcher(AbstractChildWatcher):
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
|
||||
) -> None: ...
|
||||
def is_active(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def add_child_handler(
|
||||
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
|
||||
) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user