11import sys
2- from _typeshed import Self , StrOrBytesPath
2+ from _typeshed import ReadableBuffer , Self , StrOrBytesPath
33from datetime import date , datetime , time
44from types import TracebackType
5- from typing import Any , Callable , Generator , Iterable , Iterator , Protocol , TypeVar
5+ from typing import Any , Callable , Generator , Iterable , Iterator , Protocol , TypeVar , overload
66from typing_extensions import Literal , final
77
88_T = TypeVar ("_T" )
9+ _SqliteData = str | bytes | int | float | None
910
1011paramstyle : str
1112threadsafety : int
@@ -128,6 +129,18 @@ class _AggregateProtocol(Protocol):
128129 def step (self , value : int ) -> None : ...
129130 def finalize (self ) -> int : ...
130131
132+ class _SingleParamWindowAggregateClass (Protocol ):
133+ def step (self , __param : Any ) -> None : ...
134+ def inverse (self , __param : Any ) -> None : ...
135+ def value (self ) -> _SqliteData : ...
136+ def finalize (self ) -> _SqliteData : ...
137+
138+ class _WindowAggretateClass (Protocol ):
139+ step : Callable [..., None ]
140+ inverse : Callable [..., None ]
141+ def value (self ) -> _SqliteData : ...
142+ def finalize (self ) -> _SqliteData : ...
143+
131144class Connection :
132145 DataError : Any
133146 DatabaseError : Any
@@ -146,8 +159,23 @@ class Connection:
146159 total_changes : Any
147160 def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
148161 def close (self ) -> None : ...
162+ if sys .version_info >= (3 , 11 ):
163+ def blobopen (self , __table : str , __column : str , __row : int , * , readonly : bool = ..., name : str = ...) -> Blob : ...
164+
149165 def commit (self ) -> None : ...
150166 def create_aggregate (self , name : str , n_arg : int , aggregate_class : Callable [[], _AggregateProtocol ]) -> None : ...
167+ if sys .version_info >= (3 , 11 ):
168+ # num_params determines how many params will be passed to the aggregate class. We provide an overload
169+ # for the case where num_params = 1, which is expected to be the common case.
170+ @overload
171+ def create_window_function (
172+ self , __name : str , __num_params : Literal [1 ], aggregate_class : Callable [[], _SingleParamWindowAggregateClass ]
173+ ) -> None : ...
174+ @overload
175+ def create_window_function (
176+ self , __name : str , __num_params : int , aggregate_class : Callable [[], _WindowAggretateClass ]
177+ ) -> None : ...
178+
151179 def create_collation (self , __name : str , __callback : Any ) -> None : ...
152180 if sys .version_info >= (3 , 8 ):
153181 def create_function (self , name : str , narg : int , func : Any , * , deterministic : bool = ...) -> None : ...
@@ -181,6 +209,11 @@ class Connection:
181209 name : str = ...,
182210 sleep : float = ...,
183211 ) -> None : ...
212+ if sys .version_info >= (3 , 11 ):
213+ def setlimit (self , __category : int , __limit : int ) -> int : ...
214+ def getlimit (self , __category : int ) -> int : ...
215+ def serialize (self , * , name : str = ...) -> bytes : ...
216+ def deserialize (self , __data : ReadableBuffer , * , name : str = ...) -> None : ...
184217
185218 def __call__ (self , * args : Any , ** kwargs : Any ) -> Any : ...
186219 def __enter__ (self : Self ) -> Self : ...
@@ -253,3 +286,13 @@ if sys.version_info < (3, 8):
253286 def __init__ (self , * args , ** kwargs ): ...
254287
255288class Warning (Exception ): ...
289+
290+ if sys .version_info >= (3 , 11 ):
291+ class Blob :
292+ def close (self ) -> None : ...
293+ def read (self , __length : int = ...) -> bytes : ...
294+ def write (self , __data : bytes ) -> None : ...
295+ def tell (self ) -> int : ...
296+ # whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END
297+ def seek (self , __offset : int , __whence : int = ...) -> None : ...
298+ def __len__ (self ) -> int : ...
0 commit comments