mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
[3.12] Docs: use placeholders in dbm flag param docs (GH-114482) (#114497)
Also correct the default flag param for dbm.dumb.open();
it's 'c', not 'r'.
(cherry picked from commit 8c265408c5
)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
parent
be85f35f12
commit
a73a6a3c69
1 changed files with 43 additions and 60 deletions
|
@ -36,6 +36,21 @@ the Oracle Berkeley DB.
|
||||||
.. versionchanged:: 3.11
|
.. versionchanged:: 3.11
|
||||||
Accepts :term:`path-like object` for filename.
|
Accepts :term:`path-like object` for filename.
|
||||||
|
|
||||||
|
.. Substitutions for the open() flag param docs;
|
||||||
|
all submodules use the same text.
|
||||||
|
|
||||||
|
.. |flag_r| replace::
|
||||||
|
Open existing database for reading only.
|
||||||
|
|
||||||
|
.. |flag_w| replace::
|
||||||
|
Open existing database for reading and writing.
|
||||||
|
|
||||||
|
.. |flag_c| replace::
|
||||||
|
Open database for reading and writing, creating it if it doesn't exist.
|
||||||
|
|
||||||
|
.. |flag_n| replace::
|
||||||
|
Always create a new, empty database, open for reading and writing.
|
||||||
|
|
||||||
.. function:: open(file, flag='r', mode=0o666)
|
.. function:: open(file, flag='r', mode=0o666)
|
||||||
|
|
||||||
Open the database file *file* and return a corresponding object.
|
Open the database file *file* and return a corresponding object.
|
||||||
|
@ -46,21 +61,13 @@ the Oracle Berkeley DB.
|
||||||
|
|
||||||
The optional *flag* argument can be:
|
The optional *flag* argument can be:
|
||||||
|
|
||||||
+---------+-------------------------------------------+
|
.. csv-table::
|
||||||
| Value | Meaning |
|
:header: "Value", "Meaning"
|
||||||
+=========+===========================================+
|
|
||||||
| ``'r'`` | Open existing database for reading only |
|
``'r'`` (default), |flag_r|
|
||||||
| | (default) |
|
``'w'``, |flag_w|
|
||||||
+---------+-------------------------------------------+
|
``'c'``, |flag_c|
|
||||||
| ``'w'`` | Open existing database for reading and |
|
``'n'``, |flag_n|
|
||||||
| | writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'c'`` | Open database for reading and writing, |
|
|
||||||
| | creating it if it doesn't exist |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'n'`` | Always create a new, empty database, open |
|
|
||||||
| | for reading and writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
|
|
||||||
The optional *mode* argument is the Unix mode of the file, used only when the
|
The optional *mode* argument is the Unix mode of the file, used only when the
|
||||||
database has to be created. It defaults to octal ``0o666`` (and will be
|
database has to be created. It defaults to octal ``0o666`` (and will be
|
||||||
|
@ -165,21 +172,13 @@ supported.
|
||||||
|
|
||||||
The optional *flag* argument can be:
|
The optional *flag* argument can be:
|
||||||
|
|
||||||
+---------+-------------------------------------------+
|
.. csv-table::
|
||||||
| Value | Meaning |
|
:header: "Value", "Meaning"
|
||||||
+=========+===========================================+
|
|
||||||
| ``'r'`` | Open existing database for reading only |
|
``'r'`` (default), |flag_r|
|
||||||
| | (default) |
|
``'w'``, |flag_w|
|
||||||
+---------+-------------------------------------------+
|
``'c'``, |flag_c|
|
||||||
| ``'w'`` | Open existing database for reading and |
|
``'n'``, |flag_n|
|
||||||
| | writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'c'`` | Open database for reading and writing, |
|
|
||||||
| | creating it if it doesn't exist |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'n'`` | Always create a new, empty database, open |
|
|
||||||
| | for reading and writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
|
|
||||||
The following additional characters may be appended to the flag to control
|
The following additional characters may be appended to the flag to control
|
||||||
how the database is opened:
|
how the database is opened:
|
||||||
|
@ -290,21 +289,13 @@ to locate the appropriate header file to simplify building this module.
|
||||||
|
|
||||||
The optional *flag* argument must be one of these values:
|
The optional *flag* argument must be one of these values:
|
||||||
|
|
||||||
+---------+-------------------------------------------+
|
.. csv-table::
|
||||||
| Value | Meaning |
|
:header: "Value", "Meaning"
|
||||||
+=========+===========================================+
|
|
||||||
| ``'r'`` | Open existing database for reading only |
|
``'r'`` (default), |flag_r|
|
||||||
| | (default) |
|
``'w'``, |flag_w|
|
||||||
+---------+-------------------------------------------+
|
``'c'``, |flag_c|
|
||||||
| ``'w'`` | Open existing database for reading and |
|
``'n'``, |flag_n|
|
||||||
| | writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'c'`` | Open database for reading and writing, |
|
|
||||||
| | creating it if it doesn't exist |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'n'`` | Always create a new, empty database, open |
|
|
||||||
| | for reading and writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
|
|
||||||
The optional *mode* argument is the Unix mode of the file, used only when the
|
The optional *mode* argument is the Unix mode of the file, used only when the
|
||||||
database has to be created. It defaults to octal ``0o666`` (and will be
|
database has to be created. It defaults to octal ``0o666`` (and will be
|
||||||
|
@ -363,21 +354,13 @@ The module defines the following:
|
||||||
|
|
||||||
The optional *flag* argument can be:
|
The optional *flag* argument can be:
|
||||||
|
|
||||||
+---------+-------------------------------------------+
|
.. csv-table::
|
||||||
| Value | Meaning |
|
:header: "Value", "Meaning"
|
||||||
+=========+===========================================+
|
|
||||||
| ``'r'`` | Open existing database for reading only |
|
``'r'``, |flag_r|
|
||||||
| | (default) |
|
``'w'``, |flag_w|
|
||||||
+---------+-------------------------------------------+
|
``'c'`` (default), |flag_c|
|
||||||
| ``'w'`` | Open existing database for reading and |
|
``'n'``, |flag_n|
|
||||||
| | writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'c'`` | Open database for reading and writing, |
|
|
||||||
| | creating it if it doesn't exist |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
| ``'n'`` | Always create a new, empty database, open |
|
|
||||||
| | for reading and writing |
|
|
||||||
+---------+-------------------------------------------+
|
|
||||||
|
|
||||||
The optional *mode* argument is the Unix mode of the file, used only when the
|
The optional *mode* argument is the Unix mode of the file, used only when the
|
||||||
database has to be created. It defaults to octal ``0o666`` (and will be modified
|
database has to be created. It defaults to octal ``0o666`` (and will be modified
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue