Skip to content

Docs: use placeholders in dbm flag param docs #114482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 43 additions & 60 deletions Doc/library/dbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ the Oracle Berkeley DB.
.. versionchanged:: 3.11
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)

Open the database file *file* and return a corresponding object.
Expand All @@ -46,21 +61,13 @@ the Oracle Berkeley DB.

The optional *flag* argument can be:

+---------+-------------------------------------------+
| Value | Meaning |
+=========+===========================================+
| ``'r'`` | Open existing database for reading only |
| | (default) |
+---------+-------------------------------------------+
| ``'w'`` | Open existing database for reading and |
| | 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 |
+---------+-------------------------------------------+
.. csv-table::
:header: "Value", "Meaning"

``'r'`` (default), |flag_r|
``'w'``, |flag_w|
``'c'``, |flag_c|
``'n'``, |flag_n|

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
Expand Down Expand Up @@ -165,21 +172,13 @@ supported.

The optional *flag* argument can be:

+---------+-------------------------------------------+
| Value | Meaning |
+=========+===========================================+
| ``'r'`` | Open existing database for reading only |
| | (default) |
+---------+-------------------------------------------+
| ``'w'`` | Open existing database for reading and |
| | 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 |
+---------+-------------------------------------------+
.. csv-table::
:header: "Value", "Meaning"

``'r'`` (default), |flag_r|
``'w'``, |flag_w|
``'c'``, |flag_c|
``'n'``, |flag_n|

The following additional characters may be appended to the flag to control
how the database is opened:
Expand Down Expand Up @@ -297,21 +296,13 @@ to locate the appropriate header file to simplify building this module.

The optional *flag* argument must be one of these values:

+---------+-------------------------------------------+
| Value | Meaning |
+=========+===========================================+
| ``'r'`` | Open existing database for reading only |
| | (default) |
+---------+-------------------------------------------+
| ``'w'`` | Open existing database for reading and |
| | 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 |
+---------+-------------------------------------------+
.. csv-table::
:header: "Value", "Meaning"

``'r'`` (default), |flag_r|
``'w'``, |flag_w|
``'c'``, |flag_c|
``'n'``, |flag_n|

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
Expand Down Expand Up @@ -376,21 +367,13 @@ The module defines the following:

The optional *flag* argument can be:

+---------+-------------------------------------------+
| Value | Meaning |
+=========+===========================================+
| ``'r'`` | Open existing database for reading only |
| | (default) |
+---------+-------------------------------------------+
| ``'w'`` | Open existing database for reading and |
| | 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 |
+---------+-------------------------------------------+
.. csv-table::
:header: "Value", "Meaning"

``'r'``, |flag_r|
``'w'``, |flag_w|
``'c'`` (default), |flag_c|
``'n'``, |flag_n|

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
Expand Down