def recurse(k, v, parent='World'): if isinstance(v, collections.Mapping): for _parent, _data in v.items(): for _k, _v in _data.items(): recurse(_k, _v, parent=_parent) level = k children = [v] if isscalar(v) else v for child in children: hierarchy.append([level, child, parent]) nodes.append(child) levels.append(level)
def test_isscalar(): with pytest.warns(DeprecationWarning): assert False is utils.isscalar([3, 4])