8000 Bump gevent to 24.10.* (#12779) · python/typeshed@2d31815 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d31815

Browse files
authored
Bump gevent to 24.10.* (#12779)
1 parent 03fe755 commit 2d31815

File tree

6 files changed

+29
-6
lines changed

6 files changed

+29
-6
lines changed

stubs/gevent/@tests/stubtest_allowlist.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,7 @@ gevent._types
221221
# useful way to use it as a keyword argument; we mark it positional-only.
222222
gevent.pool.GroupMappingMixin.imap
223223
gevent.pool.GroupMappingMixin.imap_unordered
224+
225+
# Importing gevent.monkey.__main__ leads to issues in stubtest, since gevent will
226+
# try to monkeypatch stubtest
227+
gevent.monkey.__main__

stubs/gevent/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "24.2.*"
1+
version = "24.10.*"
22
upstream_repository = "https://github.com/gevent/gevent"
33
requires = ["types-greenlet", "types-psutil"]
44

stubs/gevent/gevent/monkey.pyi renamed to stubs/gevent/gevent/monkey/__init__.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from types import ModuleType
21
from typing import Any
32

3+
from gevent.monkey.api import get_original as get_original, patch_module as patch_module
4+
45
class MonkeyPatchWarning(RuntimeWarning): ...
56

67
def is_module_patched(mod_name: str) -> bool: ...
78
def is_object_patched(mod_name: str, item_name: str) -> bool: ...
8-
def get_original(mod_name: str, item_name: str) -> Any: ...
9-
def patch_module(target_module: ModuleType, source_module: ModuleType, items: list[str] | None = None) -> bool: ...
109
def patch_os() -> None: ...
1110
def patch_queue() -> None: ...
1211
def patch_time() -> None: ...

stubs/gevent/gevent/monkey/api.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from types import ModuleType
2+
from typing import Any
3+
4+
def get_original(mod_name: str, item_name: str) -> Any: ...
5+
def patch_item(module: ModuleType, attr: str, newitem: object) -> None: ...
6+
def remove_item(module: ModuleType, attr: str) -> None: ...
7+
def patch_module(target_module: ModuleType, source_module: ModuleType, items: list[str] | None = None) -> bool: ...

stubs/gevent/gevent/queue.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from collections import deque
23
from collections.abc import Iterable
34

@@ -9,7 +10,12 @@ from typing_extensions import Self
910
from gevent._waiter import Waiter
1011
from gevent.hub import Hub
1112

12-
__all__ = ["Queue", "PriorityQueue", "LifoQueue", "SimpleQueue", "JoinableQueue", "Channel", "Empty", "Full"]
13+
__all__ = ["Queue", "PriorityQueue", "LifoQueue", "SimpleQueue", "JoinableQueue", "Channel", "Empty", "Full", "ShutDown"]
14+
15+
if sys.version_info >= (3, 13):
16+
from queue import ShutDown as ShutDown
17+
else:
18+
class ShutDown(Exception): ...
1319

1420
_T = TypeVar("_T")
1521

@@ -19,6 +25,7 @@ class Queue(Generic[_T]):
1925
@property
2026
def queue(self) -> deque[_T]: ... # readonly in Cython
2127
maxsize: int | None
28+
is_shutdown: bool
2229
@overload
2330
def __init__(self, maxsize: int | None = None) -> None: ...
2431
@overload
@@ -35,6 +42,7 @@ class Queue(Generic[_T]):
3542
def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
3643
def put_nowait(self, item: _T) -> None: ...
3744
def qsize(self) -> int: ...
45+
def shutdown(self, immediate: bool = False) -> None: ...
3846
def __bool__(self) -> bool: ...
3947
def __iter__(self) -> Self: ...
4048
def __len__(self) -> int: ...

stubs/gevent/gevent/timeout.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections.abc import Callable
22
from types import TracebackType
3-
from typing import Any, Literal, TypeVar, overload
3+
from typing import Any, Literal, Protocol, TypeVar, overload
44
from typing_extensions import ParamSpec, Self
55

66
from gevent._types import _TimerWatcher
@@ -11,6 +11,10 @@ _T2 = TypeVar("_T2")
1111
_TimeoutT = TypeVar("_TimeoutT", bound=Timeout)
1212
_P = ParamSpec("_P")
1313

14+
class _HasSeconds(Protocol):
15+
@property
16+
def seconds(self) -> float | int: ...
17+
1418
class Timeout(BaseException):
1519
seconds: float | None
1620
exception: type[BaseException] | BaseException | None
@@ -39,6 +43,7 @@ class Timeout(BaseException):
3943
def __exit__(
4044
self, typ: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None
4145
) -> Literal[True] | None: ...
46+
def __lt__(self, other: _HasSeconds | float) -> bool: ...
4247

4348
# when timeout_value is provided we unfortunately get no type checking on *args, **kwargs, because
4449
# ParamSpec does not allow mixing in additional keyword arguments

0 commit comments

Comments
 (0)
0