mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-14 08:28:29 +00:00
traverse_obj: allow traversal of dataclasses (for protobug)
This commit is contained in:
parent
bf366517ef
commit
a9df16db47
@ -3,6 +3,7 @@
|
|||||||
import collections
|
import collections
|
||||||
import collections.abc
|
import collections.abc
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import dataclasses
|
||||||
import functools
|
import functools
|
||||||
import http.cookies
|
import http.cookies
|
||||||
import inspect
|
import inspect
|
||||||
@ -233,6 +234,8 @@ def apply_specials(element):
|
|||||||
result = list(map(apply_specials, obj.iterfind(xpath)))
|
result = list(map(apply_specials, obj.iterfind(xpath)))
|
||||||
else:
|
else:
|
||||||
result = apply_specials(obj)
|
result = apply_specials(obj)
|
||||||
|
elif dataclasses.is_dataclass(obj):
|
||||||
|
result = getattr(obj, key)
|
||||||
|
|
||||||
return branching, result if branching else (result,)
|
return branching, result if branching else (result,)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user