Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions six.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,21 @@ def ensure_text(s, encoding='utf-8', errors='strict'):
raise TypeError("not expecting type '%s'" % type(s))



def shlex_join(split_command):
"""Return a shell-escaped string from *split_command*.

Portable wrapper around :func:`shlex.join` (Python 3.8+) with a
fallback for older interpreters (issue #386).
"""
try:
from shlex import join as _shlex_join
except ImportError:
from shlex import quote as _shlex_quote
def _shlex_join(split_command):
return " ".join(_shlex_quote(arg) for arg in split_command)
return _shlex_join(split_command)

def python_2_unicode_compatible(klass):
"""
A class decorator that defines __unicode__ and __str__ methods under Python 2.
Expand Down