mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-09 18:09:17 +08:00
Remove some pytype workarounds from stdlib (#14470)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
from _asyncio import Future
|
||||
from collections.abc import Callable, Sequence
|
||||
from contextvars import Context
|
||||
from typing import Any, Final
|
||||
from typing_extensions import TypeIs
|
||||
|
||||
from . import futures
|
||||
|
||||
__all__ = ()
|
||||
|
||||
# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py
|
||||
# but it leads to circular import error in pytype tool.
|
||||
# That's why the import order is reversed.
|
||||
from .futures import isfuture as isfuture
|
||||
|
||||
_PENDING: Final = "PENDING" # undocumented
|
||||
_CANCELLED: Final = "CANCELLED" # undocumented
|
||||
_FINISHED: Final = "FINISHED" # undocumented
|
||||
|
||||
def isfuture(obj: object) -> TypeIs[Future[Any]]: ...
|
||||
def _format_callbacks(cb: Sequence[tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented
|
||||
def _future_repr_info(future: futures.Future[Any]) -> list[str]: ... # undocumented
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import sys
|
||||
from _asyncio import Future as Future
|
||||
from concurrent.futures._base import Future as _ConcurrentFuture
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import TypeIs
|
||||
from typing import TypeVar
|
||||
|
||||
from .base_futures import isfuture as isfuture
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
@@ -16,8 +16,4 @@ else:
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py
|
||||
# but it leads to circular import error in pytype tool.
|
||||
# That's why the import order is reversed.
|
||||
def isfuture(obj: object) -> TypeIs[Future[Any]]: ...
|
||||
def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: ...
|
||||
|
||||
Reference in New Issue
Block a user