Skip to content

Commit 4d02572

Browse files
gh-95273: Align sqlite3 const doc refs with the devguide recommendations (#95525)
1 parent 3d9d45b commit 4d02572

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

Doc/library/sqlite3.rst

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,13 @@ Module functions and constants
322322
The :attr:`~Connection.isolation_level` of the connection,
323323
controlling whether and how transactions are implicitly opened.
324324
Can be ``"DEFERRED"`` (default), ``"EXCLUSIVE"`` or ``"IMMEDIATE"``;
325-
or :const:`None` to disable opening transactions implicitly.
325+
or ``None`` to disable opening transactions implicitly.
326326
See :ref:`sqlite3-controlling-transactions` for more.
327-
:type isolation_level: str | :const:`None`
327+
:type isolation_level: str | None
328328

329329
:param check_same_thread:
330-
If :const:`True` (default), only the creating thread may use the connection.
331-
If :const:`False`, the connection may be shared across multiple threads;
330+
If ``True`` (default), only the creating thread may use the connection.
331+
If ``False``, the connection may be shared across multiple threads;
332332
if so, write operations should be serialized by the user to avoid data
333333
corruption.
334334
:type check_same_thread: bool
@@ -345,7 +345,7 @@ Module functions and constants
345345
:type cached_statements: int
346346

347347
:param uri:
348-
If set to :const:`True`, *database* is interpreted as a
348+
If set to ``True``, *database* is interpreted as a
349349
:abbr:`URI (Uniform Resource Identifier)` with a file path
350350
and an optional query string.
351351
The scheme part *must* be ``"file:"``,
@@ -394,7 +394,7 @@ Module functions and constants
394394

395395
.. function:: complete_statement(statement)
396396

397-
Returns :const:`True` if the string *statement* contains one or more complete SQL
397+
Returns ``True`` if the string *statement* contains one or more complete SQL
398398
statements terminated by semicolons. It does not verify that the SQL is
399399
syntactically correct, only that there are no unclosed string literals and the
400400
statement is terminated by a semicolon.
@@ -410,8 +410,8 @@ Module functions and constants
410410
Enable or disable callback tracebacks.
411411
By default you will not get any tracebacks in user-defined functions,
412412
aggregates, converters, authorizer callbacks etc. If you want to debug them,
413-
you can call this function with *flag* set to :const:`True`. Afterwards, you
414-
will get tracebacks from callbacks on :data:`sys.stderr`. Use :const:`False`
413+
you can call this function with *flag* set to ``True``. Afterwards, you
414+
will get tracebacks from callbacks on :data:`sys.stderr`. Use ``False``
415415
to disable the feature again.
416416

417417
Register an :func:`unraisable hook handler <sys.unraisablehook>` for an
@@ -456,7 +456,7 @@ Connection objects
456456

457457
This attribute controls the :ref:`transaction handling
458458
<sqlite3-controlling-transactions>` performed by ``sqlite3``.
459-
If set to :const:`None`, transactions are never implicitly opened.
459+
If set to ``None``, transactions are never implicitly opened.
460460
If set to one of ``"DEFERRED"``, ``"IMMEDIATE"``, or ``"EXCLUSIVE"``,
461461
corresponding to the underlying `SQLite transaction behaviour`_,
462462
implicit :ref:`transaction management
@@ -470,8 +470,8 @@ Connection objects
470470
This read-only attribute corresponds to the low-level SQLite
471471
`autocommit mode`_.
472472

473-
:const:`True` if a transaction is active (there are uncommitted changes),
474-
:const:`False` otherwise.
473+
``True`` if a transaction is active (there are uncommitted changes),
474+
``False`` otherwise.
475475

476476
.. versionadded:: 3.2
477477

@@ -500,9 +500,9 @@ Connection objects
500500
:type row: str
501501

502502
:param readonly:
503-
Set to :const:`True` if the blob should be opened without write
503+
Set to ``True`` if the blob should be opened without write
504504
permissions.
505-
Defaults to :const:`False`.
505+
Defaults to ``False``.
506506
:type readonly: bool
507507

508508
:param name:
@@ -574,11 +574,11 @@ Connection objects
574574
A callable that is called when the SQL function is invoked.
575575
The callable must return :ref:`a type natively supported by SQLite
576576
<sqlite3-types>`.
577-
Set to :const:`None` to remove an existing SQL function.
578-
:type func: :term:`callback` | :const:`None`
577+
Set to ``None`` to remove an existing SQL function.
578+
:type func: :term:`callback` | None
579579

580580
:param deterministic:
581-
If :const:`True`, the created SQL function is marked as
581+
If ``True``, the created SQL function is marked as
582582
`deterministic <https://sqlite.org/deterministic.html>`_,
583583
which allows SQLite to perform additional optimizations.
584584
:type deterministic: bool
@@ -617,8 +617,8 @@ Connection objects
617617
The number of arguments that the ``step()`` method must accept
618618
is controlled by *n_arg*.
619619

620-
Set to :const:`None` to remove an existing SQL aggregate function.
621-
:type aggregate_class: :term:`class` | :const:`None`
620+
Set to ``None`` to remove an existing SQL aggregate function.
621+
:type aggregate_class: :term:`class` | None
622622

623623
Example:
624624

@@ -650,13 +650,13 @@ Connection objects
650650
The number of arguments that the ``step()`` and ``value()`` methods
651651
must accept is controlled by *num_params*.
652652

653-
Set to :const:`None` to remove an existing SQL aggregate window function.
653+
Set to ``None`` to remove an existing SQL aggregate window function.
654654

655655
:raises NotSupportedError:
656656
If used with a version of SQLite older than 3.25.0,
657657
which does not support aggregate window functions.
658658

659-
:type aggregate_class: :term:`class` | :const:`None`
659+
:type aggregate_class: :term:`class` | None
660660

661661
.. versionadded:: 3.11
662662

@@ -679,7 +679,7 @@ Connection objects
679679

680680
.. literalinclude:: ../includes/sqlite3/collation_reverse.py
681681

682-
Remove a collation function by setting *callable* to :const:`None`.
682+
Remove a collation function by setting *callable* to ``None``.
683683

684684
.. versionchanged:: 3.11
685685
The collation name can contain any Unicode character. Earlier, only
@@ -703,20 +703,20 @@ Connection objects
703703
:mod:`sqlite3` module.
704704

705705
The first argument to the callback signifies what kind of operation is to be
706-
authorized. The second and third argument will be arguments or :const:`None`
706+
authorized. The second and third argument will be arguments or ``None``
707707
depending on the first argument. The 4th argument is the name of the database
708708
("main", "temp", etc.) if applicable. The 5th argument is the name of the
709709
inner-most trigger or view that is responsible for the access attempt or
710-
:const:`None` if this access attempt is directly from input SQL code.
710+
``None`` if this access attempt is directly from input SQL code.
711711

712712
Please consult the SQLite documentation about the possible values for the first
713713
argument and the meaning of the second and third argument depending on the first
714714
one. All necessary constants are available in the :mod:`sqlite3` module.
715715

716-
Passing :const:`None` as *authorizer_callback* will disable the authorizer.
716+
Passing ``None`` as *authorizer_callback* will disable the authorizer.
717717

718718
.. versionchanged:: 3.11
719-
Added support for disabling the authorizer using :const:`None`.
719+
Added support for disabling the authorizer using ``None``.
720720

721721

722722
.. method:: set_progress_handler(progress_handler, n)
@@ -727,7 +727,7 @@ Connection objects
727727
a GUI.
728728

729729
If you want to clear any previously installed progress handler, call the
730-
method with :const:`None` for *progress_handler*.
730+
method with ``None`` for *progress_handler*.
731731

732732
Returning a non-zero value from the handler function will terminate the
733733
currently executing query and cause it to raise a :exc:`DatabaseError`
@@ -747,7 +747,7 @@ Connection objects
747747
sqlite3 module and the execution of triggers defined in the current
748748
database.
749749

750-
Passing :const:`None` as *trace_callback* will disable the trace callback.
750+
Passing ``None`` as *trace_callback* will disable the trace callback.
751751

752752
.. note::
753753
Exceptions raised in the trace callback are not propagated. As a
@@ -761,7 +761,7 @@ Connection objects
761761
.. method:: enable_load_extension(enabled, /)
762762

763763
Enable the SQLite engine to load SQLite extensions from shared libraries
764-
if *enabled* is :const:`True`;
764+
if *enabled* is ``True``;
765765
else, disallow loading SQLite extensions.
766766
SQLite extensions can define new functions,
767767
aggregates or whole new virtual table implementations. One well-known
@@ -879,8 +879,8 @@ Connection objects
879879
the *status* of the last iteration,
880880
the *remaining* number of pages still to be copied,
881881
and the *total* number of pages.
882-
Defaults to :const:`None`.
883-
:type progress: :term:`callback` | :const:`None`
882+
Defaults to ``None``.
883+
:type progress: :term:`callback` | None
884884
885885
:param name:
886886
The name of the database to back up.
@@ -1034,7 +1034,7 @@ Cursor objects
10341034
:meth:`executescript` if you want to execute multiple SQL statements with one
10351035
call.
10361036

1037-
If :attr:`~Connection.isolation_level` is not :const:`None`,
1037+
If :attr:`~Connection.isolation_level` is not ``None``,
10381038
*sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement,
10391039
and there is no open transaction,
10401040
a transaction is implicitly opened before executing *sql*.
@@ -1082,7 +1082,7 @@ Cursor objects
10821082
.. method:: fetchone()
10831083

10841084
Fetch the next row of a query result set as a :class:`tuple`.
1085-
Return :const:`None` if no more data is available.
1085+
Return ``None`` if no more data is available.
10861086

10871087

10881088
.. method:: fetchmany(size=cursor.arraysize)
@@ -1138,7 +1138,7 @@ Cursor objects
11381138
using the :meth:`execute` method. For other statements, after
11391139
:meth:`executemany` or :meth:`executescript`, or if the insertion failed,
11401140
the value of ``lastrowid`` is left unchanged. The initial value of
1141-
``lastrowid`` is :const:`None`.
1141+
``lastrowid`` is ``None``.
11421142

11431143
.. note::
11441144
Inserts into ``WITHOUT ROWID`` tables are not recorded.
@@ -1155,7 +1155,7 @@ Cursor objects
11551155

11561156
Read-only attribute that provides the column names of the last query. To
11571157
remain compatible with the Python DB API, it returns a 7-tuple for each
1158-
column where the last six items of each tuple are :const:`None`.
1158+
column where the last six items of each tuple are ``None``.
11591159

11601160
It is set for ``SELECT`` statements without any matching rows as well.
11611161

@@ -1388,7 +1388,7 @@ The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`).
13881388

13891389
Exception raised in case a method or database API is not supported by the
13901390
underlying SQLite library. For example, setting *deterministic* to
1391-
:const:`True` in :meth:`~Connection.create_function`, if the underlying SQLite library
1391+
``True`` in :meth:`~Connection.create_function`, if the underlying SQLite library
13921392
does not support deterministic functions.
13931393
``NotSupportedError`` is a subclass of :exc:`DatabaseError`.
13941394

@@ -1406,7 +1406,7 @@ The following Python types can thus be sent to SQLite without any problem:
14061406
+-------------------------------+-------------+
14071407
| Python type | SQLite type |
14081408
+===============================+=============+
1409-
| :const:`None` | ``NULL`` |
1409+
| ``None`` | ``NULL`` |
14101410
+-------------------------------+-------------+
14111411
| :class:`int` | ``INTEGER`` |
14121412
+-------------------------------+-------------+
@@ -1423,7 +1423,7 @@ This is how SQLite types are converted to Python types by default:
14231423
+-------------+----------------------------------------------+
14241424
| SQLite type | Python type |
14251425
+=============+==============================================+
1426-
| ``NULL`` | :const:`None` |
1426+
| ``NULL`` | ``None`` |
14271427
+-------------+----------------------------------------------+
14281428
| ``INTEGER`` | :class:`int` |
14291429
+-------------+----------------------------------------------+
@@ -1736,7 +1736,7 @@ The ``sqlite3`` module does not adhere to the transaction handling recommended
17361736
by :pep:`249`.
17371737

17381738
If the connection attribute :attr:`~Connection.isolation_level`
1739-
is not :const:`None`,
1739+
is not ``None``,
17401740
new transactions are implicitly opened before
17411741
:meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes
17421742
``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements.
@@ -1747,7 +1747,7 @@ that is, whether and what type of ``BEGIN`` statements ``sqlite3``
17471747
implicitly executes –
17481748
via the :attr:`~Connection.isolation_level` attribute.
17491749

1750-
If :attr:`~Connection.isolation_level` is set to :const:`None`,
1750+
If :attr:`~Connection.isolation_level` is set to ``None``,
17511751
no transactions are implicitly opened at all.
17521752
This leaves the underlying SQLite library in `autocommit mode`_,
17531753
but also allows the user to perform their own transaction handling

0 commit comments

Comments
 (0)