mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Remove six.moves: collections_abc
This commit is contained in:
parent
76ac99fc61
commit
d96a907eab
1 changed files with 7 additions and 7 deletions
|
@ -1,14 +1,14 @@
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from collections.abc import Iterable, Mapping, MutableMapping
|
||||||
|
|
||||||
from six import string_types
|
from six import string_types
|
||||||
from six.moves import collections_abc
|
|
||||||
|
|
||||||
|
|
||||||
def clean_none_dict_values(obj):
|
def clean_none_dict_values(obj):
|
||||||
"""
|
"""
|
||||||
Recursively remove keys with a value of None
|
Recursively remove keys with a value of None
|
||||||
"""
|
"""
|
||||||
if not isinstance(obj, collections_abc.Iterable) or isinstance(obj, string_types):
|
if not isinstance(obj, Iterable) or isinstance(obj, string_types):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
queue = [obj]
|
queue = [obj]
|
||||||
|
@ -16,8 +16,8 @@ def clean_none_dict_values(obj):
|
||||||
while queue:
|
while queue:
|
||||||
item = queue.pop()
|
item = queue.pop()
|
||||||
|
|
||||||
if isinstance(item, collections_abc.Mapping):
|
if isinstance(item, Mapping):
|
||||||
mutable = isinstance(item, collections_abc.MutableMapping)
|
mutable = isinstance(item, MutableMapping)
|
||||||
remove = []
|
remove = []
|
||||||
|
|
||||||
for key, value in item.items():
|
for key, value in item.items():
|
||||||
|
@ -27,7 +27,7 @@ def clean_none_dict_values(obj):
|
||||||
elif isinstance(value, string_types):
|
elif isinstance(value, string_types):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif isinstance(value, collections_abc.Iterable):
|
elif isinstance(value, Iterable):
|
||||||
queue.append(value)
|
queue.append(value)
|
||||||
|
|
||||||
if mutable:
|
if mutable:
|
||||||
|
@ -35,11 +35,11 @@ def clean_none_dict_values(obj):
|
||||||
for key in remove:
|
for key in remove:
|
||||||
item.pop(key)
|
item.pop(key)
|
||||||
|
|
||||||
elif isinstance(item, collections_abc.Iterable):
|
elif isinstance(item, Iterable):
|
||||||
for value in item:
|
for value in item:
|
||||||
if value is None or isinstance(value, string_types):
|
if value is None or isinstance(value, string_types):
|
||||||
continue
|
continue
|
||||||
elif isinstance(value, collections_abc.Iterable):
|
elif isinstance(value, Iterable):
|
||||||
queue.append(value)
|
queue.append(value)
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
Loading…
Reference in a new issue