Support integer indexing into lists
This commit is contained in:
parent
3d142e8cca
commit
86e893d7ba
@ -113,9 +113,13 @@ class Variables:
|
|||||||
keys = name.split(".")
|
keys = name.split(".")
|
||||||
try:
|
try:
|
||||||
for k in keys:
|
for k in keys:
|
||||||
if not isinstance(current, dict):
|
if isinstance(current, dict):
|
||||||
raise ValueError(f"non-dictionary encountered when getting {name}")
|
current = current[k]
|
||||||
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
|
return current
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if self._delegate:
|
if self._delegate:
|
||||||
|
Loading…
Reference in New Issue
Block a user