mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-09 10:50:38 +00:00
Fix deprecation warning?!? lol
This commit is contained in:
parent
96f9bbf392
commit
fe274adf41
@ -1,7 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
|
||||||
from collections.abc import MutableMapping
|
from collections.abc import MutableMapping
|
||||||
|
|
||||||
from ..utils import try_call
|
from ..utils import try_call
|
||||||
@ -112,15 +111,18 @@ def lazy_ie(klass: type[InfoExtractor] | None = None, /):
|
|||||||
_old_extract = _default_lazy_extract
|
_old_extract = _default_lazy_extract
|
||||||
|
|
||||||
lazy_members = {}
|
lazy_members = {}
|
||||||
for _, member in inspect.getmembers(klass):
|
for name in dir(klass):
|
||||||
fields = getattr(member, lazy_fields._field_name, None)
|
if not name.startswith("_"):
|
||||||
|
continue
|
||||||
|
func = getattr(klass, name)
|
||||||
|
fields = getattr(func, lazy_fields._field_name, None)
|
||||||
if not isinstance(fields, tuple):
|
if not isinstance(fields, tuple):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for field in fields:
|
for field in fields:
|
||||||
lazy_members[field] = member
|
lazy_members[field] = func
|
||||||
|
|
||||||
@functools.wraps(_old_extract)
|
@functools.wraps(klass._real_extract)
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
result = _old_extract(self, url)
|
result = _old_extract(self, url)
|
||||||
assert isinstance(result, dict), 'Lazy extractors need to return a dict'
|
assert isinstance(result, dict), 'Lazy extractors need to return a dict'
|
||||||
|
Loading…
Reference in New Issue
Block a user