835119003443fb9a08065db6bc4d33a27b2fab31,src/BayesianModel/BayesianModel.py,BayesianModel,__init__,#BayesianModel#Any#,31

Before Change


    def __init__(self, ebunch=None):
        // TODO: Add checks for self loops
        if not ebunch is None and not \
                all(isinstance(elem, str) for elem in itertools.chain(*ebunch)):
            raise TypeError("Name of nodes must be strings")

        nx.DiGraph.__init__(self, ebunch)

After Change


    
    def __init__(self, ebunch=None):
        if ebunch is not None:
            for edge in ebunch:
                if not (isinstance(edge[0], str) and isinstance(edge[1], str)):
                    raise TypeError("Name of nodes must be strings")
                if edge[0] == edge[1]:
                    raise Exceptions.SelfLoopError("Self Loops are not allowed", edge)

        nx.DiGraph.__init__(self, ebunch)

        if not ebunch is None:
            self._update_node_parents(set(itertools.chain(*ebunch)))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pgmpy/pgmpy
Commit Name: 835119003443fb9a08065db6bc4d33a27b2fab31
Time: 2013-12-29
Author: ankurankan@gmail.com
File Name: src/BayesianModel/BayesianModel.py
Class Name: BayesianModel
Method Name: __init__


Project Name: pgmpy/pgmpy
Commit Name: 835119003443fb9a08065db6bc4d33a27b2fab31
Time: 2013-12-29
Author: ankurankan@gmail.com
File Name: src/BayesianModel/BayesianModel.py
Class Name: BayesianModel
Method Name: add_edges_from


Project Name: ray-project/ray
Commit Name: 87557a00fa23ee7b3ecc7014de00e5c311e79758
Time: 2020-04-27
Author: rliaw@berkeley.edu
File Name: python/ray/tune/suggest/repeater.py
Class Name: Repeater
Method Name: add_configurations