def _merge_a_into_b(a, b):
 if (type(a) is not edict):
  return
 for (k, v) in a.iteritems():
  if (not b.has_key(k)):
   raise KeyError('{} is not a valid config key'.format(k))
  if (type(b[k]) is not type(v)):
   raise ValueError('Type mismatch ({} vs. {}) for config key: {}'.format(type(b[k]), type(v), k))
  if (type(v) is edict):
   try:
    _merge_a_into_b(a[k], b[k])
   except:
    print 'Error under config key: {}'.format(k)
    raise
  else:
   b[k] = v

def _merge_a_into_b ( a , b ) : if ( type ( a ) is not edict ) : return for ( k , v ) in a . iteritems ( ) : if ( not b . has_key ( k ) ) : raise KeyError ( '{} is not a valid config key' . format ( k ) ) if ( type ( b [ k ] ) is not type ( v ) ) : raise ValueError ( 'Type mismatch ({} vs. {}) for config key: {}' . format ( type ( b [ k ] ) , type ( v ) , k ) ) if ( type ( v ) is edict ) : try : _merge_a_into_b ( a [ k ] , b [ k ] ) except : print 'Error under config key: {}' . format ( k ) raise else : b [ k ] = v
merge config dictionary a into config dictionary b .