From 0210836dda9f453b8efd82588e8f69fcc4673f28 Mon Sep 17 00:00:00 2001 From: coletdjnz Date: Sun, 8 Dec 2024 13:45:21 +1300 Subject: [PATCH] misc cleanup --- yt_dlp/YoutubeDL.py | 2 -- yt_dlp/_globals.py | 10 +++------- yt_dlp/utils/_utils.py | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 666bd9ba2..6fa1051aa 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -177,8 +177,6 @@ from .version import CHANNEL, ORIGIN, RELEASE_GIT_HEAD, VARIANT, __version__ if os.name == 'nt': import ctypes -__all__ = ['YoutubeDL'] - def _catch_unsafe_extension_error(func): @functools.wraps(func) diff --git a/yt_dlp/_globals.py b/yt_dlp/_globals.py index 9af748a14..45e555b0f 100644 --- a/yt_dlp/_globals.py +++ b/yt_dlp/_globals.py @@ -1,5 +1,7 @@ from collections import defaultdict +# Internal only - no backwards compatibility guaranteed + class Indirect: def __init__(self, initial, /): @@ -9,23 +11,17 @@ class Indirect: return f'{type(self).__name__}({self.value!r})' -# Internal only - no backwards compatibility guaranteed postprocessors = Indirect({}) extractors = Indirect({}) + IN_CLI = Indirect(False) # `False`=force, `None`=disabled, `True`=enabled LAZY_EXTRACTORS = Indirect(False) - # Plugins - plugin_specs = Indirect({}) - -# Whether plugins have been loaded once all_plugins_loaded = Indirect(False) - plugins_enabled = Indirect(True) - plugin_dirs = Indirect(['external']) plugin_ies = Indirect({}) plugin_overrides = Indirect(defaultdict(list)) diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py index 35f52f936..6ab67f00a 100644 --- a/yt_dlp/utils/_utils.py +++ b/yt_dlp/utils/_utils.py @@ -51,6 +51,7 @@ from ..compat import ( compat_HTMLParseError, ) from ..dependencies import xattr +from .._globals import IN_CLI as _IN_CLI __name__ = __name__.rsplit('.', 1)[0] # noqa: A001: Pretend to be the parent module @@ -1483,7 +1484,6 @@ def write_string(s, out=None, encoding=None): # TODO: Use global logger def deprecation_warning(msg, *, printer=None, stacklevel=0, **kwargs): - from .._globals import IN_CLI as _IN_CLI if _IN_CLI.value: if msg in deprecation_warning._cache: return