From 591a05c6c8ade3415e9863935f7c7a8d6a232e66 Mon Sep 17 00:00:00 2001 From: Yuki Kobayashi Date: Thu, 20 Feb 2025 21:56:27 +0900 Subject: [PATCH 1/2] gh-101100: Fix sphinx warnings in `readline.rst` (GH-130300) (cherry picked from commit 3bda821a83dfc660eba09718845ff92ef9e274c7) Co-authored-by: Yuki Kobayashi --- Doc/library/readline.rst | 46 ++++++++++++++++++++-------------------- Doc/tools/.nitignore | 1 - 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst index f02aec8a6a8105..5479ccf7f62615 100644 --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -58,13 +58,13 @@ The following functions relate to the init file and user configuration: .. function:: parse_and_bind(string) Execute the init line provided in the *string* argument. This calls - :c:func:`rl_parse_and_bind` in the underlying library. + :c:func:`!rl_parse_and_bind` in the underlying library. .. function:: read_init_file([filename]) Execute a readline initialization file. The default filename is the last filename - used. This calls :c:func:`rl_read_init_file` in the underlying library. + used. This calls :c:func:`!rl_read_init_file` in the underlying library. Line buffer @@ -75,21 +75,21 @@ The following functions operate on the line buffer: .. function:: get_line_buffer() - Return the current contents of the line buffer (:c:data:`rl_line_buffer` + Return the current contents of the line buffer (:c:data:`!rl_line_buffer` in the underlying library). .. function:: insert_text(string) Insert text into the line buffer at the cursor position. This calls - :c:func:`rl_insert_text` in the underlying library, but ignores + :c:func:`!rl_insert_text` in the underlying library, but ignores the return value. .. function:: redisplay() Change what's displayed on the screen to reflect the current contents of the - line buffer. This calls :c:func:`rl_redisplay` in the underlying library. + line buffer. This calls :c:func:`!rl_redisplay` in the underlying library. History file @@ -102,21 +102,21 @@ The following functions operate on a history file: Load a readline history file, and append it to the history list. The default filename is :file:`~/.history`. This calls - :c:func:`read_history` in the underlying library. + :c:func:`!read_history` in the underlying library. .. function:: write_history_file([filename]) Save the history list to a readline history file, overwriting any existing file. The default filename is :file:`~/.history`. This calls - :c:func:`write_history` in the underlying library. + :c:func:`!write_history` in the underlying library. .. function:: append_history_file(nelements[, filename]) Append the last *nelements* items of history to a file. The default filename is :file:`~/.history`. The file must already exist. This calls - :c:func:`append_history` in the underlying library. This function + :c:func:`!append_history` in the underlying library. This function only exists if Python was compiled for a version of the library that supports it. @@ -128,7 +128,7 @@ The following functions operate on a history file: Set or return the desired number of lines to save in the history file. The :func:`write_history_file` function uses this value to truncate - the history file, by calling :c:func:`history_truncate_file` in + the history file, by calling :c:func:`!history_truncate_file` in the underlying library. Negative values imply unlimited history file size. @@ -141,7 +141,7 @@ The following functions operate on a global history list: .. function:: clear_history() - Clear the current history. This calls :c:func:`clear_history` in the + Clear the current history. This calls :c:func:`!clear_history` in the underlying library. The Python function only exists if Python was compiled for a version of the library that supports it. @@ -156,32 +156,32 @@ The following functions operate on a global history list: .. function:: get_history_item(index) Return the current contents of history item at *index*. The item index - is one-based. This calls :c:func:`history_get` in the underlying library. + is one-based. This calls :c:func:`!history_get` in the underlying library. .. function:: remove_history_item(pos) Remove history item specified by its position from the history. - The position is zero-based. This calls :c:func:`remove_history` in + The position is zero-based. This calls :c:func:`!remove_history` in the underlying library. .. function:: replace_history_item(pos, line) Replace history item specified by its position with *line*. - The position is zero-based. This calls :c:func:`replace_history_entry` + The position is zero-based. This calls :c:func:`!replace_history_entry` in the underlying library. .. function:: add_history(line) Append *line* to the history buffer, as if it was the last line typed. - This calls :c:func:`add_history` in the underlying library. + This calls :c:func:`!add_history` in the underlying library. .. function:: set_auto_history(enabled) - Enable or disable automatic calls to :c:func:`add_history` when reading + Enable or disable automatic calls to :c:func:`!add_history` when reading input via readline. The *enabled* argument should be a Boolean value that when true, enables auto history, and that when false, disables auto history. @@ -199,7 +199,7 @@ Startup hooks .. function:: set_startup_hook([function]) - Set or remove the function invoked by the :c:data:`rl_startup_hook` + Set or remove the function invoked by the :c:data:`!rl_startup_hook` callback of the underlying library. If *function* is specified, it will be used as the new hook function; if omitted or ``None``, any function already installed is removed. The hook is called with no @@ -208,7 +208,7 @@ Startup hooks .. function:: set_pre_input_hook([function]) - Set or remove the function invoked by the :c:data:`rl_pre_input_hook` + Set or remove the function invoked by the :c:data:`!rl_pre_input_hook` callback of the underlying library. If *function* is specified, it will be used as the new hook function; if omitted or ``None``, any function already installed is removed. The hook is called @@ -240,9 +240,9 @@ with a custom completer, a different set of word delimiters should be set. starting with *text*. The installed completer function is invoked by the *entry_func* callback - passed to :c:func:`rl_completion_matches` in the underlying library. + passed to :c:func:`!rl_completion_matches` in the underlying library. The *text* string comes from the first parameter to the - :c:data:`rl_attempted_completion_function` callback of the + :c:data:`!rl_attempted_completion_function` callback of the underlying library. @@ -254,7 +254,7 @@ with a custom completer, a different set of word delimiters should be set. .. function:: get_completion_type() Get the type of completion being attempted. This returns the - :c:data:`rl_completion_type` variable in the underlying library as + :c:data:`!rl_completion_type` variable in the underlying library as an integer. @@ -263,7 +263,7 @@ with a custom completer, a different set of word delimiters should be set. Get the beginning or ending index of the completion scope. These indexes are the *start* and *end* arguments passed to the - :c:data:`rl_attempted_completion_function` callback of the + :c:data:`!rl_attempted_completion_function` callback of the underlying library. The values may be different in the same input editing scenario based on the underlying C readline implementation. Ex: libedit is known to behave differently than libreadline. @@ -274,7 +274,7 @@ with a custom completer, a different set of word delimiters should be set. Set or get the word delimiters for completion. These determine the start of the word to be considered for completion (the completion scope). - These functions access the :c:data:`rl_completer_word_break_characters` + These functions access the :c:data:`!rl_completer_word_break_characters` variable in the underlying library. @@ -284,7 +284,7 @@ with a custom completer, a different set of word delimiters should be set. specified, it will be used as the new completion display function; if omitted or ``None``, any completion display function already installed is removed. This sets or clears the - :c:data:`rl_completion_display_matches_hook` callback in the + :c:data:`!rl_completion_display_matches_hook` callback in the underlying library. The completion display function is called as ``function(substitution, [matches], longest_match_length)`` once each time matches need to be displayed. diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index c648717d54fa52..70a5fda3c2b7a3 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -50,7 +50,6 @@ Doc/library/platform.rst Doc/library/plistlib.rst Doc/library/profile.rst Doc/library/pyexpat.rst -Doc/library/readline.rst Doc/library/resource.rst Doc/library/select.rst Doc/library/signal.rst From 0d1b31844507cd049f091984bf8b49cd3030aba4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Thu, 20 Feb 2025 15:03:03 +0200 Subject: [PATCH 2/2] One warning remains: py:const reference target not found: readline.__doc__ [ref.const] --- Doc/tools/.nitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index 70a5fda3c2b7a3..c648717d54fa52 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -50,6 +50,7 @@ Doc/library/platform.rst Doc/library/plistlib.rst Doc/library/profile.rst Doc/library/pyexpat.rst +Doc/library/readline.rst Doc/library/resource.rst Doc/library/select.rst Doc/library/signal.rst