misc cleanup

pull/11305/head
coletdjnz 3 weeks ago
parent fff5e7b708
commit 0210836dda
No known key found for this signature in database
GPG Key ID: 91984263BB39894A

@ -177,8 +177,6 @@ from .version import CHANNEL, ORIGIN, RELEASE_GIT_HEAD, VARIANT, __version__
if os.name == 'nt': if os.name == 'nt':
import ctypes import ctypes
__all__ = ['YoutubeDL']
def _catch_unsafe_extension_error(func): def _catch_unsafe_extension_error(func):
@functools.wraps(func) @functools.wraps(func)

@ -1,5 +1,7 @@
from collections import defaultdict from collections import defaultdict
# Internal only - no backwards compatibility guaranteed
class Indirect: class Indirect:
def __init__(self, initial, /): def __init__(self, initial, /):
@ -9,23 +11,17 @@ class Indirect:
return f'{type(self).__name__}({self.value!r})' return f'{type(self).__name__}({self.value!r})'
# Internal only - no backwards compatibility guaranteed
postprocessors = Indirect({}) postprocessors = Indirect({})
extractors = Indirect({}) extractors = Indirect({})
IN_CLI = Indirect(False) IN_CLI = Indirect(False)
# `False`=force, `None`=disabled, `True`=enabled # `False`=force, `None`=disabled, `True`=enabled
LAZY_EXTRACTORS = Indirect(False) LAZY_EXTRACTORS = Indirect(False)
# Plugins # Plugins
plugin_specs = Indirect({}) plugin_specs = Indirect({})
# Whether plugins have been loaded once
all_plugins_loaded = Indirect(False) all_plugins_loaded = Indirect(False)
plugins_enabled = Indirect(True) plugins_enabled = Indirect(True)
plugin_dirs = Indirect(['external']) plugin_dirs = Indirect(['external'])
plugin_ies = Indirect({}) plugin_ies = Indirect({})
plugin_overrides = Indirect(defaultdict(list)) plugin_overrides = Indirect(defaultdict(list))

@ -51,6 +51,7 @@ from ..compat import (
compat_HTMLParseError, compat_HTMLParseError,
) )
from ..dependencies import xattr 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 __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 # TODO: Use global logger
def deprecation_warning(msg, *, printer=None, stacklevel=0, **kwargs): def deprecation_warning(msg, *, printer=None, stacklevel=0, **kwargs):
from .._globals import IN_CLI as _IN_CLI
if _IN_CLI.value: if _IN_CLI.value:
if msg in deprecation_warning._cache: if msg in deprecation_warning._cache:
return return

Loading…
Cancel
Save