mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-02 22:18:28 +08:00
Add @disjoint_base decorator to the third-party stubs (#14716)
This commit is contained in:
@@ -64,6 +64,10 @@ gevent.socket.SocketType.makefile
|
||||
gevent.socket.SocketType.sendfile
|
||||
gevent.socket.SocketType.set_inheritable
|
||||
|
||||
# Pretends to re-export a type marked @disjoint_base in the stubs, but runtime
|
||||
# defines __slots__
|
||||
gevent.socket.SocketType$
|
||||
|
||||
# zope.interface related attributes we can ignore
|
||||
gevent.[\w\.]+\.__implemented__
|
||||
gevent.[\w\.]+\.__providedBy__
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
from abc import abstractmethod
|
||||
from typing import Any, NoReturn
|
||||
from typing_extensions import disjoint_base
|
||||
|
||||
from gevent._types import _Loop
|
||||
from greenlet import greenlet
|
||||
|
||||
class TrackedRawGreenlet(greenlet): ...
|
||||
|
||||
@disjoint_base
|
||||
class SwitchOutGreenletWithLoop(TrackedRawGreenlet):
|
||||
@property
|
||||
@abstractmethod
|
||||
|
||||
@@ -2,7 +2,7 @@ from _typeshed import FileDescriptor
|
||||
from collections.abc import Callable, Collection, Iterable
|
||||
from types import TracebackType
|
||||
from typing import Any, Generic, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Self, TypeVarTuple, Unpack
|
||||
from typing_extensions import Self, TypeVarTuple, Unpack, disjoint_base
|
||||
|
||||
from gevent._greenlet_primitives import SwitchOutGreenletWithLoop
|
||||
from gevent._types import _Loop, _Watcher
|
||||
@@ -32,6 +32,7 @@ class WaitOperationsGreenlet(SwitchOutGreenletWithLoop):
|
||||
) -> None: ...
|
||||
def cancel_wait(self, watcher: _Watcher, error: type[BaseException] | BaseException, close_watcher: bool = False) -> None: ...
|
||||
|
||||
@disjoint_base
|
||||
class _WaitIterator(Generic[_T]):
|
||||
def __init__(self, objects: Collection[_T], hub: Hub, timeout: float, count: None | int) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import ParamSpec, Self
|
||||
from typing_extensions import ParamSpec, Self, disjoint_base
|
||||
|
||||
from gevent.greenlet import Greenlet
|
||||
from gevent.queue import UnboundQueue
|
||||
@@ -12,6 +12,7 @@ _P = ParamSpec("_P")
|
||||
# returned by some public API functions, we don't bother adding a whole bunch of overloads to handle
|
||||
# the case of 1-n Iterables being passed in and just go for the fully unsafe signature
|
||||
# we do the crazy overloads instead in the functions that create these objects
|
||||
@disjoint_base
|
||||
class IMapUnordered(Greenlet[_P, _T]):
|
||||
finished: bool
|
||||
# it may contain an undocumented Failure object
|
||||
@@ -20,6 +21,7 @@ class IMapUnordered(Greenlet[_P, _T]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@disjoint_base
|
||||
class IMap(IMapUnordered[_P, _T]):
|
||||
index: int
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import weakref
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, ClassVar, Generic, TypeVar, overload
|
||||
from typing_extensions import ParamSpec, Self
|
||||
from typing_extensions import ParamSpec, Self, disjoint_base
|
||||
|
||||
import greenlet
|
||||
from gevent._types import _Loop
|
||||
@@ -12,6 +12,7 @@ _T = TypeVar("_T")
|
||||
_G = TypeVar("_G", bound=greenlet.greenlet)
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
@disjoint_base
|
||||
class Greenlet(greenlet.greenlet, Generic[_P, _T]):
|
||||
# we can't use _P.args/_P.kwargs here because pyright will complain
|
||||
# mypy doesn't seem to mind though
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import FileDescriptor
|
||||
from collections.abc import Callable, Sequence
|
||||
from types import TracebackType
|
||||
from typing import Any
|
||||
from typing_extensions import ParamSpec
|
||||
from typing_extensions import ParamSpec, disjoint_base
|
||||
|
||||
from gevent._ffi.loop import _ErrorHandler
|
||||
from gevent._types import _Callback
|
||||
@@ -20,7 +20,7 @@ if sys.platform != "win32":
|
||||
def recommended_backends() -> list[str | int]: ...
|
||||
def supported_backends() -> list[str | int]: ...
|
||||
def time() -> float: ...
|
||||
|
||||
@disjoint_base
|
||||
class loop:
|
||||
starting_timer_may_update_loop_time: bool
|
||||
error_handler: _ErrorHandler
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from typing import Any, Generic, TypeVar
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, disjoint_base
|
||||
|
||||
from gevent._types import _AddrinfoResult, _Loop, _NameinfoResult, _SockAddr
|
||||
|
||||
@@ -10,6 +10,7 @@ class ares_host_result(tuple[str, list[str], list[str]]):
|
||||
family: int
|
||||
def __new__(cls, family: int, iterable: Iterable[Any]) -> Self: ...
|
||||
|
||||
@disjoint_base
|
||||
class Result(Generic[_T]):
|
||||
exception: BaseException | None
|
||||
value: _T | None
|
||||
@@ -17,6 +18,7 @@ class Result(Generic[_T]):
|
||||
def get(self) -> Any | None: ...
|
||||
def successful(self) -> bool: ...
|
||||
|
||||
@disjoint_base
|
||||
class channel:
|
||||
@property
|
||||
def loop(self) -> _Loop: ...
|
||||
|
||||
Reference in New Issue
Block a user