diff options
| author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-04-23 18:28:49 +0800 | 
|---|---|---|
| committer | Yen Chi Hsuan <yan12125@gmail.com> | 2016-05-10 14:51:38 +0800 | 
| commit | dab0daeeb0929b9b560d2b9a5f39c1e2e6dfa449 (patch) | |
| tree | ed4c6036aa4e509a9d46e9c184c819702fb4f5c5 /youtube_dl/utils.py | |
| parent | 4350b74545ea3d3ce072444655613bc6974d5516 (diff) | |
[utils,compat] Move struct_pack and struct_unpack to compat.py
Diffstat (limited to 'youtube_dl/utils.py')
| -rw-r--r-- | youtube_dl/utils.py | 20 | 
1 files changed, 1 insertions, 19 deletions
| diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 6e4573784..fa16a42ad 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -26,7 +26,6 @@ import platform  import re  import socket  import ssl -import struct  import subprocess  import sys  import tempfile @@ -53,6 +52,7 @@ from .compat import (      compat_urlparse,      compat_xpath,      shlex_quote, +    struct_pack,  ) @@ -1761,24 +1761,6 @@ def escape_url(url):          fragment=escape_rfc3986(url_parsed.fragment)      ).geturl() -try: -    struct.pack('!I', 0) -except TypeError: -    # In Python 2.6 and 2.7.x < 2.7.7, struct requires a bytes argument -    # See https://bugs.python.org/issue19099 -    def struct_pack(spec, *args): -        if isinstance(spec, compat_str): -            spec = spec.encode('ascii') -        return struct.pack(spec, *args) - -    def struct_unpack(spec, *args): -        if isinstance(spec, compat_str): -            spec = spec.encode('ascii') -        return struct.unpack(spec, *args) -else: -    struct_pack = struct.pack -    struct_unpack = struct.unpack -  def read_batch_urls(batch_fd):      def fixup(url): | 
