Skip to content
Snippets Groups Projects
Commit 28de4c44 authored by Kaushik Kulkarni's avatar Kaushik Kulkarni
Browse files

force identifier in tree to be of type `Tuple[Union[str, int]]`

parent 67aa662b
Branches
No related tags found
No related merge requests found
......@@ -271,8 +271,17 @@ def _keyed_map_array_container_impl(
if type(_ary) is leaf_cls: # type(ary) is never None
return f(keys, _ary)
elif is_array_container(_ary):
def _tuple_if_not_tuple(x):
if not isinstance(x, tuple):
assert isinstance(x, (str, int))
return x,
else:
assert all(isinstance(el, (str, int))
for el in x)
return x
return deserialize_container(_ary, [
(key, frec(keys+(key,), subary))
(key, frec(keys+_tuple_if_not_tuple(key), subary))
for key, subary in serialize_container(_ary)
])
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment