Add __all__ part 2 (#13719)

---------

Co-authored-by: Avasam <samuel.06@hotmail.com>
This commit is contained in:
Semyon Moroz
2025-03-31 18:27:19 -04:00
committed by GitHub
co-authored by Avasam
parent 0104531422
commit a3c8fce58d
132 changed files with 1057 additions and 171 deletions
@@ -1,40 +1,8 @@
# TODO: missing from stub
gevent._abstract_linkable.__all__
gevent._ffi.loop.__all__
gevent._ffi.watcher.__all__
gevent._greenlet_primitives.__all__
gevent._ident.__all__
gevent._imap.__all__
gevent.backdoor.__all__
gevent.baseserver.__all__
gevent.event.__all__
gevent.events.__all__
gevent.exceptions.__all__
gevent.fileobject.__all__
gevent.greenlet.__all__
gevent.hub.__all__
gevent.libev.__all__
gevent.libev.corecext.__all__
gevent.libuv.__all__
gevent.libuv.loop.__all__
gevent.libuv.watcher.__all__
gevent.local.__all__
gevent.monkey.__all__
gevent.os.__all__
gevent.resolver.__all__
gevent.resolver.blocking.__all__
gevent.resolver.dnspython.__all__
gevent.resolver.thread.__all__
gevent.resolver_thread.__all__
gevent.server.__all__
gevent.signal.__all__
gevent.socket.__all__
gevent.ssl.__all__
gevent.subprocess.__all__
gevent.threadpool.__all__
gevent.timeout.__all__
gevent.util.__all__
gevent.win32util.__all__
# Error: failed to find stubs
# =============================
@@ -66,7 +34,6 @@ gevent._ffi.ERROR
gevent._ffi.GEVENT_DEBUG_LEVEL
gevent._ffi.TRACE
gevent._ffi.loop.AbstractLoop.async
gevent._ffi.loop.assign_standard_callbacks
gevent._fileobjectcommon.UniversalNewlineBytesWrapper
gevent._waiter.Waiter.switch_args
@@ -79,8 +46,6 @@ gevent.libuv.watcher.watcher.feed
# unnecessary python 2 compatibility stuff
gevent._config.Config.trace_malloc
gevent._imap.IMapUnordered.next
gevent.monkey.patch_builtins
gevent.monkey.patch_sys
gevent.pywsgi.Environ.iteritems
# weird method that doesn't work with this being generic, so we removed it
@@ -1,9 +1,3 @@
# TODO: missing from stub
gevent.ares.__all__
gevent.libev.corecffi.__all__
gevent.resolver.ares.__all__
gevent.resolver_ares.__all__
# Error: is not present in stub
# =============================
# internal API stuff we dropped because it wasn't necessary
@@ -1,9 +1,3 @@
# TODO: missing from stub
gevent.ares.__all__
gevent.libev.corecffi.__all__
gevent.resolver.ares.__all__
gevent.resolver_ares.__all__
# Error: is not present in stub
# =============================
# internal API stuff we dropped because it wasn't necessary
@@ -1,6 +1,7 @@
# Error: is not present in stub
# =============================
# these get exported but don't actually work on win32 so we ignore them
gevent.signal.__all__
gevent.signal.getsignal
gevent.signal.signal
@@ -11,3 +11,5 @@ class AbstractLinkable:
def rawlink(self, callback: Callable[[Self], object], /) -> None: ...
def ready(self) -> bool: ...
def unlink(self, callback: Callable[[Self], object], /) -> None: ...
__all__ = ["AbstractLinkable"]
+7 -1
View File
@@ -1,6 +1,6 @@
import sys
from _typeshed import FileDescriptor
from collections.abc import Callable
from collections.abc import Callable, Sequence
from types import TracebackType
from typing import Protocol
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
@@ -17,6 +17,10 @@ class _SupportsHandleError(Protocol):
_ErrorHandler: TypeAlias = _ErrorHandlerFunc | _SupportsHandleError
def assign_standard_callbacks(
ffi: object, lib: object, callbacks_class: Callable[[object], object], extras: Sequence[tuple[object, object]] = ...
) -> object: ...
class AbstractLoop:
CALLBACK_CHECK_COUNT: int
error_handler: _ErrorHandler | None
@@ -78,3 +82,5 @@ class AbstractLoop:
def run_callback_threadsafe(self, func: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> _Callback: ...
def callback(self, priority: float | None = ...) -> _Callback: ...
def fileno(self) -> FileDescriptor | None: ...
__all__ = ["AbstractLoop", "assign_standard_callbacks"]
+2
View File
@@ -89,3 +89,5 @@ class StatMixin:
def prev(self) -> _StatResult | None: ...
@property
def interval(self) -> float: ...
__all__: list[str] = []
@@ -14,3 +14,5 @@ class SwitchOutGreenletWithLoop(TrackedRawGreenlet):
def loop(self, value: _Loop) -> None: ...
def switch(self) -> Any: ...
def switch_out(self) -> NoReturn: ...
__all__ = ["TrackedRawGreenlet", "SwitchOutGreenletWithLoop"]
+2
View File
@@ -10,3 +10,5 @@ class IdentRegistry:
def __init__(self) -> None: ...
def get_ident(self, obj: object) -> int: ...
def __len__(self) -> int: ...
__all__ = ["IdentRegistry"]
+2
View File
@@ -22,3 +22,5 @@ class IMapUnordered(Greenlet[_P, _T]):
class IMap(IMapUnordered[_P, _T]):
index: int
__all__ = ["IMapUnordered", "IMap"]
+5
View File
@@ -1 +1,6 @@
import sys
from gevent.resolver.cares import *
if sys.platform != "win32":
__all__ = ["channel"]
+2
View File
@@ -43,3 +43,5 @@ class BackdoorServer(StreamServer):
ciphers: str = ...,
) -> None: ...
def handle(self, conn: _GeventSocket, _address: _Address) -> None: ...
__all__ = ["BackdoorServer"]
+2
View File
@@ -63,3 +63,5 @@ class BaseServer(Generic[_P]):
def stop(self, timeout: float | None = None) -> None: ...
def serve_forever(self, stop_timeout: float | None = None) -> None: ...
def is_fatal_error(self, ex: BaseException) -> bool: ...
__all__ = ["BaseServer"]
+2
View File
@@ -61,3 +61,5 @@ class AsyncResult(AbstractLinkable, Generic[_T]):
def done(self) -> bool: ...
def cancel(self) -> Literal[False]: ...
def cancelled(self) -> Literal[False]: ...
__all__ = ["Event", "AsyncResult"]
+32
View File
@@ -163,3 +163,35 @@ class IGeventDidPatchAllEvent(IGeventDidPatchEvent): ...
@implementer(IGeventDidPatchAllEvent)
class GeventDidPatchAllEvent(_PatchAllMixin, GeventDidPatchEvent):
ENTRY_POINT_NAME: str
__all__ = [
"subscribers",
# monitor thread
"IEventLoopBlocked",
"EventLoopBlocked",
"IMemoryUsageThresholdExceeded",
"MemoryUsageThresholdExceeded",
"IMemoryUsageUnderThreshold",
"MemoryUsageUnderThreshold",
# Hub
"IPeriodicMonitorThread",
"IPeriodicMonitorThreadStartedEvent",
"PeriodicMonitorThreadStartedEvent",
# monkey
"IGeventPatchEvent",
"GeventPatchEvent",
"IGeventWillPatchEvent",
"DoNotPatch",
"GeventWillPatchEvent",
"IGeventDidPatchEvent",
"IGeventWillPatchModuleEvent",
"GeventWillPatchModuleEvent",
"IGeventDidPatchModuleEvent",
"GeventDidPatchModuleEvent",
"IGeventWillPatchAllEvent",
"GeventWillPatchAllEvent",
"IGeventDidPatchBuiltinModulesEvent",
"GeventDidPatchBuiltinModulesEvent",
"IGeventDidPatchAllEvent",
"GeventDidPatchAllEvent",
]
+2
View File
@@ -13,3 +13,5 @@ class InvalidThreadUseError(RuntimeError): ...
class HubDestroyed(GreenletExit):
destroy_loop: bool
def __init__(self, destroy_loop: bool) -> None: ...
__all__ = ["LoopExit"]
+2
View File
@@ -149,7 +149,9 @@ if sys.platform != "win32":
) -> None: ...
_FileObjectType: TypeAlias = type[FileObjectPosix[Any, Any] | FileObjectBlock[Any, Any] | FileObjectThread[Any, Any]]
__all__ = ["FileObjectPosix", "FileObjectThread", "FileObjectBlock", "FileObject"]
else:
_FileObjectType: TypeAlias = type[FileObjectBlock[Any, Any] | FileObjectThread[Any, Any]]
__all__ = ["FileObjectThread", "FileObjectBlock", "FileObject"]
FileObject: _FileObjectType
+2
View File
@@ -96,3 +96,5 @@ def killall(
block: bool = True,
timeout: float | None = None,
) -> None: ...
__all__ = ["Greenlet", "joinall", "killall"]
+2
View File
@@ -108,3 +108,5 @@ class linkproxy:
obj: object
def __init__(self, callback: Callable[[_T], object], obj: _T) -> None: ...
def __call__(self, *args: object) -> None: ...
__all__ = ["getcurrent", "GreenletExit", "spawn_raw", "sleep", "kill", "signal", "reinit", "get_hub", "Hub", "Waiter"]
+1
View File
@@ -0,0 +1 @@
__all__: list[str] = []
+10
View File
@@ -90,3 +90,13 @@ if sys.platform != "win32":
def origflags_int(self) -> int: ...
@property
def sigfd(self) -> FileDescriptor: ...
__all__ = [
"get_version",
"get_header_version",
"supported_backends",
"recommended_backends",
"embeddable_backends",
"time",
"loop",
]
+10
View File
@@ -34,3 +34,13 @@ class loop(AbstractLoop):
def reset_sigchld(self) -> None: ...
def stat(self, path: str, interval: float = 0.0, ref: bool = True, priority: bool | None = None) -> watcher.stat: ...
__all__ = [
"get_version",
"get_header_version",
"supported_backends",
"recommended_backends",
"embeddable_backends",
"time",
"loop",
]
+1
View File
@@ -0,0 +1 @@
__all__: list[str] = []
+2
View File
@@ -40,3 +40,5 @@ class loop(AbstractLoop):
def fork(self, ref: bool = True, priority: int | None = None) -> watcher.fork: ...
def child(self, pid: int, trace: int = 0, ref: bool = True) -> watcher.child: ...
# prepare is not supported on libuv yet, but we need type_error to annotate that
__all__: list[str] = []
+2
View File
@@ -30,3 +30,5 @@ class signal(_base.SignalMixin, watcher): ...
class idle(_base.IdleMixin, watcher): ...
class check(_base.CheckMixin, watcher): ...
class prepare(_base.PrepareMixin, watcher): ...
__all__: list[str] = []
+2
View File
@@ -7,3 +7,5 @@ class local:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __setattr__(self, name: str, value: Any) -> None: ...
__all__ = ["local"]
+28
View File
@@ -13,11 +13,13 @@ def patch_thread(
threading: bool = True, _threading_local: bool = True, Event: bool = True, logging: bool = True, existing_locks: bool = True
) -> None: ...
def patch_socket(dns: bool = True, aggressive: bool = True) -> None: ...
def patch_builtins() -> None: ...
def patch_dns() -> None: ...
def patch_ssl() -> None: ...
def patch_select(aggressive: bool = True) -> None: ...
def patch_selectors(aggressive: bool = True) -> None: ...
def patch_subprocess() -> None: ...
def patch_sys(stdin: bool = True, stdout: bool = True, stderr: bool = True) -> None: ...
def patch_signal() -> None: ...
def patch_all(
socket: bool = True,
@@ -38,3 +40,29 @@ def patch_all(
**kwargs: object,
) -> bool | None: ...
def main() -> dict[str, Any]: ...
__all__ = [
"patch_all",
"patch_builtins",
"patch_dns",
"patch_os",
"patch_queue",
"patch_select",
"patch_signal",
"patch_socket",
"patch_ssl",
"patch_subprocess",
"patch_sys",
"patch_thread",
"patch_time",
# query functions
"get_original",
"is_module_patched",
"is_object_patched",
# plugin API
"patch_module",
# module functions
"main",
# Errors and warnings
"MonkeyPatchWarning",
]
@@ -19,3 +19,5 @@ class AbstractResolver:
) -> _AddrinfoResult: ...
def gethostbyaddr(self, ip_address: str) -> tuple[str, list[str], list[str]]: ...
def getnameinfo(self, sockaddr: _SockAddr, flags: int) -> _NameinfoResult: ...
__all__ = ()
+2
View File
@@ -39,3 +39,5 @@ if sys.platform != "win32":
servers: Sequence[str] | str | None = None,
) -> None: ...
def __del__(self) -> None: ...
__all__ = ["Resolver"]
@@ -11,3 +11,5 @@ class Resolver:
) -> _AddrinfoResult: ...
def gethostbyaddr(self, ip_address: str) -> tuple[str, list[str], list[str]]: ...
def getnameinfo(self, sockaddr: _SockAddr, flags: int) -> _NameinfoResult: ...
__all__ = ["Resolver"]
@@ -7,3 +7,5 @@ class Resolver(AbstractResolver):
def __init__(self, hub: Hub | None = ...) -> None: ...
@property
def resolver(self) -> Any: ... # this is a custom dnspython Resolver
__all__ = ["Resolver"]
+2
View File
@@ -13,3 +13,5 @@ class Resolver:
) -> _AddrinfoResult: ...
def gethostbyaddr(self, ip_address: str) -> tuple[str, list[str], list[str]]: ...
def getnameinfo(self, sockaddr: _SockAddr, flags: int) -> _NameinfoResult: ...
__all__ = ["Resolver"]
+5
View File
@@ -1 +1,6 @@
import sys
from gevent.resolver.ares import *
if sys.platform != "win32":
__all__ = ["Resolver"]
+1
View File
@@ -1 +1,2 @@
from gevent.resolver.thread import *
from gevent.resolver.thread import __all__ as __all__
+2
View File
@@ -82,3 +82,5 @@ class DatagramServer(BaseServer[[_GeventSocket, _Address]]):
def sendto(self, data: ReadableBuffer, address: _StrictAddress, /) -> int: ...
@overload
def sendto(self, data: ReadableBuffer, flags: int, address: _StrictAddress, /) -> int: ...
__all__ = ["StreamServer", "DatagramServer"]
+2
View File
@@ -8,3 +8,5 @@ from signal import _HANDLER, _SIGNUM
if sys.platform != "win32":
def getsignal(signalnum: _SIGNUM) -> _HANDLER: ...
def signal(signalnum: _SIGNUM, handler: _HANDLER) -> _HANDLER: ...
__all__ = ["signal", "getsignal"]
+2
View File
@@ -53,3 +53,5 @@ class ThreadResult(Generic[_T]):
class ThreadPoolExecutor(concurrent.futures.ThreadPoolExecutor):
kill = concurrent.futures.ThreadPoolExecutor.shutdown
__all__ = ["ThreadPool", "ThreadResult", "ThreadPoolExecutor"]
+2
View File
@@ -53,3 +53,5 @@ def with_timeout(
) -> _T1 | _T2: ...
@overload
def with_timeout(seconds: float | None, function: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T: ...
__all__ = ["Timeout", "with_timeout"]
+2
View File
@@ -47,3 +47,5 @@ class assert_switches:
def __init__(self, max_blocking_time: float | None = None, hub_only: bool = False) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
__all__ = ["format_run_info", "print_run_info", "GreenletTree", "wrap_errors", "assert_switches"]
+2
View File
@@ -1,3 +1,5 @@
from collections.abc import Callable
formatError: Callable[[object], str]
__all__ = ["formatError"]