aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/compat.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-05-10 15:58:25 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-05-10 16:00:21 +0800
commit702ccf2dc08603fed98d2672f86af1a0e300d83e (patch)
tree1be58fdfba6658ed3541fcc37473d49a2aa421f8 /youtube_dl/compat.py
parent28b4f73620c82e7007b3154e4d5f437cf6fb2608 (diff)
[compat] Rename shlex_quote and remove unused subprocess_check_output
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r--youtube_dl/compat.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index e48c761a6..1392361a1 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -341,9 +341,9 @@ except ImportError: # Python 2
return parsed_result
try:
- from shlex import quote as shlex_quote
+ from shlex import quote as compat_shlex_quote
except ImportError: # Python < 3.3
- def shlex_quote(s):
+ def compat_shlex_quote(s):
if re.match(r'^[-_\w./]+$', s):
return s
else:
@@ -466,18 +466,6 @@ else:
print(s)
-try:
- subprocess_check_output = subprocess.check_output
-except AttributeError:
- def subprocess_check_output(*args, **kwargs):
- assert 'input' not in kwargs
- p = subprocess.Popen(*args, stdout=subprocess.PIPE, **kwargs)
- output, _ = p.communicate()
- ret = p.poll()
- if ret:
- raise subprocess.CalledProcessError(ret, p.args, output=output)
- return output
-
if sys.version_info < (3, 0) and sys.platform == 'win32':
def compat_getpass(prompt, *args, **kwargs):
if isinstance(prompt, compat_str):
@@ -635,6 +623,7 @@ __all__ = [
'compat_parse_qs',
'compat_print',
'compat_setenv',
+ 'compat_shlex_quote',
'compat_shlex_split',
'compat_socket_create_connection',
'compat_str',
@@ -656,7 +645,5 @@ __all__ = [
'compat_urlretrieve',
'compat_xml_parse_error',
'compat_xpath',
- 'shlex_quote',
- 'subprocess_check_output',
'workaround_optparse_bug9161',
]