5461fe7792ce43c3a7009a602c086842fe9fae64,tools/nni_annotation/search_space_generator.py,SearchSpaceGenerator,visit_Call,#SearchSpaceGenerator#Any#,51

Before Change


        if func in ("choice", "function_choice"):
            // arguments of `choice` may contain complex expression,
            // so use indices instead of arguments
            args = list(range(len(node.args)))
        else:
            // arguments of other functions must be literal number
            assert all(type(arg) is ast.Num for arg in node.args), "Smart parameter\"s arguments must be number literals"
            args = [arg.n for arg in node.args]

After Change


            // we will use keys in the dict as the choices, which is generated by code_generator according to the args given by user
            assert len(node.args) == 1, "Smart parameter has arguments other than dict"
            // check if it is a number or a string and get its value accordingly
            args = [key.n if type(key) is ast.Num else key.s for key in node.args[0].keys]
        else:
            // arguments of other functions must be literal number
            assert all(type(arg) is ast.Num for arg in node.args), "Smart parameter\"s arguments must be number literals"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: Microsoft/nni
Commit Name: 5461fe7792ce43c3a7009a602c086842fe9fae64
Time: 2018-12-20
Author: 871886504@qq.com
File Name: tools/nni_annotation/search_space_generator.py
Class Name: SearchSpaceGenerator
Method Name: visit_Call


Project Name: biolab/orange3
Commit Name: 8bccce2a53e553c0d033be7820e5a69902b26c3d
Time: 2017-01-20
Author: marko.toplak@gmail.com
File Name: Orange/widgets/utils/domaineditor.py
Class Name: DomainEditor
Method Name: get_domain


Project Name: biolab/orange3
Commit Name: e21353e209a2d00c004e4f3b61b112dcffb4df6e
Time: 2017-02-03
Author: anze.staric@gmail.com
File Name: Orange/widgets/utils/domaineditor.py
Class Name: DomainEditor
Method Name: get_domain