[utils] Fix LazyList for Falsey values

This commit is contained in:
pukkandan 2021-07-20 23:16:38 +05:30
parent da503b7a52
commit 6586bca9b9
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
1 changed files with 2 additions and 2 deletions

View File

@ -6287,8 +6287,8 @@ def traverse_obj(
if val is not None:
if depth:
for _ in range(depth - 1):
val = itertools.chain.from_iterable(filter(None, val))
val = (list(filter(None, val)) if expected_type is None
val = itertools.chain.from_iterable(v for v in val if v is not None)
val = ([v for v in val if v is not None] if expected_type is None
else [v for v in val if isinstance(v, expected_type)])
if val:
return val