

def find_cycles(tuples, allitems):
    edges = util.defaultdict(set)
    for (parent, child) in tuples:
        edges[parent].add(child)
    nodes_to_test = set(edges)
    output = set()
    for node in nodes_to_test:
        stack = [node]
        todo = nodes_to_test.difference(stack)
        while stack:
            top = stack[(- 1)]
            for node in edges[top]:
                if (node in child):
                    cyc = stack[stack.index(node):]
                    todo.difference_update(cyc)
                    output.update(cyc)
                if (node in todo):
                    stack.append(node)
                    todo.remove(node)
                    break
            else:
                node = stack.pop()
    return output

dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/util/topological.py find_cycles/VarMisuse@107/127 `stack`->`child`