For a dict, write each value to destination/key
192707
def write_files(template, destination='./dxf'):
    
    os.makedirs(destination)
    for key, value in template.items():
        with open(os.path.join(destination, key), 'w') as f:
            f.write(replace_whitespace(value, insert=False))
220707
def _many_to_one(input_dict):
    """"""
    return dict((key, val)
                for keys, val in input_dict.items()
                for key in keys)
694775
def dump_dict_to_file(dictionary, filepath):
    """"""
    create_dirs(
        os.path.dirname(filepath)
    )

    with open(filepath, 'a') as outfile:
        json.dump(dictionary, outfile)
        outfile.write('\n')
30537
def write(self, path, data, offset, fh):  # pragma: no cover
        
        # print("write {}".format(path))
        with self.attr_lock:
            base = self.attr[path][BASE_KEY]
            staged = self.attr[path][STAGED_KEY]
            if not staged.closed:
                base.st_size += len(data)
                staged.write(data)
        return len(data)
1364631
def write(key, value, binary = false)
      result = req_list(new_req_list().add_write(key, value, binary))[0]
      _process_result_commit(result)
    end
1070888
function overwriteKeys(baseObject, overrideObject, createNew) {
  if (!baseObject) {
    baseObject = {};
  }
  if (createNew) {
    baseObject = JSON.parse(JSON.stringify(baseObject));
  }
  Object.keys(overrideObject).forEach(function(key) {
    if (isObjectAndNotArray(baseObject[key]) && isObjectAndNotArray(overrideObject[key])) {
      overwriteKeys(baseObject[key], overrideObject[key]);
    }
    else {
      baseObject[key] = overrideObject[key];
    }
  });
  return baseObject;
}
260281
def key_values(self):
        
        key_values = {}
        for key in self.keys:
            if key in self.payload:
                key_values[key] = self.payload[key]
        return key_values
774281
def flatten_and_write(dotenv_path, dotenv_as_dict, quote_mode='always'):
    
    with open(dotenv_path, 'w') as f:
        for k, v in dotenv_as_dict.items():
            str_format = _get_format(v, quote_mode)
            f.write(str_format.format(key=k, value=v))
    return True
1244698
def write_output(self):
        """"""
        for data in self.output_data.values():
            self.create_output(data.get('key'), data.get('value'), data.get('type'))
733163
def extern_store_dict(self, context_handle, vals_ptr, vals_len):
    
    c = self._ffi.from_handle(context_handle)
    tup = tuple(c.from_value(val[0]) for val in self._ffi.unpack(vals_ptr, vals_len))
    d = dict()
    for i in range(0, len(tup), 2):
      d[tup[i]] = tup[i + 1]
    return c.to_value(d)
188677
def reconstruct_dict(dot_paths, values):
    
    '''  '''
    
    output_dict = {}
    
    for i in range(len(dot_paths)):
        if i + 1 <= len(values):
            path_segments = segment_path(dot_paths[i])
            current_nest = output_dict
            for j in range(len(path_segments)):
                key_name = path_segments[j]
                try:
                    key_name = int(key_name)
                except:
                    pass
                if j + 1 == len(path_segments):
                    if isinstance(key_name, int):
                        current_nest.append(values[i])
                    else:
                        current_nest[key_name] = values[i]
                else:
                    next_key = path_segments[j+1]
                    try:
                        next_key = int(next_key)
                    except:
                        pass
                    if isinstance(next_key, int):
                        if not key_name in current_nest.keys():
                            current_nest[key_name] = []
                        current_nest = current_nest[key_name]
                    else:
                        if isinstance(key_name, int):
                            current_nest.append({})
                            current_nest = current_nest[len(current_nest) - 1]
                        else:
                            if not key_name in current_nest.keys():
                                current_nest[key_name] = {}
                            current_nest = current_nest[key_name]
    
    return output_dict
1144311
def _format_dict(result):
    """"""

    table = KeyValueTable(['name', 'value'])
    table.align['name'] = 'r'
    table.align['value'] = 'l'

    for key, value in result.items():
        value = iter_to_table(value)
        table.add_row([key, value])

    return table
571892
def text_dict_write(fpath, dict_):
    
    #dict_ = text_dict_read(fpath)
    #dict_[key] = val
    dict_text2 = util_str.repr4(dict_, strvals=False)
    if VERBOSE:
        print('[cache] ' + str(dict_text2))
    util_io.write_to(fpath, dict_text2)
1124560
def write_params(path, *args, **dicts):
    
    path = Path(path)
    if not path.parent.is_dir():
        path.parent.mkdir(parents=True)
    if len(args) == 1:
        d = args[0]
        with path.open('w') as f:
            for key in d:
                f.write(key + ' = ' + str(d[key]) + '\n')
    else:
        with path.open('w') as f:
            for k, d in dicts.items():
                f.write('[' + k + ']\n')
                for key, val in d.items():
                    f.write(key + ' = ' + str(val) + '\n')
195833
def write(gmt, out_path):
    
    with open(out_path, 'w') as f:
        for _, each_dict in enumerate(gmt):
            f.write(each_dict[SET_IDENTIFIER_FIELD] + '\t')
            f.write(each_dict[SET_DESC_FIELD] + '\t')
            f.write('\t'.join([str(entry) for entry in each_dict[SET_MEMBERS_FIELD]]))
            f.write('\n')
330979
void writeObjectKeyValue(String key, String value) throws IOException {
        writeObjectKey(key);
        writeString(value);
    }
635680
def save_list(key, *values):
    
    return json.dumps({key: [_get_json(value) for value in values]})