1+ # Stub for the pycurl C extension (imported at runtime as `pycurl._pycurl`).
12import sys
23from _typeshed import ReadableBuffer , WriteableBuffer
34from collections .abc import Callable
@@ -13,6 +14,10 @@ def global_cleanup() -> None: ...
1314def 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
1722class 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
3338class HstsIndex (NamedTuple ):
34- index : int # type: ignore[assignment]
39+ idx : int
3540 total : int
3641
3742class KhKey (NamedTuple ):
@@ -48,10 +53,11 @@ class CurlSockAddr(NamedTuple):
4853class 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
9096class 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
125135class 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
577591M_MAX_HOST_CONNECTIONS : Final = 7
578592M_MAX_PIPELINE_LENGTH : Final = 8
579593M_MAX_TOTAL_CONNECTIONS : Final = 13
594+ M_NOTIFYFUNCTION : Final [int ]
595+ M_NOTIFY_EASY_DONE : Final [int ]
596+ M_NOTIFY_INFO_READ : Final [int ]
580597M_PIPELINING : Final = 3
581598M_PIPELINING_SERVER_BL : Final = 10012
582599M_PIPELINING_SITE_BL : Final = 10011
0 commit comments