Skip to content

Commit dd72423

Browse files
authored
gh-117840: Fix indent to fix shlex syntax highlighting (#117843)
1 parent 37a4cbd commit dd72423

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Doc/library/shlex.rst

+15-15
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,17 @@ otherwise. To illustrate, you can see the difference in the following snippet:
412412
.. doctest::
413413
:options: +NORMALIZE_WHITESPACE
414414

415-
>>> import shlex
416-
>>> text = "a && b; c && d || e; f >'abc'; (def \"ghi\")"
417-
>>> s = shlex.shlex(text, posix=True)
418-
>>> s.whitespace_split = True
419-
>>> list(s)
420-
['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']
421-
>>> s = shlex.shlex(text, posix=True, punctuation_chars=True)
422-
>>> s.whitespace_split = True
423-
>>> list(s)
424-
['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',
425-
'(', 'def', 'ghi', ')']
415+
>>> import shlex
416+
>>> text = "a && b; c && d || e; f >'abc'; (def \"ghi\")"
417+
>>> s = shlex.shlex(text, posix=True)
418+
>>> s.whitespace_split = True
419+
>>> list(s)
420+
['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']
421+
>>> s = shlex.shlex(text, posix=True, punctuation_chars=True)
422+
>>> s.whitespace_split = True
423+
>>> list(s)
424+
['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',
425+
'(', 'def', 'ghi', ')']
426426

427427
Of course, tokens will be returned which are not valid for shells, and you'll
428428
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,
431431
you can pass a string with specific characters, which will be used to determine
432432
which characters constitute punctuation. For example::
433433

434-
>>> import shlex
435-
>>> s = shlex.shlex("a && b || c", punctuation_chars="|")
436-
>>> list(s)
437-
['a', '&', '&', 'b', '||', 'c']
434+
>>> import shlex
435+
>>> s = shlex.shlex("a && b || c", punctuation_chars="|")
436+
>>> list(s)
437+
['a', '&', '&', 'b', '||', 'c']
438438

439439
.. note:: When ``punctuation_chars`` is specified, the :attr:`~shlex.wordchars`
440440
attribute is augmented with the characters ``~-./*?=``. That is because these

0 commit comments

Comments
 (0)