diff --git a/base/tasklist.py b/base/tasklist.py index 0ffbf51..b16dffc 100644 --- a/base/tasklist.py +++ b/base/tasklist.py @@ -38,11 +38,12 @@ class TaskList(object): from common.phases import order graph = {} for task in tasks: - graph[task] = [] - graph[task].extend([self.get(succ) for succ in task.before]) - graph[task].extend([succ for succ in tasks if type(task) in succ.after]) + successors = [] + successors.extend([self.get(succ) for succ in task.before]) + successors.extend(filter(lambda succ: type(task) in succ.after, tasks)) succeeding_phases = order[order.index(task.phase)+1:] - graph[task].extend([succ for succ in tasks if succ.phase in succeeding_phases]) + successors.extend(filter(lambda succ: succ.phase in succeeding_phases, tasks)) + graph[task] = filter(lambda succ: succ in self.tasks, successors) components = self.strongly_connected_components(graph) cycles_found = 0