#NEWLINE# def _build_tree( self , leftover_factory_names , all_dependent_factories ) : #NEWLINE# #INDENT# unplaced_fields = set ( [ ] ) #NEWLINE# for factory_name in leftover_factory_names : #NEWLINE# #INDENT# needed_factories = set ( leftover_factory_names [ factory_name ] . depending_field_names ) #NEWLINE# for generation in sorted ( self . _tree . keys ( ) ) : #NEWLINE# #INDENT# needed_factories -= set ( self . _tree [ generation ] . keys ( ) ) #NEWLINE# if ( not needed_factories ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if needed_factories : #NEWLINE# #INDENT# unplaced_fields . add ( factory_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _tree [ ( generation + 1 ) ] [ factory_name ] = all_dependent_factories [ factory_name ] #NEWLINE# #UNINDENT# #UNINDENT# return unplaced_fields