X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2Fcompat.py;h=7b770340ff4316a1d6710fc4f37cb912d62bfb9a;hb=3052a30d4259b182904e5d2430077039461745bb;hp=27ece2d294cec8e5c816f7c57fef320404d9103f;hpb=65220c3bd6bfcb9023af904634ce1e76592cfe3e;p=youtube-dl.git diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py index 27ece2d29..7b770340f 100644 --- a/youtube_dl/compat.py +++ b/youtube_dl/compat.py @@ -2787,6 +2787,12 @@ except NameError: # Python 3 compat_numeric_types = (int, float, complex) +try: + compat_integer_types = (int, long) +except NameError: # Python 3 + compat_integer_types = (int, ) + + if sys.version_info < (2, 7): def compat_socket_create_connection(address, timeout, source_address=None): host, port = address @@ -2909,8 +2915,8 @@ else: if platform.python_implementation() == 'IronPython' and sys.version_info < (2, 7, 8): class compat_Struct(struct.Struct): def unpack(self, string): - if not isinstance(string, buffer): - string = buffer(string) + if not isinstance(string, buffer): # noqa: F821 + string = buffer(string) # noqa: F821 return super(compat_Struct, self).unpack(string) else: compat_Struct = struct.Struct @@ -2974,6 +2980,7 @@ __all__ = [ 'compat_http_client', 'compat_http_server', 'compat_input', + 'compat_integer_types', 'compat_itertools_count', 'compat_kwargs', 'compat_numeric_types',