b7366b685afdde156e551f8ba5008857f789e368,tools/nni_annotation/code_generator.py,,test_variable_equal,#Any#Any#,129

Before Change


    Test whether two variables are the same.
    if type(var1) is not type(var2):
        return False
    if type(var1) is ast.Name:
        return var1.id == var2.id
    if type(var1) is ast.Attribute:
        return var1.attr == var2.attr and test_variable_equal(var1.value, var2.value)

After Change


    if type(node1) is not type(node2):
        return False
    if isinstance(node1, ast.AST):
        for k, v in vars(node1).items():
            if k in ("lineno", "col_offset", "ctx"):
                continue
            if not test_variable_equal(v, getattr(node2, k)):
                return False
        return True
    if isinstance(node1, list):
        if len(node1) != len(node2):
            return False
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: microsoft/nni
Commit Name: b7366b685afdde156e551f8ba5008857f789e368
Time: 2019-02-11
Author: 871886504@qq.com
File Name: tools/nni_annotation/code_generator.py
Class Name:
Method Name: test_variable_equal


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: b0728e31f312bc703ab227b6ff69f0a92b3dba07
Time: 2018-05-17
Author: igor.a.gitman@gmail.com
File Name: open_seq2seq/utils/utils.py
Class Name:
Method Name: cast_types


Project Name: NervanaSystems/nlp-architect
Commit Name: 94b405357109c443277e568009045798a38d5842
Time: 2018-05-08
Author: daniel.korat@intel.com
File Name: nlp_architect/pipelines/spacy_bist/parser.py
Class Name: SpacyBISTParser
Method Name: parse