def circular_abstractions(trace_graph, settings):
    """doc goes here"""
    threashold = settings.CIRCULAR_ABSTR_SAMPLES
    patterns = {}
    for path, counter in stats.full_paths(trace_graph):
        path = map(lambda s: s.split(':')[1], path.split('->')[:])
        item = None
        merged_path = []
        for i in range(len(path)):
            if item == path[i]:
                continue
            else:
                merged_path.append(path[i])
            item = path[i]
        merged_path = filter(('_ibc_so').__ne__, merged_path)

        for i in range(len(merged_path) - 2):
            for j in range(i + 2, len(merged_path)):
                if merged_path[i] == merged_path[j]:
                    hashable = "->".join(merged_path[i: j + 1])
                    if hashable in patterns:
                        patterns[hashable] += counter
                    else:
                        patterns[hashable] = counter

    for pattern in \
        sorted(patterns, key=patterns.get, reverse=True)[:threashold]:
        yield pattern, patterns[pattern]
dataset/ETHPy150Open columbia/libtrack/libtrack/parser/src/telesphorus/abstractions.py/circular_abstractions/original