utils: Make filter_dict() transparently pass non-dict

Change-Id: Ia1802101a62e21f1ce894d80728f939bf3da5a39
This commit is contained in:
Harald Welte 2021-05-29 21:27:46 +02:00
parent f0885b1042
commit 7fca85b42c
1 changed files with 2 additions and 0 deletions

View File

@ -72,6 +72,8 @@ class GsmStringAdapter(Adapter):
def filter_dict(d, exclude_prefix='_'):
"""filter the input dict to ensure no keys starting with 'exclude_prefix' remain."""
if not isinstance(d, dict):
return d
res = {}
for (key, value) in d.items():
if key.startswith(exclude_prefix):