summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>2024-04-13 11:31:01 (GMT)
committerGitHub <noreply@github.com>2024-04-13 11:31:01 (GMT)
commitdd724239dd759879b9b6981114db25256449fc42 (patch)
treef6b06c0c4772905b16a3b776b4afc2c561cb7f10
parent37a4cbd8727fe392dd5c78aea60a7c37fdbad89a (diff)
downloadcpython-dd724239dd759879b9b6981114db25256449fc42.zip
cpython-dd724239dd759879b9b6981114db25256449fc42.tar.gz
cpython-dd724239dd759879b9b6981114db25256449fc42.tar.bz2
gh-117840: Fix indent to fix shlex syntax highlighting (#117843)
-rw-r--r--Doc/library/shlex.rst30
1 files changed, 15 insertions, 15 deletions
diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst
index f94833a..716420f 100644
--- a/Doc/library/shlex.rst
+++ b/Doc/library/shlex.rst
@@ -412,17 +412,17 @@ otherwise. To illustrate, you can see the difference in the following snippet:
.. doctest::
:options: +NORMALIZE_WHITESPACE
- >>> import shlex
- >>> text = "a && b; c && d || e; f >'abc'; (def \"ghi\")"
- >>> s = shlex.shlex(text, posix=True)
- >>> s.whitespace_split = True
- >>> list(s)
- ['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']
- >>> s = shlex.shlex(text, posix=True, punctuation_chars=True)
- >>> s.whitespace_split = True
- >>> list(s)
- ['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',
- '(', 'def', 'ghi', ')']
+ >>> import shlex
+ >>> text = "a && b; c && d || e; f >'abc'; (def \"ghi\")"
+ >>> s = shlex.shlex(text, posix=True)
+ >>> s.whitespace_split = True
+ >>> list(s)
+ ['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']
+ >>> s = shlex.shlex(text, posix=True, punctuation_chars=True)
+ >>> s.whitespace_split = True
+ >>> list(s)
+ ['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',
+ '(', 'def', 'ghi', ')']
Of course, tokens will be returned which are not valid for shells, and you'll
need to implement your own error checks on the returned tokens.
@@ -431,10 +431,10 @@ Instead of passing ``True`` as the value for the punctuation_chars parameter,
you can pass a string with specific characters, which will be used to determine
which characters constitute punctuation. For example::
- >>> import shlex
- >>> s = shlex.shlex("a && b || c", punctuation_chars="|")
- >>> list(s)
- ['a', '&', '&', 'b', '||', 'c']
+ >>> import shlex
+ >>> s = shlex.shlex("a && b || c", punctuation_chars="|")
+ >>> list(s)
+ ['a', '&', '&', 'b', '||', 'c']
.. note:: When ``punctuation_chars`` is specified, the :attr:`~shlex.wordchars`
attribute is augmented with the characters ``~-./*?=``. That is because these