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
@@ -125,9 +126,27 @@ if sys.version_info < (3, 8):
125
126
def get (self , * args , ** kwargs ) -> None : ...
126
127
127
128
class _AggregateProtocol (Protocol ):
128
- def step (self , value : int ) -> None : ...
129
+ def step (self , value : int ) -> object : ...
129
130
def finalize (self ) -> int : ...
130
131
132
+ class _SingleParamWindowAggregateClass (Protocol ):
133
+ def step (self , __param : Any ) -> object : ...
134
+ def inverse (self , __param : Any ) -> object : ...
135
+ def value (self ) -> _SqliteData : ...
136
+ def finalize (self ) -> _SqliteData : ...
137
+
138
+ class _AnyParamWindowAggregateClass (Protocol ):
139
+ def step (self , * args : Any ) -> object : ...
140
+ def inverse (self , * args : Any ) -> object : ...
141
+ def value (self ) -> _SqliteData : ...
142
+ def finalize (self ) -> _SqliteData : ...
143
+
144
+ class _WindowAggregateClass (Protocol ):
145
+ step : Callable [..., object ]
146
+ inverse : Callable [..., object ]
147
+ def value (self ) -> _SqliteData : ...
148
+ def finalize (self ) -> _SqliteData : ...
149
+
131
150
class Connection :
132
151
DataError : Any
133
152
DatabaseError : Any
@@ -146,8 +165,28 @@ class Connection:
146
165
total_changes : Any
147
166
def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
148
167
def close (self ) -> None : ...
168
+ if sys .version_info >= (3 , 11 ):
169
+ def blobopen (self , __table : str , __column : str , __row : int , * , readonly : bool = ..., name : str = ...) -> Blob : ...
170
+
149
171
def commit (self ) -> None : ...
150
172
def create_aggregate (self , name : str , n_arg : int , aggregate_class : Callable [[], _AggregateProtocol ]) -> None : ...
173
+ if sys .version_info >= (3 , 11 ):
174
+ # num_params determines how many params will be passed to the aggregate class. We provide an overload
175
+ # for the case where num_params = 1, which is expected to be the common case.
176
+ @overload
177
+ def create_window_function (
178
+ self , __name : str , __num_params : Literal [1 ], __aggregate_class : Callable [[], _SingleParamWindowAggregateClass ] | None
179
+ ) -> None : ...
180
+ # And for num_params = -1, which means the aggregate must accept any number of parameters.
181
+ @overload
182
+ def create_window_function (
183
+ self , __name : str , __num_params : Literal [- 1 ], __aggregate_class : Callable [[], _AnyParamWindowAggregateClass ] | None
184
+ ) -> None : ...
185
+ @overload
186
+ def create_window_function (
187
+ self , __name : str , __num_params : int , __aggregate_class : Callable [[], _WindowAggregateClass ] | None
188
+ ) -> None : ...
189
+
151
190
def create_collation (self , __name : str , __callback : Any ) -> None : ...
152
191
if sys .version_info >= (3 , 8 ):
153
192
def create_function (self , name : str , narg : int , func : Any , * , deterministic : bool = ...) -> None : ...
@@ -181,6 +220,11 @@ class Connection:
181
220
name : str = ...,
182
221
sleep : float = ...,
183
222
) -> None : ...
223
+ if sys .version_info >= (3 , 11 ):
224
+ def setlimit (self , __category : int , __limit : int ) -> int : ...
225
+ def getlimit (self , __category : int ) -> int : ...
226
+ def serialize (self , * , name : str = ...) -> bytes : ...
227
+ def deserialize (self , __data : ReadableBuffer , * , name : str = ...) -> None : ...
184
228
185
229
def __call__ (self , * args : Any , ** kwargs : Any ) -> Any : ...
186
230
def __enter__ (self : Self ) -> Self : ...
@@ -253,3 +297,15 @@ if sys.version_info < (3, 8):
253
297
def __init__ (self , * args , ** kwargs ): ...
254
298
255
299
class Warning (Exception ): ...
300
+
301
+ if sys .version_info >= (3 , 11 ):
302
+ class Blob :
303
+ def close (self ) -> None : ...
304
+ def read (self , __length : int = ...) -> bytes : ...
305
+ def write (self , __data : bytes ) -> None : ...
306
+ def tell (self ) -> int : ...
307
+ # whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END
308
+ def seek (self , __offset : int , __whence : int = ...) -> None : ...
309
+ def __len__ (self ) -> int : ...
310
+ def __enter__ (self : Self ) -> Self : ...
311
+ def __exit__ (self , __typ : object , __val : object , __tb : object ) -> Literal [False ]: ...
0 commit comments