@@ -412,17 +412,17 @@ otherwise. To illustrate, you can see the difference in the following snippet:
412
412
.. doctest ::
413
413
:options: +NORMALIZE_WHITESPACE
414
414
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', ')']
426
426
427
427
Of course, tokens will be returned which are not valid for shells, and you'll
428
428
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,
431
431
you can pass a string with specific characters, which will be used to determine
432
432
which characters constitute punctuation. For example::
433
433
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']
438
438
439
439
.. note :: When ``punctuation_chars`` is specified, the :attr:`~shlex.wordchars`
440
440
attribute is augmented with the characters ``~-./*?= ``. That is because these
0 commit comments