(self, modules, neighbour_id_fn)
return False
Detect dependency cycles given modules and the neighbour_id_fn

        :param modules: A mapping of module unique_ids to Module objects
        :neighbour_id_fn: function to get the neibour module unique_id
        :return: True if there is a cycle in the module relationship graph
Detect dependency cycles given modules and the neighbour_id_fn
Detect dependency cycles given modules and the neighbour_id_fn
def _has_dependency_cycle(self, modules, neighbour_id_fn):
        """
        Detect dependency cycles given modules and the neighbour_id_fn

        :param modules: A mapping of module unique_ids to Module objects
        :neighbour_id_fn: function to get the neibour module unique_id
        :return: True if there is a cycle in the module relationship graph
        """
        visited = set()
        completed = set()

        def cycle_helper(m):
            if m.id in visited:
                if m.id in completed:
                    return False
                return True
            visited.add(m.id)
            parent = modules.get(neighbour_id_fn(m), None)
            if parent is not None and cycle_helper(parent):
                return True
            completed.add(m.id)
            return False
        for module in modules.values():
            if cycle_helper(module):
                return True
        return False
def _has_dependency_cycle ( self , modules , neighbour_id_fn ) : visited = set ( ) completed = set ( ) def cycle_helper ( m ) : if m . id in visited : if m . id in completed : return False return True visited . add ( m . id ) parent = modules . get ( neighbour_id_fn ( m ) , None ) if parent is not None and cycle_helper ( parent ) : return True completed . add ( m . id ) return False for module in modules . values ( ) : if cycle_helper ( module ) : return True return False