2db605d4a44e33306af74892eecbfef75a1d44d8,brian2/equations/equations.py,Equations,_sort_static_equations,#Equations#,685

Before Change


        // List that will contain the sorted elements
        sorted_eqs = []
        // set of all nodes with no incoming edges:
        no_incoming = set([var for var, deps in static_deps.iteritems()
                           if len(deps) == 0])

        while len(no_incoming):
            n = no_incoming.pop()
            sorted_eqs.append(n)
            // find variables m depending on n
            dependent = [m for m, deps in static_deps.iteritems()
                         if n in deps]
            for m in dependent:
                static_deps[m].remove(n)
                if len(static_deps[m]) == 0:
                    // no other dependencies
                    no_incoming.add(m)
        if any([len(deps) > 0 for deps in static_deps.itervalues()]):
            raise ValueError("Cannot resolve dependencies between static "
                             "equations, dependencies contain a cycle.")

After Change


                                           dep in self._equations and
                                           self._equations[dep].type == STATIC_EQUATION]
        
        try:
            sorted_eqs = topsort(static_deps)
        except ValueError:
            raise ValueError("Cannot resolve dependencies between static "
                             "equations, dependencies contain a cycle.")

        // put the equations objects in the correct order
        for order, static_variable in enumerate(sorted_eqs):
            self._equations[static_variable].update_order = order

        // Sort differential equations and parameters after static equations
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: brian-team/brian2
Commit Name: 2db605d4a44e33306af74892eecbfef75a1d44d8
Time: 2014-02-19
Author: dan.goodman@ens.fr
File Name: brian2/equations/equations.py
Class Name: Equations
Method Name: _sort_static_equations


Project Name: geekcomputers/Python
Commit Name: 791e09b24641b6d372ba08c59b6b801440c767b2
Time: 2019-08-14
Author: 35282147+Hong199@users.noreply.github.com
File Name: fileinfo.py
Class Name:
Method Name:


Project Name: prody/ProDy
Commit Name: 223584e2a0b97b006b6ac944253e2573963a7a88
Time: 2018-09-25
Author: jamesmkrieger@gmail.com
File Name: prody/proteins/starfile.py
Class Name:
Method Name: parseImagesFromSTAR