From ff596ee5349308e4baa8a8a9309d7f22d0c7182d Mon Sep 17 00:00:00 2001 From: andrei kulakov Date: Sun, 8 Aug 2021 20:54:11 -0400 Subject: [PATCH 1/3] add missing placeholder arg; move kwargsonly marker --- Doc/library/textwrap.rst | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst index 7780e241769657..d2148e9c8cee2b 100644 --- a/Doc/library/textwrap.rst +++ b/Doc/library/textwrap.rst @@ -17,11 +17,11 @@ If you're just wrapping or filling one or two text strings, the convenience functions should be good enough; otherwise, you should use an instance of :class:`TextWrapper` for efficiency. -.. function:: wrap(text, width=70, *, initial_indent="", \ - subsequent_indent="", expand_tabs=True, \ - replace_whitespace=True, fix_sentence_endings=False, \ - break_long_words=True, drop_whitespace=True, \ - break_on_hyphens=True, tabsize=8, max_lines=None) +.. function:: wrap(text, width=70, initial_indent="", subsequent_indent="", \ + expand_tabs=True, replace_whitespace=True, \ + fix_sentence_endings=False, break_long_words=True, \ + drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, \ + max_lines=None, placeholder=' [...]') Wraps the single paragraph in *text* (a string) so every line is at most *width* characters long. Returns a list of output lines, without final @@ -34,12 +34,11 @@ functions should be good enough; otherwise, you should use an instance of :func:`wrap` behaves. -.. function:: fill(text, width=70, *, initial_indent="", \ - subsequent_indent="", expand_tabs=True, \ - replace_whitespace=True, fix_sentence_endings=False, \ - break_long_words=True, drop_whitespace=True, \ - break_on_hyphens=True, tabsize=8, \ - max_lines=None) +.. function:: fill(text, width=70, initial_indent="", subsequent_indent="", \ + expand_tabs=True, replace_whitespace=True, \ + fix_sentence_endings=False, break_long_words=True, \ + drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, \ + max_lines=None, placeholder=' [...]') Wraps the single paragraph in *text*, and returns a single string containing the wrapped paragraph. :func:`fill` is shorthand for :: @@ -50,8 +49,8 @@ functions should be good enough; otherwise, you should use an instance of :func:`wrap`. -.. function:: shorten(text, width, *, fix_sentence_endings=False, \ - break_long_words=True, break_on_hyphens=True, \ +.. function:: shorten(text, width, fix_sentence_endings=False, \ + break_long_words=True, break_on_hyphens=True, *, \ placeholder=' [...]') Collapse and truncate the given *text* to fit in the given *width*. From 55e43331925c6ea5641968c0f4afb56ad4ac69ce Mon Sep 17 00:00:00 2001 From: andrei kulakov Date: Sun, 8 Aug 2021 20:56:41 -0400 Subject: [PATCH 2/3] formatting --- Doc/library/textwrap.rst | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst index d2148e9c8cee2b..22562b06cfd75a 100644 --- a/Doc/library/textwrap.rst +++ b/Doc/library/textwrap.rst @@ -17,11 +17,12 @@ If you're just wrapping or filling one or two text strings, the convenience functions should be good enough; otherwise, you should use an instance of :class:`TextWrapper` for efficiency. -.. function:: wrap(text, width=70, initial_indent="", subsequent_indent="", \ - expand_tabs=True, replace_whitespace=True, \ - fix_sentence_endings=False, break_long_words=True, \ - drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, \ - max_lines=None, placeholder=' [...]') +.. function:: wrap(text, width=70, initial_indent="", \ + subsequent_indent="", expand_tabs=True, \ + replace_whitespace=True, fix_sentence_endings=False, \ + break_long_words=True, drop_whitespace=True, \ + break_on_hyphens=True, tabsize=8, *, max_lines=None, \ + placeholder=' [...]') Wraps the single paragraph in *text* (a string) so every line is at most *width* characters long. Returns a list of output lines, without final @@ -34,11 +35,12 @@ functions should be good enough; otherwise, you should use an instance of :func:`wrap` behaves. -.. function:: fill(text, width=70, initial_indent="", subsequent_indent="", \ - expand_tabs=True, replace_whitespace=True, \ - fix_sentence_endings=False, break_long_words=True, \ - drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, \ - max_lines=None, placeholder=' [...]') +.. function:: fill(text, width=70, initial_indent="", \ + subsequent_indent="", expand_tabs=True, \ + replace_whitespace=True, fix_sentence_endings=False, \ + break_long_words=True, drop_whitespace=True, \ + break_on_hyphens=True, tabsize=8, \ + *, max_lines=None, placeholder=' [...]') Wraps the single paragraph in *text*, and returns a single string containing the wrapped paragraph. :func:`fill` is shorthand for :: @@ -50,8 +52,8 @@ functions should be good enough; otherwise, you should use an instance of .. function:: shorten(text, width, fix_sentence_endings=False, \ - break_long_words=True, break_on_hyphens=True, *, \ - placeholder=' [...]') + break_long_words=True, break_on_hyphens=True, \ + *, placeholder=' [...]') Collapse and truncate the given *text* to fit in the given *width*. From 20abcd309e3967803f6e27c0c76b6de01604c1f8 Mon Sep 17 00:00:00 2001 From: andrei kulakov Date: Sun, 8 Aug 2021 21:06:35 -0400 Subject: [PATCH 3/3] move kwonly marker back --- Doc/library/textwrap.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst index 22562b06cfd75a..1a9d5f98f78a7e 100644 --- a/Doc/library/textwrap.rst +++ b/Doc/library/textwrap.rst @@ -17,11 +17,11 @@ If you're just wrapping or filling one or two text strings, the convenience functions should be good enough; otherwise, you should use an instance of :class:`TextWrapper` for efficiency. -.. function:: wrap(text, width=70, initial_indent="", \ +.. function:: wrap(text, width=70, *, initial_indent="", \ subsequent_indent="", expand_tabs=True, \ replace_whitespace=True, fix_sentence_endings=False, \ break_long_words=True, drop_whitespace=True, \ - break_on_hyphens=True, tabsize=8, *, max_lines=None, \ + break_on_hyphens=True, tabsize=8, max_lines=None, \ placeholder=' [...]') Wraps the single paragraph in *text* (a string) so every line is at most @@ -35,12 +35,12 @@ functions should be good enough; otherwise, you should use an instance of :func:`wrap` behaves. -.. function:: fill(text, width=70, initial_indent="", \ +.. function:: fill(text, width=70, *, initial_indent="", \ subsequent_indent="", expand_tabs=True, \ replace_whitespace=True, fix_sentence_endings=False, \ break_long_words=True, drop_whitespace=True, \ break_on_hyphens=True, tabsize=8, \ - *, max_lines=None, placeholder=' [...]') + max_lines=None, placeholder=' [...]') Wraps the single paragraph in *text*, and returns a single string containing the wrapped paragraph. :func:`fill` is shorthand for :: @@ -51,9 +51,9 @@ functions should be good enough; otherwise, you should use an instance of :func:`wrap`. -.. function:: shorten(text, width, fix_sentence_endings=False, \ +.. function:: shorten(text, width, *, fix_sentence_endings=False, \ break_long_words=True, break_on_hyphens=True, \ - *, placeholder=' [...]') + placeholder=' [...]') Collapse and truncate the given *text* to fit in the given *width*.