def PQDescPath(coll, f, lcs): f = eval(f, globals(), lcs) if f != '_' else None stack = [] if isList(coll): stack = [i for i in flatten(coll)] elif isMap(coll): stack = [map_tuple(k, v) for (k, v) in coll.items()] while stack: i = stack.pop() if isinstance(i, map_tuple): if f is None: yield i.value elif f and i.key == f: yield i.value i = i.value if isList(i): it = iter(i) frst = next(it) [stack.append(j) for j in it] if isList(frst): stack.extend([ci for ci in frst]) elif isMap(frst): stack.extend([map_tuple(k, v) for (k, v) in frst.items()]) elif isMap(i): keys = list(i.keys()) [stack.append(map_tuple(j, i[j])) for j in keys]
def PQDescPath(coll,f,lcs): f = eval(f,globals(),lcs) if f!='_' else None stack = [] if isList(coll): stack = [i for i in flatten(coll)] elif isMap(coll): stack = [map_tuple(k,v) for (k,v) in coll.items()] while stack: i = stack.pop() if isinstance(i,map_tuple): if f is None: yield i.value elif f and i.key==f: yield i.value i = i.value if isList(i): it = iter(i) frst = next(it) [stack.append(j) for j in it] if isList(frst): stack.extend([ci for ci in frst]) elif isMap(frst): stack.extend([map_tuple(k,v) for (k,v) in frst.items()]) elif isMap(i): keys = list(i.keys()) [stack.append(map_tuple(j,i[j])) for j in keys]
def PQChildPath(coll, f, lcs): f = eval(str_dec(f), globals(), lcs) if f != '_' else None if isList(coll): for i in flatten(coll): if isMap(i): for j in i.keys(): if f is None: yield i[j] elif f and j == f: yield i[j] if isMap(coll): for i in coll.keys(): if f is None: yield coll[i] elif f and i == f: yield coll[i]
def PQChildPath (coll,f,lcs): f = eval(str_dec(f), globals(), lcs) if f!='_' else None if isList(coll): for i in flatten(coll): if isMap(i): for j in i.keys(): if f is None: yield i[j] elif f and j==f: yield i[j] if isMap(coll): for i in coll.keys(): if f is None: yield coll[i] elif f and i==f: yield coll[i]