b19e3080dba989e2e7e08c74877f8396790f83d2,elfi/graph.py,Node,remove_parent,#Node#Any#,127

Before Change


        
        index = parent_or_index
        if isinstance(index, Node):
            for i, p in enumerate(self.parents):
                if p == parent_or_index:
                    index = i
                    break
        if isinstance(index, Node):
            // TODO: add more informative error message (the __str__ in the future?)
            raise Exception("Could not find a parent")
        parent = self.parents[index]

After Change


        parent_or_index : Node or int
        
        if isinstance(parent_or_index, Node):
            try:
                index = self.parents.index(parent_or_index)
            except ValueError:
                raise Exception("Could not find a parent {}".format(parent_or_index))
        else:
            index = parent_or_index
        parent = self.parents[index]
        del self.parents[index]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: elfi-dev/elfi
Commit Name: b19e3080dba989e2e7e08c74877f8396790f83d2
Time: 2016-12-05
Author: jarno.lintusaari@aalto.fi
File Name: elfi/graph.py
Class Name: Node
Method Name: remove_parent


Project Name: analysiscenter/batchflow
Commit Name: c472f856ac60d0fff63b90642d912d7e0db1c7dd
Time: 2017-11-16
Author: rhudor@gmail.com
File Name: dataset/models/base.py
Class Name: BaseModel
Method Name: get_from_config


Project Name: pantsbuild/pants
Commit Name: 8479b6a979a0433c9b360c340fca454f03b0ff77
Time: 2016-04-07
Author: nhoward@twopensource.com
File Name: contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/checker.py
Class Name: PythonCheckStyleTask
Method Name: get_nits