def build_conversion(option, opt, value, parser):
 try:
  with open(value, 'r') as input:
   data = pickle.load(input)
 except:
  raise ConfigurationException(('File Not Found %s' % value))
 with open((value + '.dump'), 'w') as output:
  for (dk, dv) in data.iteritems():
   output.write(('[ %s ]\n\n' % dk))
   if isinstance(dv.values, list):
    output.write('\n'.join([('[%d] = %d' % (vk, vv)) for (vk, vv) in enumerate(dv.values)]))
   elif isinstance(data[k].values, dict):
    output.write('\n'.join([('[%d] = %d' % (vk, vv)) for (vk, vv) in dv.values.iteritems()]))
   else:
    raise ConfigurationException(('Datastore is corrupted %s' % value))
   output.write('\n\n')
 exit()

def build_conversion ( option , opt , value , parser ) : try : with open ( value , 'r' ) as input : data = pickle . load ( input ) except : raise ConfigurationException ( ( 'File Not Found %s' % value ) ) with open ( ( value + '.dump' ) , 'w' ) as output : for ( dk , dv ) in data . iteritems ( ) : output . write ( ( '[ %s ]\n\n' % dk ) ) if isinstance ( dv . values , list ) : output . write ( '\n' . join ( [ ( '[%d] = %d' % ( vk , vv ) ) for ( vk , vv ) in enumerate ( dv . values ) ] ) ) elif isinstance ( data [ k ] . values , dict ) : output . write ( '\n' . join ( [ ( '[%d] = %d' % ( vk , vv ) ) for ( vk , vv ) in dv . values . iteritems ( ) ] ) ) else : raise ConfigurationException ( ( 'Datastore is corrupted %s' % value ) ) output . write ( '\n\n' ) exit ( )
this converts a pickled datastore to a register dump list .