diff options
author | dirkf <[email protected]> | 2022-10-31 21:27:14 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-31 21:27:14 +0000 |
commit | f102e3dc4efe27e6c8697d6d117f05d1bb6d1b91 (patch) | |
tree | 21fa5f20fe5f8740343f18f29c4c40e60b0036b0 /youtube_dl/compat.py | |
parent | a19855f0f50fe7a6eb05a1d8fee554897e4dbdda (diff) | |
download | youtube-dl-f102e3dc4efe27e6c8697d6d117f05d1bb6d1b91.tar.gz youtube-dl-f102e3dc4efe27e6c8697d6d117f05d1bb6d1b91.zip |
[compat] Add compat_casefold and compat_re_Match, for traverse_obj() port
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r-- | youtube_dl/compat.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py index eca6d63de..4b5e1f6ed 100644 --- a/youtube_dl/compat.py +++ b/youtube_dl/compat.py @@ -2375,8 +2375,10 @@ except ImportError: 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 @@ -3066,6 +3068,9 @@ except ImportError: # 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): @@ -3101,6 +3106,7 @@ __all__ = [ 'compat_Struct', 'compat_b64decode', 'compat_basestring', + 'compat_casefold', 'compat_chr', 'compat_collections_abc', 'compat_collections_chain_map', @@ -3132,6 +3138,7 @@ __all__ = [ 'compat_os_name', 'compat_parse_qs', 'compat_print', + 'compat_re_Match', 'compat_re_Pattern', 'compat_realpath', 'compat_setenv', |