1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-04 00:55:15 +00:00

[compat_utils] Improve passthrough_module

This commit is contained in:
pukkandan
2023-02-08 08:14:36 +05:30
parent f6a765ceb5
commit 88426d9446
3 changed files with 18 additions and 24 deletions

View File

@ -1,10 +1,6 @@
import importlib
from ..compat import functools
from ..compat.compat_utils import EnhancedModule, passthrough_module
EnhancedModule(__name__)
try:
import Cryptodome as _parent
except ImportError:
@ -14,14 +10,8 @@ except ImportError:
_parent = EnhancedModule('Cryptodome')
__bool__ = lambda: False
@functools.cache
def __getattr__(name):
try:
submodule = importlib.import_module(f'.{name}', _parent.__name__)
except ImportError:
return getattr(_parent, name)
return passthrough_module(f'{__name__}.{name}', submodule)
passthrough_module(__name__, _parent, (..., '__version__'))
del passthrough_module, EnhancedModule
@property