diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-02-07 03:22:29 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2023-02-08 07:28:46 +0530 |
commit | f6a765ceb59c55aea06921880c1c87d1ff36e5de (patch) | |
tree | 4120a1128be7c3ec48f0d81f6832fe55e25cff5b /yt_dlp/compat/compat_utils.py | |
parent | 754c84e2e416cf6609dd0e4632b4985a08d34043 (diff) | |
download | hypervideo-pre-f6a765ceb59c55aea06921880c1c87d1ff36e5de.tar.lz hypervideo-pre-f6a765ceb59c55aea06921880c1c87d1ff36e5de.tar.xz hypervideo-pre-f6a765ceb59c55aea06921880c1c87d1ff36e5de.zip |
[dependencies] Standardize `Cryptodome` imports
Diffstat (limited to 'yt_dlp/compat/compat_utils.py')
-rw-r--r-- | yt_dlp/compat/compat_utils.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/yt_dlp/compat/compat_utils.py b/yt_dlp/compat/compat_utils.py index b67944e6b..373389a46 100644 --- a/yt_dlp/compat/compat_utils.py +++ b/yt_dlp/compat/compat_utils.py @@ -10,16 +10,12 @@ _Package = collections.namedtuple('Package', ('name', 'version')) def get_package_info(module): - parent = module.__name__.split('.')[0] - parent_module = None - with contextlib.suppress(ImportError): - parent_module = importlib.import_module(parent) - - for attr in ('__version__', 'version_string', 'version'): - version = getattr(parent_module, attr, None) - if version is not None: - break - return _Package(getattr(module, '_yt_dlp__identifier', parent), str(version)) + return _Package( + name=getattr(module, '_yt_dlp__identifier', module.__name__), + version=str(next(filter(None, ( + getattr(module, attr, None) + for attr in ('__version__', 'version_string', 'version') + )), None))) def _is_package(module): |