]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Docs: use placeholders in dbm flag param docs (#114482)
authorErlend E. Aasland <erlend@python.org>
Tue, 23 Jan 2024 19:54:44 +0000 (20:54 +0100)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2024 19:54:44 +0000 (20:54 +0100)
Also correct the default flag param for dbm.dumb.open();
it's 'c', not 'r'.

Doc/library/dbm.rst

index cb95c61322582f6affad31f512e77c20f8ba6dd1..eca1c25602a018e3125d6ab7ef4b92a650a2b2d2 100644 (file)
@@ -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.
@@ -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
@@ -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:
@@ -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
@@ -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