parameters: (self, tasks)
return_statement: return (ready, waiting)
docstring: Label input tasks with priority values, and return a pair containing
  		the tasks that are ready to run and the tasks that are necessarily
  		waiting for other tasks to complete.
  
  		The priority system is really meant as an optional layer for optimization:
  		dependency cycles are found quickly, and builds should be more efficient.
  		A high priority number means that a task is processed first.
  
  		This method can be overridden to disable the priority system::
  
  			def prio_and_split(self, tasks):
  				return tasks, []
  
  		:return: A pair of task lists
  		:rtype: tuple
docstring_summary: Label input tasks with priority values, and return a pair containing
  		the tasks that are ready to run and the tasks that are necessarily
  		waiting for other tasks to complete.
docstring_tokens: Label input tasks with priority values and return a pair containing the tasks that are ready to run and the tasks that are necessarily waiting for other tasks to complete .
function: def prio_and_split(self, tasks):
  		"""
  		Label input tasks with priority values, and return a pair containing
  		the tasks that are ready to run and the tasks that are necessarily
  		waiting for other tasks to complete.
  
  		The priority system is really meant as an optional layer for optimization:
  		dependency cycles are found quickly, and builds should be more efficient.
  		A high priority number means that a task is processed first.
  
  		This method can be overridden to disable the priority system::
  
  			def prio_and_split(self, tasks):
  				return tasks, []
  
  		:return: A pair of task lists
  		:rtype: tuple
  		"""
  		# to disable:
  		#return tasks, []
  		for x in tasks:
  			x.visited = 0
  
  		reverse = self.revdeps
  
  		groups_done = set()
  		for x in tasks:
  			for k in x.run_after:
  				if isinstance(k, Task.TaskGroup):
  					if k not in groups_done:
  						groups_done.add(k)
  						for j in k.prev:
  							reverse[j].add(k)
  				else:
  					reverse[k].add(x)
  
  		# the priority number is not the tree depth
  		def visit(n):
  			if isinstance(n, Task.TaskGroup):
  				return sum(visit(k) for k in n.next)
  
  			if n.visited == 0:
  				n.visited = 1
  
  				if n in reverse:
  					rev = reverse[n]
  					n.prio_order = n.tree_weight + len(rev) + sum(visit(k) for k in rev)
  				else:
  					n.prio_order = n.tree_weight
  
  				n.visited = 2
  			elif n.visited == 1:
  				raise Errors.WafError('Dependency cycle found!')
  			return n.prio_order
  
  		for x in tasks:
  			if x.visited != 0:
  				# must visit all to detect cycles
  				continue
  			try:
  				visit(x)
  			except Errors.WafError:
  				self.debug_cycles(tasks, reverse)
  
  		ready = []
  		waiting = []
  		for x in tasks:
  			for k in x.run_after:
  				if not k.hasrun:
  					waiting.append(x)
  					break
  			else:
  				ready.append(x)
  		return (ready, waiting)
function_tokens: def prio_and_split ( self , tasks ) : # to disable: #return tasks, [] for x in tasks : x . visited = 0 reverse = self . revdeps groups_done = set ( ) for x in tasks : for k in x . run_after : if isinstance ( k , Task . TaskGroup ) : if k not in groups_done : groups_done . add ( k ) for j in k . prev : reverse [ j ] . add ( k ) else : reverse [ k ] . add ( x ) # the priority number is not the tree depth def visit ( n ) : if isinstance ( n , Task . TaskGroup ) : return sum ( visit ( k ) for k in n . next ) if n . visited == 0 : n . visited = 1 if n in reverse : rev = reverse [ n ] n . prio_order = n . tree_weight + len ( rev ) + sum ( visit ( k ) for k in rev ) else : n . prio_order = n . tree_weight n . visited = 2 elif n . visited == 1 : raise Errors . WafError ( 'Dependency cycle found!' ) return n . prio_order for x in tasks : if x . visited != 0 : # must visit all to detect cycles continue try : visit ( x ) except Errors . WafError : self . debug_cycles ( tasks , reverse ) ready = [ ] waiting = [ ] for x in tasks : for k in x . run_after : if not k . hasrun : waiting . append ( x ) break else : ready . append ( x ) return ( ready , waiting )