diff --git a/pyproject.toml b/pyproject.toml index 623121d766..04817d55bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -321,6 +321,7 @@ banned-from = [ "yt_dlp.compat.compat_os_name".msg = "Use `os.name` instead." "yt_dlp.compat.compat_realpath".msg = "Use `os.path.realpath` instead." "yt_dlp.utils.decodeOption".msg = "Do not use" +"yt_dlp.utils.compiled_regex_type".msg = "Use `re.Pattern` instead." [tool.autopep8] max_line_length = 120 diff --git a/yt_dlp/utils/_deprecated.py b/yt_dlp/utils/_deprecated.py index 85649a534f..e4762699b7 100644 --- a/yt_dlp/utils/_deprecated.py +++ b/yt_dlp/utils/_deprecated.py @@ -9,6 +9,7 @@ passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn( del passthrough_module +import re import struct @@ -25,3 +26,6 @@ def intlist_to_bytes(xs): if not xs: return b'' return struct.pack('%dB' % len(xs), *xs) + + +compiled_regex_type = type(re.compile('')) diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py index 7fd0ed2a40..c5396789f7 100644 --- a/yt_dlp/utils/_utils.py +++ b/yt_dlp/utils/_utils.py @@ -54,9 +54,6 @@ from ..dependencies import xattr __name__ = __name__.rsplit('.', 1)[0] # noqa: A001: Pretend to be the parent module -# This is not clearly defined otherwise -compiled_regex_type = type(re.compile('')) - class NO_DEFAULT: pass