Skip to content

Commit c25e7d6

Browse files
committed
byte-like object -> bytes
1 parent 65e36ae commit c25e7d6

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎Doc/library/shlex.rst‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ The :mod:`!shlex` module defines the following functions:
1818

1919
.. function:: split(s, comments=False, posix=True)
2020

21-
Split the string or byte-like object *s* using shell-like syntax. If
22-
*comments* is :const:`False` (the default), the parsing of comments in the
23-
given string will be disabled (setting the :attr:`~shlex.commenters`
24-
attribute of the :class:`~shlex.shlex` instance to the empty string). This
25-
function operates in POSIX mode by default, but uses non-POSIX mode if the
26-
*posix* argument is false.
21+
Split the string or bytes *s* using shell-like syntax. If *comments* is
22+
:const:`False` (the default), the parsing of comments in the given string
23+
will be disabled (setting the :attr:`~shlex.commenters` attribute of the
24+
:class:`~shlex.shlex` instance to the empty string). This function operates
25+
in POSIX mode by default, but uses non-POSIX mode if the *posix* argument is
26+
false.
2727

2828
.. versionchanged:: 3.12
2929
Passing ``None`` for *s* argument now raises an exception, rather than
3030
reading :data:`sys.stdin`.
3131

3232
.. versionchanged:: 3.16
33-
Support byte-like object as input.
33+
Support bytes as input.
3434

3535
.. function:: join(split_command)
3636

@@ -47,14 +47,14 @@ The :mod:`!shlex` module defines the following functions:
4747
.. versionadded:: 3.8
4848

4949
.. versionchanged:: 3.16
50-
Support sequence of byte-like objects as input.
50+
Support sequence of bytes as input.
5151

5252

5353
.. function:: quote(s, *, force=False)
5454

55-
Return a shell-escaped version of the string or byte-like object *s*. The
56-
returned value is a string or bytes object that can safely be used as one
57-
token in a shell command line, for cases where you cannot use a list.
55+
Return a shell-escaped version of the string or bytes *s*. The returned
56+
value is a string or bytes object that can safely be used as one token in a
57+
shell command line, for cases where you cannot use a list.
5858

5959
If *force* is :const:`True`, then *s* is unconditionally quoted,
6060
even if it is already safe for a shell without being quoted.
@@ -116,7 +116,7 @@ The :mod:`!shlex` module defines the following functions:
116116

117117
.. versionchanged:: 3.16
118118
The *force* keyword was added.
119-
Support byte-like object as input.
119+
Support bytes as input.
120120

121121
The :mod:`!shlex` module defines the following class:
122122

@@ -152,7 +152,7 @@ The :mod:`!shlex` module defines the following class:
152152
The *punctuation_chars* parameter was added.
153153

154154
.. versionchanged:: 3.16
155-
Support byte-like object or binary IO as *instream*.
155+
Support bytes or binary IO as *instream*.
156156

157157
.. seealso::
158158

‎Lib/shlex.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def __next__(self):
330330
return token
331331

332332
def split(s, comments=False, posix=True):
333-
"""Split the string or byte-like object *s* using shell-like syntax."""
333+
"""Split the string or bytes *s* using shell-like syntax."""
334334
if s is None:
335335
raise ValueError("s argument must not be None")
336336
lex = shlex(s, posix=posix)
@@ -341,14 +341,14 @@ def split(s, comments=False, posix=True):
341341

342342

343343
def join(split_command):
344-
"""Return a shell-escaped string from *split_command*."""
344+
"""Return a shell-escaped string or bytes from *split_command*."""
345345
split_command = list(split_command)
346346
space = b' ' if split_command and isinstance(split_command[0], bytes) else ' '
347347
return space.join(quote(arg) for arg in split_command)
348348

349349

350350
def quote(s, *, force=False):
351-
"""Return a shell-escaped version of the string *s*.
351+
"""Return a shell-escaped version of the string or bytes *s*.
352352
353353
If *force* is *True*, then *s* is unconditionally quoted,
354354
even if it is already safe for a shell without being quoted.

0 commit comments

Comments
 (0)