basedpyright 1.13.2 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/typeshed-fallback/commit.txt +1 -1
- package/dist/typeshed-fallback/stdlib/VERSIONS +2 -0
- package/dist/typeshed-fallback/stdlib/_ast.pyi +42 -279
- package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
- package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +15 -5
- package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +0 -18
- package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +180 -164
- package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
- package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +16 -0
- package/dist/typeshed-fallback/stdlib/_interpreters.pyi +50 -0
- package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_msi.pyi +94 -92
- package/dist/typeshed-fallback/stdlib/_operator.pyi +0 -24
- package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/_tkinter.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/abc.pyi +12 -4
- package/dist/typeshed-fallback/stdlib/argparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
- package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +35 -4
- package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +107 -15
- package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +23 -4
- package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +107 -12
- package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +86 -86
- package/dist/typeshed-fallback/stdlib/asyncio/windows_utils.pyi +49 -49
- package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
- package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
- package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
- package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/builtins.pyi +0 -1
- package/dist/typeshed-fallback/stdlib/bz2.pyi +59 -6
- package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
- package/dist/typeshed-fallback/stdlib/codecs.pyi +18 -6
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +200 -56
- package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +33 -14
- package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/contextvars.pyi +99 -16
- package/dist/typeshed-fallback/stdlib/csv.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/curses/panel.pyi +16 -4
- package/dist/typeshed-fallback/stdlib/dataclasses.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/datetime.pyi +346 -104
- package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +52 -2
- package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +26 -2
- package/dist/typeshed-fallback/stdlib/difflib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
- package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
- package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +173 -173
- package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +99 -99
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +52 -52
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +27 -27
- package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +24 -24
- package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +39 -39
- package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
- package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +65 -65
- package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/core.pyi +57 -57
- package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
- package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
- package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +149 -149
- package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
- package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
- package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
- package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
- package/dist/typeshed-fallback/stdlib/distutils/log.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +6 -6
- package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/util.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/version.pyi +38 -36
- package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/charset.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/header.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/enum.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/filecmp.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/fileinput.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
- package/dist/typeshed-fallback/stdlib/fractions.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/functools.pyi +65 -13
- package/dist/typeshed-fallback/stdlib/graphlib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hashlib.pyi +42 -14
- package/dist/typeshed-fallback/stdlib/heapq.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hmac.pyi +30 -2
- package/dist/typeshed-fallback/stdlib/http/cookies.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
- package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +79 -15
- package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/io.pyi +428 -44
- package/dist/typeshed-fallback/stdlib/ipaddress.pyi +153 -28
- package/dist/typeshed-fallback/stdlib/itertools.pyi +5 -1
- package/dist/typeshed-fallback/stdlib/json/encoder.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/keyword.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/lzma.pyi +107 -9
- package/dist/typeshed-fallback/stdlib/mailbox.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
- package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -160
- package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
- package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
- package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
- package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
- package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +15 -4
- package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +19 -5
- package/dist/typeshed-fallback/stdlib/nis.pyi +31 -4
- package/dist/typeshed-fallback/stdlib/numbers.pyi +26 -6
- package/dist/typeshed-fallback/stdlib/opcode.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/optparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1447 -217
- package/dist/typeshed-fallback/stdlib/pathlib.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/pickle.pyi +200 -12
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/queue.pyi +57 -9
- package/dist/typeshed-fallback/stdlib/re.pyi +219 -57
- package/dist/typeshed-fallback/stdlib/sched.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/signal.pyi +95 -19
- package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
- package/dist/typeshed-fallback/stdlib/socket.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +417 -83
- package/dist/typeshed-fallback/stdlib/ssl.pyi +133 -22
- package/dist/typeshed-fallback/stdlib/statistics.pyi +20 -5
- package/dist/typeshed-fallback/stdlib/struct.pyi +114 -13
- package/dist/typeshed-fallback/stdlib/subprocess.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
- package/dist/typeshed-fallback/stdlib/symtable.pyi +30 -1
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -3
- package/dist/typeshed-fallback/stdlib/tarfile.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/tempfile.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/threading.pyi +68 -7
- package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/turtle.pyi +11 -3
- package/dist/typeshed-fallback/stdlib/types.pyi +306 -79
- package/dist/typeshed-fallback/stdlib/typing.pyi +310 -31
- package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/unittest/case.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +51 -3
- package/dist/typeshed-fallback/stdlib/weakref.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/winsound.pyi +44 -28
- package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +33 -11
- package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +30 -10
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xxlimited.pyi +19 -4
- package/dist/typeshed-fallback/stdlib/zipimport.pyi +31 -0
- package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
- package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +18 -6
- package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +2 -2
- package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +18 -1
- package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +5 -19
- package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +2 -1
- package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +268 -6
- package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +3 -7
- package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +10 -4
- package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +47 -0
- package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +1 -1
- package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +0 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +2 -1
- package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +2 -2
- package/dist/typeshed-fallback/stubs/python-crontab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +23 -11
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +6 -0
- package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +8 -8
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +11 -17
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +11 -11
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +1 -2
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +4 -12
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +2 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +5 -8
- package/dist/typeshed-fallback/stubs/str2bool/METADATA.toml +2 -0
- package/dist/typeshed-fallback/stubs/str2bool/str2bool/__init__.pyi +7 -0
- package/package.json +1 -1
|
@@ -218,10 +218,20 @@ if sys.version_info >= (3, 12):
|
|
|
218
218
|
|
|
219
219
|
# Can take or return anything depending on what's in the registry.
|
|
220
220
|
@overload
|
|
221
|
-
def adapt(obj: Any, proto: Any, /) -> Any:
|
|
221
|
+
def adapt(obj: Any, proto: Any, /) -> Any:
|
|
222
|
+
"""adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."""
|
|
223
|
+
...
|
|
222
224
|
@overload
|
|
223
|
-
def adapt(obj: Any, proto: Any, alt: _T, /) -> Any | _T:
|
|
224
|
-
|
|
225
|
+
def adapt(obj: Any, proto: Any, alt: _T, /) -> Any | _T:
|
|
226
|
+
"""adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."""
|
|
227
|
+
...
|
|
228
|
+
def complete_statement(statement: str) -> bool:
|
|
229
|
+
"""
|
|
230
|
+
complete_statement(sql)
|
|
231
|
+
|
|
232
|
+
Checks if a string contains a complete SQL statement. Non-standard.
|
|
233
|
+
"""
|
|
234
|
+
...
|
|
225
235
|
|
|
226
236
|
if sys.version_info >= (3, 12):
|
|
227
237
|
@overload
|
|
@@ -235,7 +245,14 @@ if sys.version_info >= (3, 12):
|
|
|
235
245
|
uri: bool = False,
|
|
236
246
|
*,
|
|
237
247
|
autocommit: bool = ...,
|
|
238
|
-
) -> Connection:
|
|
248
|
+
) -> Connection:
|
|
249
|
+
"""
|
|
250
|
+
Opens a connection to the SQLite database file database.
|
|
251
|
+
|
|
252
|
+
You can use ":memory:" to open a database connection to a database that resides
|
|
253
|
+
in RAM instead of on disk.
|
|
254
|
+
"""
|
|
255
|
+
...
|
|
239
256
|
@overload
|
|
240
257
|
def connect(
|
|
241
258
|
database: StrOrBytesPath,
|
|
@@ -248,7 +265,14 @@ if sys.version_info >= (3, 12):
|
|
|
248
265
|
uri: bool = False,
|
|
249
266
|
*,
|
|
250
267
|
autocommit: bool = ...,
|
|
251
|
-
) -> _ConnectionT:
|
|
268
|
+
) -> _ConnectionT:
|
|
269
|
+
"""
|
|
270
|
+
Opens a connection to the SQLite database file database.
|
|
271
|
+
|
|
272
|
+
You can use ":memory:" to open a database connection to a database that resides
|
|
273
|
+
in RAM instead of on disk.
|
|
274
|
+
"""
|
|
275
|
+
...
|
|
252
276
|
@overload
|
|
253
277
|
def connect(
|
|
254
278
|
database: StrOrBytesPath,
|
|
@@ -261,7 +285,14 @@ if sys.version_info >= (3, 12):
|
|
|
261
285
|
cached_statements: int = 128,
|
|
262
286
|
uri: bool = False,
|
|
263
287
|
autocommit: bool = ...,
|
|
264
|
-
) -> _ConnectionT:
|
|
288
|
+
) -> _ConnectionT:
|
|
289
|
+
"""
|
|
290
|
+
Opens a connection to the SQLite database file database.
|
|
291
|
+
|
|
292
|
+
You can use ":memory:" to open a database connection to a database that resides
|
|
293
|
+
in RAM instead of on disk.
|
|
294
|
+
"""
|
|
295
|
+
...
|
|
265
296
|
|
|
266
297
|
else:
|
|
267
298
|
@overload
|
|
@@ -273,7 +304,16 @@ else:
|
|
|
273
304
|
check_same_thread: bool = True,
|
|
274
305
|
cached_statements: int = 128,
|
|
275
306
|
uri: bool = False,
|
|
276
|
-
) -> Connection:
|
|
307
|
+
) -> Connection:
|
|
308
|
+
"""
|
|
309
|
+
connect(database[, timeout, detect_types, isolation_level,
|
|
310
|
+
check_same_thread, factory, cached_statements, uri])
|
|
311
|
+
|
|
312
|
+
Opens a connection to the SQLite database file *database*. You can use
|
|
313
|
+
":memory:" to open a database connection to a database that resides in
|
|
314
|
+
RAM instead of on disk.
|
|
315
|
+
"""
|
|
316
|
+
...
|
|
277
317
|
@overload
|
|
278
318
|
def connect(
|
|
279
319
|
database: StrOrBytesPath,
|
|
@@ -284,7 +324,16 @@ else:
|
|
|
284
324
|
factory: type[_ConnectionT],
|
|
285
325
|
cached_statements: int = 128,
|
|
286
326
|
uri: bool = False,
|
|
287
|
-
) -> _ConnectionT:
|
|
327
|
+
) -> _ConnectionT:
|
|
328
|
+
"""
|
|
329
|
+
connect(database[, timeout, detect_types, isolation_level,
|
|
330
|
+
check_same_thread, factory, cached_statements, uri])
|
|
331
|
+
|
|
332
|
+
Opens a connection to the SQLite database file *database*. You can use
|
|
333
|
+
":memory:" to open a database connection to a database that resides in
|
|
334
|
+
RAM instead of on disk.
|
|
335
|
+
"""
|
|
336
|
+
...
|
|
288
337
|
@overload
|
|
289
338
|
def connect(
|
|
290
339
|
database: StrOrBytesPath,
|
|
@@ -296,21 +345,59 @@ else:
|
|
|
296
345
|
factory: type[_ConnectionT],
|
|
297
346
|
cached_statements: int = 128,
|
|
298
347
|
uri: bool = False,
|
|
299
|
-
) -> _ConnectionT:
|
|
348
|
+
) -> _ConnectionT:
|
|
349
|
+
"""
|
|
350
|
+
connect(database[, timeout, detect_types, isolation_level,
|
|
351
|
+
check_same_thread, factory, cached_statements, uri])
|
|
352
|
+
|
|
353
|
+
Opens a connection to the SQLite database file *database*. You can use
|
|
354
|
+
":memory:" to open a database connection to a database that resides in
|
|
355
|
+
RAM instead of on disk.
|
|
356
|
+
"""
|
|
357
|
+
...
|
|
358
|
+
|
|
359
|
+
def enable_callback_tracebacks(enable: bool, /) -> None:
|
|
360
|
+
"""
|
|
361
|
+
enable_callback_tracebacks(flag)
|
|
300
362
|
|
|
301
|
-
|
|
363
|
+
Enable or disable callback functions throwing errors to stderr.
|
|
364
|
+
"""
|
|
365
|
+
...
|
|
302
366
|
|
|
303
367
|
if sys.version_info < (3, 12):
|
|
304
368
|
# takes a pos-or-keyword argument because there is a C wrapper
|
|
305
|
-
def enable_shared_cache(enable: int) -> None:
|
|
369
|
+
def enable_shared_cache(enable: int) -> None:
|
|
370
|
+
"""
|
|
371
|
+
enable_shared_cache(do_enable)
|
|
372
|
+
|
|
373
|
+
Enable or disable shared cache mode for the calling thread.
|
|
374
|
+
Experimental/Non-standard.
|
|
375
|
+
"""
|
|
376
|
+
...
|
|
306
377
|
|
|
307
378
|
if sys.version_info >= (3, 10):
|
|
308
|
-
def register_adapter(type: type[_T], adapter: _Adapter[_T], /) -> None:
|
|
309
|
-
|
|
379
|
+
def register_adapter(type: type[_T], adapter: _Adapter[_T], /) -> None:
|
|
380
|
+
"""Register a function to adapt Python objects to SQLite values."""
|
|
381
|
+
...
|
|
382
|
+
def register_converter(typename: str, converter: _Converter, /) -> None:
|
|
383
|
+
"""Register a function to convert SQLite values to Python objects."""
|
|
384
|
+
...
|
|
310
385
|
|
|
311
386
|
else:
|
|
312
|
-
def register_adapter(type: type[_T], caster: _Adapter[_T], /) -> None:
|
|
313
|
-
|
|
387
|
+
def register_adapter(type: type[_T], caster: _Adapter[_T], /) -> None:
|
|
388
|
+
"""
|
|
389
|
+
register_adapter(type, callable)
|
|
390
|
+
|
|
391
|
+
Registers an adapter with pysqlite's adapter registry. Non-standard.
|
|
392
|
+
"""
|
|
393
|
+
...
|
|
394
|
+
def register_converter(name: str, converter: _Converter, /) -> None:
|
|
395
|
+
"""
|
|
396
|
+
register_converter(typename, callable)
|
|
397
|
+
|
|
398
|
+
Registers a converter with pysqlite. Non-standard.
|
|
399
|
+
"""
|
|
400
|
+
...
|
|
314
401
|
|
|
315
402
|
class _AggregateProtocol(Protocol):
|
|
316
403
|
def step(self, value: int, /) -> object: ...
|
|
@@ -393,56 +480,146 @@ class Connection:
|
|
|
393
480
|
uri: bool = ...,
|
|
394
481
|
) -> None: ...
|
|
395
482
|
|
|
396
|
-
def close(self) -> None:
|
|
483
|
+
def close(self) -> None:
|
|
484
|
+
"""Closes the connection."""
|
|
485
|
+
...
|
|
397
486
|
if sys.version_info >= (3, 11):
|
|
398
|
-
def blobopen(self, table: str, column: str, row: int, /, *, readonly: bool = False, name: str = "main") -> Blob:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
487
|
+
def blobopen(self, table: str, column: str, row: int, /, *, readonly: bool = False, name: str = "main") -> Blob:
|
|
488
|
+
"""
|
|
489
|
+
Open and return a BLOB object.
|
|
490
|
+
|
|
491
|
+
table
|
|
492
|
+
Table name.
|
|
493
|
+
column
|
|
494
|
+
Column name.
|
|
495
|
+
row
|
|
496
|
+
Row index.
|
|
497
|
+
readonly
|
|
498
|
+
Open the BLOB without write permissions.
|
|
499
|
+
name
|
|
500
|
+
Database name.
|
|
501
|
+
"""
|
|
502
|
+
...
|
|
503
|
+
|
|
504
|
+
def commit(self) -> None:
|
|
505
|
+
"""Commit the current transaction."""
|
|
506
|
+
...
|
|
507
|
+
def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None:
|
|
508
|
+
"""Creates a new aggregate. Non-standard."""
|
|
509
|
+
...
|
|
402
510
|
if sys.version_info >= (3, 11):
|
|
403
511
|
# num_params determines how many params will be passed to the aggregate class. We provide an overload
|
|
404
512
|
# for the case where num_params = 1, which is expected to be the common case.
|
|
405
513
|
@overload
|
|
406
514
|
def create_window_function(
|
|
407
515
|
self, name: str, num_params: Literal[1], aggregate_class: Callable[[], _SingleParamWindowAggregateClass] | None, /
|
|
408
|
-
) -> None:
|
|
516
|
+
) -> None:
|
|
517
|
+
"""
|
|
518
|
+
Creates or redefines an aggregate window function. Non-standard.
|
|
519
|
+
|
|
520
|
+
name
|
|
521
|
+
The name of the SQL aggregate window function to be created or
|
|
522
|
+
redefined.
|
|
523
|
+
num_params
|
|
524
|
+
The number of arguments the step and inverse methods takes.
|
|
525
|
+
aggregate_class
|
|
526
|
+
A class with step(), finalize(), value(), and inverse() methods.
|
|
527
|
+
Set to None to clear the window function.
|
|
528
|
+
"""
|
|
529
|
+
...
|
|
409
530
|
# And for num_params = -1, which means the aggregate must accept any number of parameters.
|
|
410
531
|
@overload
|
|
411
532
|
def create_window_function(
|
|
412
533
|
self, name: str, num_params: Literal[-1], aggregate_class: Callable[[], _AnyParamWindowAggregateClass] | None, /
|
|
413
|
-
) -> None:
|
|
534
|
+
) -> None:
|
|
535
|
+
"""
|
|
536
|
+
Creates or redefines an aggregate window function. Non-standard.
|
|
537
|
+
|
|
538
|
+
name
|
|
539
|
+
The name of the SQL aggregate window function to be created or
|
|
540
|
+
redefined.
|
|
541
|
+
num_params
|
|
542
|
+
The number of arguments the step and inverse methods takes.
|
|
543
|
+
aggregate_class
|
|
544
|
+
A class with step(), finalize(), value(), and inverse() methods.
|
|
545
|
+
Set to None to clear the window function.
|
|
546
|
+
"""
|
|
547
|
+
...
|
|
414
548
|
@overload
|
|
415
549
|
def create_window_function(
|
|
416
550
|
self, name: str, num_params: int, aggregate_class: Callable[[], _WindowAggregateClass] | None, /
|
|
417
|
-
) -> None:
|
|
418
|
-
|
|
419
|
-
|
|
551
|
+
) -> None:
|
|
552
|
+
"""
|
|
553
|
+
Creates or redefines an aggregate window function. Non-standard.
|
|
554
|
+
|
|
555
|
+
name
|
|
556
|
+
The name of the SQL aggregate window function to be created or
|
|
557
|
+
redefined.
|
|
558
|
+
num_params
|
|
559
|
+
The number of arguments the step and inverse methods takes.
|
|
560
|
+
aggregate_class
|
|
561
|
+
A class with step(), finalize(), value(), and inverse() methods.
|
|
562
|
+
Set to None to clear the window function.
|
|
563
|
+
"""
|
|
564
|
+
...
|
|
565
|
+
|
|
566
|
+
def create_collation(self, name: str, callback: Callable[[str, str], int | SupportsIndex] | None, /) -> None:
|
|
567
|
+
"""Creates a collation function. Non-standard."""
|
|
568
|
+
...
|
|
420
569
|
def create_function(
|
|
421
570
|
self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = False
|
|
422
|
-
) -> None:
|
|
571
|
+
) -> None:
|
|
572
|
+
"""Creates a new function. Non-standard."""
|
|
573
|
+
...
|
|
423
574
|
@overload
|
|
424
|
-
def cursor(self, factory: None = None) -> Cursor:
|
|
575
|
+
def cursor(self, factory: None = None) -> Cursor:
|
|
576
|
+
"""Return a cursor for the connection."""
|
|
577
|
+
...
|
|
425
578
|
@overload
|
|
426
|
-
def cursor(self, factory: Callable[[Connection], _CursorT]) -> _CursorT:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
def
|
|
430
|
-
|
|
579
|
+
def cursor(self, factory: Callable[[Connection], _CursorT]) -> _CursorT:
|
|
580
|
+
"""Return a cursor for the connection."""
|
|
581
|
+
...
|
|
582
|
+
def execute(self, sql: str, parameters: _Parameters = ..., /) -> Cursor:
|
|
583
|
+
"""Executes a SQL statement. Non-standard."""
|
|
584
|
+
...
|
|
585
|
+
def executemany(self, sql: str, parameters: Iterable[_Parameters], /) -> Cursor:
|
|
586
|
+
"""Repeatedly executes a SQL statement. Non-standard."""
|
|
587
|
+
...
|
|
588
|
+
def executescript(self, sql_script: str, /) -> Cursor:
|
|
589
|
+
"""Executes a multiple SQL statements at once. Non-standard."""
|
|
590
|
+
...
|
|
591
|
+
def interrupt(self) -> None:
|
|
592
|
+
"""Abort any pending database operation. Non-standard."""
|
|
593
|
+
...
|
|
431
594
|
if sys.version_info >= (3, 13):
|
|
432
595
|
def iterdump(self, *, filter: str | None = None) -> Generator[str, None, None]: ...
|
|
433
596
|
else:
|
|
434
|
-
def iterdump(self) -> Generator[str, None, None]:
|
|
597
|
+
def iterdump(self) -> Generator[str, None, None]:
|
|
598
|
+
"""Returns iterator to the dump of the database in an SQL text format. Non-standard."""
|
|
599
|
+
...
|
|
435
600
|
|
|
436
|
-
def rollback(self) -> None:
|
|
601
|
+
def rollback(self) -> None:
|
|
602
|
+
"""Roll back the current transaction."""
|
|
603
|
+
...
|
|
437
604
|
def set_authorizer(
|
|
438
605
|
self, authorizer_callback: Callable[[int, str | None, str | None, str | None, str | None], int] | None
|
|
439
|
-
) -> None:
|
|
440
|
-
|
|
441
|
-
|
|
606
|
+
) -> None:
|
|
607
|
+
"""Sets authorizer callback. Non-standard."""
|
|
608
|
+
...
|
|
609
|
+
def set_progress_handler(self, progress_handler: Callable[[], int | None] | None, n: int) -> None:
|
|
610
|
+
"""Sets progress handler callback. Non-standard."""
|
|
611
|
+
...
|
|
612
|
+
def set_trace_callback(self, trace_callback: Callable[[str], object] | None) -> None:
|
|
613
|
+
"""Sets a trace callback called for each SQL statement (passed as unicode). Non-standard."""
|
|
614
|
+
...
|
|
442
615
|
# enable_load_extension and load_extension is not available on python distributions compiled
|
|
443
616
|
# without sqlite3 loadable extension support. see footnotes https://docs.python.org/3/library/sqlite3.html#f1
|
|
444
|
-
def enable_load_extension(self, enable: bool, /) -> None:
|
|
445
|
-
|
|
617
|
+
def enable_load_extension(self, enable: bool, /) -> None:
|
|
618
|
+
"""Enable dynamic loading of SQLite extension modules. Non-standard."""
|
|
619
|
+
...
|
|
620
|
+
def load_extension(self, name: str, /) -> None:
|
|
621
|
+
"""Load SQLite extension module. Non-standard."""
|
|
622
|
+
...
|
|
446
623
|
def backup(
|
|
447
624
|
self,
|
|
448
625
|
target: Connection,
|
|
@@ -451,21 +628,92 @@ class Connection:
|
|
|
451
628
|
progress: Callable[[int, int, int], object] | None = None,
|
|
452
629
|
name: str = "main",
|
|
453
630
|
sleep: float = 0.25,
|
|
454
|
-
) -> None:
|
|
631
|
+
) -> None:
|
|
632
|
+
"""Makes a backup of the database. Non-standard."""
|
|
633
|
+
...
|
|
455
634
|
if sys.version_info >= (3, 11):
|
|
456
|
-
def setlimit(self, category: int, limit: int, /) -> int:
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
635
|
+
def setlimit(self, category: int, limit: int, /) -> int:
|
|
636
|
+
"""
|
|
637
|
+
Set connection run-time limits.
|
|
638
|
+
|
|
639
|
+
category
|
|
640
|
+
The limit category to be set.
|
|
641
|
+
limit
|
|
642
|
+
The new limit. If the new limit is a negative number, the limit is
|
|
643
|
+
unchanged.
|
|
644
|
+
|
|
645
|
+
Attempts to increase a limit above its hard upper bound are silently truncated
|
|
646
|
+
to the hard upper bound. Regardless of whether or not the limit was changed,
|
|
647
|
+
the prior value of the limit is returned.
|
|
648
|
+
"""
|
|
649
|
+
...
|
|
650
|
+
def getlimit(self, category: int, /) -> int:
|
|
651
|
+
"""
|
|
652
|
+
Get connection run-time limits.
|
|
653
|
+
|
|
654
|
+
category
|
|
655
|
+
The limit category to be queried.
|
|
656
|
+
"""
|
|
657
|
+
...
|
|
658
|
+
def serialize(self, *, name: str = "main") -> bytes:
|
|
659
|
+
"""
|
|
660
|
+
Serialize a database into a byte string.
|
|
661
|
+
|
|
662
|
+
name
|
|
663
|
+
Which database to serialize.
|
|
664
|
+
|
|
665
|
+
For an ordinary on-disk database file, the serialization is just a copy of the
|
|
666
|
+
disk file. For an in-memory database or a "temp" database, the serialization is
|
|
667
|
+
the same sequence of bytes which would be written to disk if that database
|
|
668
|
+
were backed up to disk.
|
|
669
|
+
"""
|
|
670
|
+
...
|
|
671
|
+
def deserialize(self, data: ReadableBuffer, /, *, name: str = "main") -> None:
|
|
672
|
+
"""
|
|
673
|
+
Load a serialized database.
|
|
674
|
+
|
|
675
|
+
data
|
|
676
|
+
The serialized database content.
|
|
677
|
+
name
|
|
678
|
+
Which database to reopen with the deserialization.
|
|
679
|
+
|
|
680
|
+
The deserialize interface causes the database connection to disconnect from the
|
|
681
|
+
target database, and then reopen it as an in-memory database based on the given
|
|
682
|
+
serialized data.
|
|
683
|
+
|
|
684
|
+
The deserialize interface will fail with SQLITE_BUSY if the database is
|
|
685
|
+
currently in a read transaction or is involved in a backup operation.
|
|
686
|
+
"""
|
|
687
|
+
...
|
|
460
688
|
if sys.version_info >= (3, 12):
|
|
461
|
-
def getconfig(self, op: int, /) -> bool:
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
689
|
+
def getconfig(self, op: int, /) -> bool:
|
|
690
|
+
"""
|
|
691
|
+
Query a boolean connection configuration option.
|
|
692
|
+
|
|
693
|
+
op
|
|
694
|
+
The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes.
|
|
695
|
+
"""
|
|
696
|
+
...
|
|
697
|
+
def setconfig(self, op: int, enable: bool = True, /) -> bool:
|
|
698
|
+
"""
|
|
699
|
+
Set a boolean connection configuration option.
|
|
700
|
+
|
|
701
|
+
op
|
|
702
|
+
The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes.
|
|
703
|
+
"""
|
|
704
|
+
...
|
|
705
|
+
|
|
706
|
+
def __call__(self, sql: str, /) -> _Statement:
|
|
707
|
+
"""Call self as a function."""
|
|
708
|
+
...
|
|
709
|
+
def __enter__(self) -> Self:
|
|
710
|
+
"""For context manager. Non-standard."""
|
|
711
|
+
...
|
|
466
712
|
def __exit__(
|
|
467
713
|
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None, /
|
|
468
|
-
) -> Literal[False]:
|
|
714
|
+
) -> Literal[False]:
|
|
715
|
+
"""For context manager. Non-standard."""
|
|
716
|
+
...
|
|
469
717
|
|
|
470
718
|
class Cursor(Iterator[Any]):
|
|
471
719
|
arraysize: int
|
|
@@ -480,19 +728,41 @@ class Cursor(Iterator[Any]):
|
|
|
480
728
|
@property
|
|
481
729
|
def rowcount(self) -> int: ...
|
|
482
730
|
def __init__(self, cursor: Connection, /) -> None: ...
|
|
483
|
-
def close(self) -> None:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
def
|
|
487
|
-
|
|
488
|
-
|
|
731
|
+
def close(self) -> None:
|
|
732
|
+
"""Closes the cursor."""
|
|
733
|
+
...
|
|
734
|
+
def execute(self, sql: str, parameters: _Parameters = (), /) -> Self:
|
|
735
|
+
"""Executes a SQL statement."""
|
|
736
|
+
...
|
|
737
|
+
def executemany(self, sql: str, seq_of_parameters: Iterable[_Parameters], /) -> Self:
|
|
738
|
+
"""Repeatedly executes a SQL statement."""
|
|
739
|
+
...
|
|
740
|
+
def executescript(self, sql_script: str, /) -> Cursor:
|
|
741
|
+
"""Executes a multiple SQL statements at once. Non-standard."""
|
|
742
|
+
...
|
|
743
|
+
def fetchall(self) -> list[Any]:
|
|
744
|
+
"""Fetches all rows from the resultset."""
|
|
745
|
+
...
|
|
746
|
+
def fetchmany(self, size: int | None = 1) -> list[Any]:
|
|
747
|
+
"""Fetches several rows from the resultset."""
|
|
748
|
+
...
|
|
489
749
|
# Returns either a row (as created by the row_factory) or None, but
|
|
490
750
|
# putting None in the return annotation causes annoying false positives.
|
|
491
|
-
def fetchone(self) -> Any:
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
def
|
|
495
|
-
|
|
751
|
+
def fetchone(self) -> Any:
|
|
752
|
+
"""Fetches one row from the resultset."""
|
|
753
|
+
...
|
|
754
|
+
def setinputsizes(self, sizes: Unused, /) -> None:
|
|
755
|
+
"""Required by DB-API. Does nothing in pysqlite."""
|
|
756
|
+
...
|
|
757
|
+
def setoutputsize(self, size: Unused, column: Unused = None, /) -> None:
|
|
758
|
+
"""Required by DB-API. Does nothing in pysqlite."""
|
|
759
|
+
...
|
|
760
|
+
def __iter__(self) -> Self:
|
|
761
|
+
"""Implement iter(self)."""
|
|
762
|
+
...
|
|
763
|
+
def __next__(self) -> Any:
|
|
764
|
+
"""Implement next(self)."""
|
|
765
|
+
...
|
|
496
766
|
|
|
497
767
|
class Error(Exception):
|
|
498
768
|
if sys.version_info >= (3, 11):
|
|
@@ -518,21 +788,45 @@ class ProgrammingError(DatabaseError): ...
|
|
|
518
788
|
|
|
519
789
|
class Row:
|
|
520
790
|
def __init__(self, cursor: Cursor, data: tuple[Any, ...], /) -> None: ...
|
|
521
|
-
def keys(self) -> list[str]:
|
|
791
|
+
def keys(self) -> list[str]:
|
|
792
|
+
"""Returns the keys of the row."""
|
|
793
|
+
...
|
|
522
794
|
@overload
|
|
523
|
-
def __getitem__(self, key: int | str, /) -> Any:
|
|
795
|
+
def __getitem__(self, key: int | str, /) -> Any:
|
|
796
|
+
"""Return self[key]."""
|
|
797
|
+
...
|
|
524
798
|
@overload
|
|
525
|
-
def __getitem__(self, key: slice, /) -> tuple[Any, ...]:
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
def
|
|
799
|
+
def __getitem__(self, key: slice, /) -> tuple[Any, ...]:
|
|
800
|
+
"""Return self[key]."""
|
|
801
|
+
...
|
|
802
|
+
def __hash__(self) -> int:
|
|
803
|
+
"""Return hash(self)."""
|
|
804
|
+
...
|
|
805
|
+
def __iter__(self) -> Iterator[Any]:
|
|
806
|
+
"""Implement iter(self)."""
|
|
807
|
+
...
|
|
808
|
+
def __len__(self) -> int:
|
|
809
|
+
"""Return len(self)."""
|
|
810
|
+
...
|
|
529
811
|
# These return NotImplemented for anything that is not a Row.
|
|
530
|
-
def __eq__(self, value: object, /) -> bool:
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
def
|
|
534
|
-
|
|
535
|
-
|
|
812
|
+
def __eq__(self, value: object, /) -> bool:
|
|
813
|
+
"""Return self==value."""
|
|
814
|
+
...
|
|
815
|
+
def __ge__(self, value: object, /) -> bool:
|
|
816
|
+
"""Return self>=value."""
|
|
817
|
+
...
|
|
818
|
+
def __gt__(self, value: object, /) -> bool:
|
|
819
|
+
"""Return self>value."""
|
|
820
|
+
...
|
|
821
|
+
def __le__(self, value: object, /) -> bool:
|
|
822
|
+
"""Return self<=value."""
|
|
823
|
+
...
|
|
824
|
+
def __lt__(self, value: object, /) -> bool:
|
|
825
|
+
"""Return self<value."""
|
|
826
|
+
...
|
|
827
|
+
def __ne__(self, value: object, /) -> bool:
|
|
828
|
+
"""Return self!=value."""
|
|
829
|
+
...
|
|
536
830
|
|
|
537
831
|
@final
|
|
538
832
|
class _Statement: ...
|
|
@@ -542,14 +836,54 @@ class Warning(Exception): ...
|
|
|
542
836
|
if sys.version_info >= (3, 11):
|
|
543
837
|
@final
|
|
544
838
|
class Blob:
|
|
545
|
-
def close(self) -> None:
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
def
|
|
839
|
+
def close(self) -> None:
|
|
840
|
+
"""Close the blob."""
|
|
841
|
+
...
|
|
842
|
+
def read(self, length: int = -1, /) -> bytes:
|
|
843
|
+
"""
|
|
844
|
+
Read data at the current offset position.
|
|
845
|
+
|
|
846
|
+
length
|
|
847
|
+
Read length in bytes.
|
|
848
|
+
|
|
849
|
+
If the end of the blob is reached, the data up to end of file will be returned.
|
|
850
|
+
When length is not specified, or is negative, Blob.read() will read until the
|
|
851
|
+
end of the blob.
|
|
852
|
+
"""
|
|
853
|
+
...
|
|
854
|
+
def write(self, data: ReadableBuffer, /) -> None:
|
|
855
|
+
"""
|
|
856
|
+
Write data at the current offset.
|
|
857
|
+
|
|
858
|
+
This function cannot change the blob length. Writing beyond the end of the
|
|
859
|
+
blob will result in an exception being raised.
|
|
860
|
+
"""
|
|
861
|
+
...
|
|
862
|
+
def tell(self) -> int:
|
|
863
|
+
"""Return the current access position for the blob."""
|
|
864
|
+
...
|
|
549
865
|
# whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END
|
|
550
|
-
def seek(self, offset: int, origin: int = 0, /) -> None:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
866
|
+
def seek(self, offset: int, origin: int = 0, /) -> None:
|
|
867
|
+
"""
|
|
868
|
+
Set the current access position to offset.
|
|
869
|
+
|
|
870
|
+
The origin argument defaults to os.SEEK_SET (absolute blob positioning).
|
|
871
|
+
Other values for origin are os.SEEK_CUR (seek relative to the current position)
|
|
872
|
+
and os.SEEK_END (seek relative to the blob's end).
|
|
873
|
+
"""
|
|
874
|
+
...
|
|
875
|
+
def __len__(self) -> int:
|
|
876
|
+
"""Return len(self)."""
|
|
877
|
+
...
|
|
878
|
+
def __enter__(self) -> Self:
|
|
879
|
+
"""Blob context manager enter."""
|
|
880
|
+
...
|
|
881
|
+
def __exit__(self, type: object, val: object, tb: object, /) -> Literal[False]:
|
|
882
|
+
"""Blob context manager exit."""
|
|
883
|
+
...
|
|
884
|
+
def __getitem__(self, key: SupportsIndex | slice, /) -> int:
|
|
885
|
+
"""Return self[key]."""
|
|
886
|
+
...
|
|
887
|
+
def __setitem__(self, key: SupportsIndex | slice, value: int, /) -> None:
|
|
888
|
+
"""Set self[key] to value."""
|
|
889
|
+
...
|