Support integer indexing into lists

This commit is contained in:
Olivier 'reivilibre' 2021-01-13 15:01:16 +00:00
parent 3d142e8cca
commit 86e893d7ba

View File

@ -113,9 +113,13 @@ class Variables:
keys = name.split(".")
try:
for k in keys:
if not isinstance(current, dict):
raise ValueError(f"non-dictionary encountered when getting {name}")
current = current[k]
if isinstance(current, dict):
current = current[k]
elif isinstance(current, list):
current = current[int(k)]
else:
raise ValueError(f"non-dictionary, non-list encountered when getting {name}")
return current
except KeyError:
if self._delegate: