1
1
import sys
2
- from _typeshed import Self , StrOrBytesPath
2
+ from _typeshed import ReadableBuffer , Self , StrOrBytesPath
3
3
from datetime import date , datetime , time
4
4
from 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
6
6
from typing_extensions import Literal , final
7
7
8
8
_T = TypeVar ("_T" )
9
+ _SqliteData = str | bytes | int | float | None
9
10
10
11
paramstyle : str
11
12
threadsafety : int
@@ -128,6 +129,18 @@ class _AggregateProtocol(Protocol):
128
129
def step (self , value : int ) -> None : ...
129
130
def finalize (self ) -> int : ...
130
131
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
+
131
144
class Connection :
132
145
DataError : Any
133
146
DatabaseError : Any
@@ -146,8 +159,23 @@ class Connection:
146
159
total_changes : Any
147
160
def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
148
161
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
+
149
165
def commit (self ) -> None : ...
150
166
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
+
151
179
def create_collation (self , __name : str , __callback : Any ) -> None : ...
152
180
if sys .version_info >= (3 , 8 ):
153
181
def create_function (self , name : str , narg : int , func : Any , * , deterministic : bool = ...) -> None : ...
@@ -181,6 +209,11 @@ class Connection:
181
209
name : str = ...,
182
210
sleep : float = ...,
183
211
) -> 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 : ...
184
217
185
218
def __call__ (self , * args : Any , ** kwargs : Any ) -> Any : ...
186
219
def __enter__ (self : Self ) -> Self : ...
@@ -253,3 +286,13 @@ if sys.version_info < (3, 8):
253
286
def __init__ (self , * args , ** kwargs ): ...
254
287
255
288
class 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