Skip to content

Commit 07d5d81

Browse files
authored
[pycurl] Update stubs to 7.47.0 (#15971)
1 parent 2c6bf6b commit 07d5d81

5 files changed

Lines changed: 47 additions & 3 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# The runtime computes __all__ dynamically (dir(_pycurl) + AsyncCurlMulti), so
2+
# its exact contents depend on the libcurl feature set pycurl was built against.
3+
pycurl.__all__

stubs/pycurl/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "7.46.0"
1+
version = "7.47.0"
22
upstream-repository = "https://github.com/pycurl/pycurl"
33

44
[tool.stubtest]

stubs/pycurl/pycurl/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from pycurl._pycurl import *
2+
from pycurl.async_multi import AsyncCurlMulti as AsyncCurlMulti
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Stub for the pycurl C extension (imported at runtime as `pycurl._pycurl`).
12
import sys
23
from _typeshed import ReadableBuffer, WriteableBuffer
34
from collections.abc import Callable
@@ -13,6 +14,10 @@ def global_cleanup() -> None: ...
1314
def version_info(
1415
stamp: int = ...,
1516
) -> tuple[int, str, int, str, int, str, int, str, tuple[str, ...], str | None, int, str | None]: ...
17+
def easy_strerror(errornum: int) -> str: ...
18+
def multi_strerror(errornum: int) -> str: ...
19+
def share_strerror(errornum: int) -> str: ...
20+
def url_strerror(errornum: int) -> str: ...
1621

1722
class error(Exception):
1823
# libcurl protocol errors raise (code, message); arg-parse errors raise (message,).
@@ -31,7 +36,7 @@ class HstsEntry(NamedTuple):
3136
include_subdomains: bool
3237

3338
class HstsIndex(NamedTuple):
34-
index: int # type: ignore[assignment]
39+
idx: int
3540
total: int
3641

3742
class KhKey(NamedTuple):
@@ -48,10 +53,11 @@ class CurlSockAddr(NamedTuple):
4853
class Curl:
4954
USERPWD: int
5055
def close(self) -> None: ...
56+
@property
5157
def closed(self) -> bool: ...
5258
# For `setopt()` the exact `value` type depends on the passed `option`; `None` used to unassign:
5359
# http://pycurl.io/docs/latest/curlobject.html#pycurl.Curl.setopt
54-
def setopt(self, option: int, value: Any | None) -> None: ...
60+
def setopt(self, option: int, value: Any | None, *, use_memoryview: bool = False) -> None: ...
5561
def setopt_string(self, option: int, value: str) -> None: ...
5662
def perform(self) -> None: ...
5763
def perform_rb(self) -> bytes: ...
@@ -89,6 +95,7 @@ class Curl:
8995
@disjoint_base
9096
class CurlMulti:
9197
def close(self) -> None: ...
98+
@property
9299
def closed(self) -> bool: ...
93100
def add_handle(self, obj: Curl) -> None: ...
94101
def remove_handle(self, obj: Curl) -> None: ...
@@ -102,6 +109,7 @@ class CurlMulti:
102109
| tuple[str | bytes, ...]
103110
| Callable[[int], Literal[-1, 0] | None]
104111
| Callable[[int, int, Self, Any | None], Literal[-1, 0] | None] # See `assign()` below for `Any | None`
112+
| Callable[[int, Curl | None], object] # `M_NOTIFYFUNCTION` (notify) callback; return value ignored
105113
| None
106114
),
107115
) -> None: ...
@@ -113,6 +121,8 @@ class CurlMulti:
113121
# `assign()` accepts literally any object, it's only passed to callbacks and not processed; `None` used to unassign
114122
def assign(self, sockfd: int, obj: Any | None, /) -> None: ...
115123
def unassign(self, sock_fd: int, /) -> None: ...
124+
def notify_enable(self, *notifications: int) -> None: ...
125+
def notify_disable(self, *notifications: int) -> None: ...
116126
def socket_all(self) -> tuple[int, int]: ...
117127
def timeout(self) -> int: ...
118128
def __contains__(self, key: Curl, /) -> bool: ...
@@ -124,10 +134,13 @@ class CurlMulti:
124134
@disjoint_base
125135
class CurlShare:
126136
def close(self) -> None: ...
137+
@property
127138
def closed(self) -> bool: ...
128139
# Currently this `setopt()` is very limited; `None` to unset is also not accepted:
129140
# http://pycurl.io/docs/latest/curlshareobject.html#pycurl.CurlShare.setopt
130141
def setopt(self, option: int, value: int) -> None: ...
142+
def share(self, *lock_data: int) -> None: ...
143+
def unshare(self, *lock_data: int) -> None: ...
131144
def __enter__(self) -> Self: ...
132145
def __exit__(
133146
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
@@ -166,6 +179,7 @@ class CurlMime:
166179
def add_multipart(self, name: str | bytes | None = None, subtype: str | bytes | None = None) -> CurlMime: ...
167180
def addpart(self) -> CurlMimePart: ...
168181
def close(self) -> None: ...
182+
@property
169183
def closed(self) -> bool: ...
170184
def __enter__(self) -> Self: ...
171185
def __exit__(
@@ -577,6 +591,9 @@ M_MAX_CONCURRENT_STREAMS: Final = 16
577591
M_MAX_HOST_CONNECTIONS: Final = 7
578592
M_MAX_PIPELINE_LENGTH: Final = 8
579593
M_MAX_TOTAL_CONNECTIONS: Final = 13
594+
M_NOTIFYFUNCTION: Final[int]
595+
M_NOTIFY_EASY_DONE: Final[int]
596+
M_NOTIFY_INFO_READ: Final[int]
580597
M_PIPELINING: Final = 3
581598
M_PIPELINING_SERVER_BL: Final = 10012
582599
M_PIPELINING_SITE_BL: Final = 10011
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import asyncio
2+
from collections.abc import Iterable
3+
from types import TracebackType
4+
from typing import Any
5+
from typing_extensions import Self
6+
7+
from pycurl._pycurl import Curl
8+
9+
class AsyncCurlMulti:
10+
def __init__(self, close_handles: bool = False) -> None: ...
11+
def setopt(self, option: int, value: Any) -> None: ... # type of value depends on the option
12+
def add_handle(self, curl: Curl) -> asyncio.Future[Curl]: ...
13+
def remove_handle(self, curl: Curl) -> None: ...
14+
async def perform(self, curl: Curl) -> Curl: ...
15+
def futures(self, curls: Iterable[Curl] | None = None) -> tuple[asyncio.Future[Curl], ...]: ...
16+
@property
17+
def closed(self) -> bool: ...
18+
async def aclose(self) -> None: ...
19+
async def __aenter__(self) -> Self: ...
20+
async def __aexit__(
21+
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
22+
) -> None: ...

0 commit comments

Comments
 (0)