def __consolidate(node, results):
 node_data = node.to_dict()
 node_data_copy = {}
 for key in node_data:
  value = node_data[key]
  if (value != '<<inherit>>'):
   if isinstance(value, dict):
    node_data_copy[key] = value.copy()
   elif isinstance(value, list):
    node_data_copy[key] = value[:]
   else:
    node_data_copy[key] = value
 for field in node_data_copy:
  data_item = node_data_copy[field]
  if (field in results):
   fielddata = results[field]
   if isinstance(fielddata, dict):
    results[field].update(data_item.copy())
   elif (isinstance(fielddata, list) or isinstance(fielddata, tuple)):
    results[field].extend(data_item)
    results[field] = uniquify(results[field])
   elif (field != 'distro'):
    results[field] = data_item
  else:
   results[field] = data_item
 dict_removals(results, 'kernel_options')
 dict_removals(results, 'kernel_options_post')
 dict_removals(results, 'autoinstall_meta')
 dict_removals(results, 'template_files')
 dict_removals(results, 'boot_files')
 dict_removals(results, 'fetchable_files')

def __consolidate ( node , results ) : node_data = node . to_dict ( ) node_data_copy = { } for key in node_data : value = node_data [ key ] if ( value != '<<inherit>>' ) : if isinstance ( value , dict ) : node_data_copy [ key ] = value . copy ( ) elif isinstance ( value , list ) : node_data_copy [ key ] = value [ : ] else : node_data_copy [ key ] = value for field in node_data_copy : data_item = node_data_copy [ field ] if ( field in results ) : fielddata = results [ field ] if isinstance ( fielddata , dict ) : results [ field ] . update ( data_item . copy ( ) ) elif ( isinstance ( fielddata , list ) or isinstance ( fielddata , tuple ) ) : results [ field ] . extend ( data_item ) results [ field ] = uniquify ( results [ field ] ) elif ( field != 'distro' ) : results [ field ] = data_item else : results [ field ] = data_item dict_removals ( results , 'kernel_options' ) dict_removals ( results , 'kernel_options_post' ) dict_removals ( results , 'autoinstall_meta' ) dict_removals ( results , 'template_files' ) dict_removals ( results , 'boot_files' ) dict_removals ( results , 'fetchable_files' )
merge data from a given node with the aggregate of all data from past scanned nodes .