is_remote_list check
use is_remote_list() to verify that a list needs to be converted for use in mycroft.
@@ -45,6 +45,17 @@ def merge_dict(base, delta):
base[k] = dv
+def is_remote_list(values):
+ ''' check if this list corresponds to a backend formatted collection of
+ dictionaries '''
+ for v in values:
+ if not isinstance(v, dict):
+ return False
+ if "@type" not in v.keys():
+ return False
+ return True
+
+
def translate_remote(config, setting):
"""
Translate config names from server to equivalents usable
@@ -65,11 +76,14 @@ def translate_remote(config, setting):
config[key] = config.get(key, {})
translate_remote(config[key], v)
elif isinstance(v, list):
+ if is_remote_list(v):
if key not in config:
config[key] = {}
translate_list(config[key], v)
else:
config[key] = v
+ else:
+ config[key] = v
def translate_list(config, values):
