mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-07-01 11:32:49 -05:00
[compat] Rename struct_(un)pack to compat_struct_(un)pack
This commit is contained in:
@ -599,18 +599,18 @@ try:
|
||||
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):
|
||||
def compat_struct_pack(spec, *args):
|
||||
if isinstance(spec, compat_str):
|
||||
spec = spec.encode('ascii')
|
||||
return struct.pack(spec, *args)
|
||||
|
||||
def struct_unpack(spec, *args):
|
||||
def compat_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
|
||||
compat_struct_pack = struct.pack
|
||||
compat_struct_unpack = struct.unpack
|
||||
|
||||
|
||||
__all__ = [
|
||||
@ -638,6 +638,8 @@ __all__ = [
|
||||
'compat_shlex_split',
|
||||
'compat_socket_create_connection',
|
||||
'compat_str',
|
||||
'compat_struct_pack',
|
||||
'compat_struct_unpack',
|
||||
'compat_subprocess_get_DEVNULL',
|
||||
'compat_tokenize_tokenize',
|
||||
'compat_urllib_error',
|
||||
@ -655,8 +657,6 @@ __all__ = [
|
||||
'compat_xml_parse_error',
|
||||
'compat_xpath',
|
||||
'shlex_quote',
|
||||
'struct_pack',
|
||||
'struct_unpack',
|
||||
'subprocess_check_output',
|
||||
'workaround_optparse_bug9161',
|
||||
]
|
||||
|
Reference in New Issue
Block a user