Skip to content

Commit

Permalink
[compat] Add compat_casefold and compat_re_Match, for traverse_obj() …
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
dirkf authored Oct 31, 2022
1 parent a19855f commit f102e3d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions youtube_dl/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2375,8 +2375,10 @@ class compat_HTMLParseError(Exception):

try:
compat_str = unicode # Python 2
from .casefold import casefold as compat_casefold
except NameError:
compat_str = str
compat_casefold = lambda s: s.casefold()

try:
from urllib.parse import unquote_to_bytes as compat_urllib_parse_unquote_to_bytes
Expand Down Expand Up @@ -3066,6 +3068,9 @@ def parents(self):

# Pythons disagree on the type of a pattern (RegexObject, _sre.SRE_Pattern, Pattern, ...?)
compat_re_Pattern = type(re.compile(''))
# and on the type of a match
compat_re_Match = type(re.match('a', 'a'))


if sys.version_info < (3, 3):
def compat_b64decode(s, *args, **kwargs):
Expand Down Expand Up @@ -3101,6 +3106,7 @@ def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
'compat_Struct',
'compat_b64decode',
'compat_basestring',
'compat_casefold',
'compat_chr',
'compat_collections_abc',
'compat_collections_chain_map',
Expand Down Expand Up @@ -3132,6 +3138,7 @@ def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
'compat_os_name',
'compat_parse_qs',
'compat_print',
'compat_re_Match',
'compat_re_Pattern',
'compat_realpath',
'compat_setenv',
Expand Down

0 comments on commit f102e3d

Please sign in to comment.