mirror of https://gerrit.osmocom.org/pysim
utils: Make filter_dict() transparently pass non-dict
Change-Id: Ia1802101a62e21f1ce894d80728f939bf3da5a39
This commit is contained in:
parent
f0885b1042
commit
7fca85b42c
|
@ -72,6 +72,8 @@ class GsmStringAdapter(Adapter):
|
||||||
|
|
||||||
def filter_dict(d, exclude_prefix='_'):
|
def filter_dict(d, exclude_prefix='_'):
|
||||||
"""filter the input dict to ensure no keys starting with 'exclude_prefix' remain."""
|
"""filter the input dict to ensure no keys starting with 'exclude_prefix' remain."""
|
||||||
|
if not isinstance(d, dict):
|
||||||
|
return d
|
||||||
res = {}
|
res = {}
|
||||||
for (key, value) in d.items():
|
for (key, value) in d.items():
|
||||||
if key.startswith(exclude_prefix):
|
if key.startswith(exclude_prefix):
|
||||||
|
|
Loading…
Reference in New Issue