コード例 #1
0
ファイル: inspection.py プロジェクト: opesci/devito
def count(exprs, query):
    """
    Return a mapper ``{(k, v)}`` where ``k`` is a sub-expression in ``exprs``
    matching ``query`` and ``v`` is the number of its occurrences.
    """
    mapper = Counter()
    for expr in exprs:
        mapper.update(Counter(search(expr, query, 'all', 'bfs')))
    return dict(mapper)
コード例 #2
0
ファイル: inspection.py プロジェクト: acse-zg120/devito
def count(exprs, query):
    """
    Return a mapper ``{(k, v)}`` where ``k`` is a sub-expression in ``exprs``
    matching ``query`` and ``v`` is the number of its occurrences.
    """
    mapper = Counter()
    for expr in exprs:
        mapper.update(Counter(search(expr, query, 'all', 'bfs')))
    return dict(mapper)
コード例 #3
0
ファイル: inspection.py プロジェクト: nw0/devito
def count(exprs, query):
    """
    Return a mapper ``{(k, v)}`` where ``k`` is a sub-expression in ``exprs``
    matching ``query`` and ``v`` is the number of its occurrences.
    """
    mapper = OrderedDict()
    for expr in exprs:
        found = search(expr, query, 'all', 'bfs')
        for i in found:
            mapper.setdefault(i, 0)
            mapper[i] += 1
    return mapper