Uses :func:`os.rename` to atomically update the message filename
        based on :meth:`~mailbox.MaildirMessage.get_info`.
485189
def update_metadata(self, key: str, msg: MaildirMessage) -> None:
        
        subpath = self._lookup(key)
        subdir, name = os.path.split(subpath)
        new_subdir = msg.get_subdir()
        new_name = key + self.colon + msg.get_info()
        if subdir != new_subdir:
            raise ValueError('Message subdir may not be updated')
        elif name != new_name:
            new_subpath = os.path.join(msg.get_subdir(), new_name)
            old_path = os.path.join(self._path, subpath)
            new_path = os.path.join(self._path, new_subpath)
            os.rename(old_path, new_path)
            self._toc[key] = new_subpath
1082175
def get_new_filename(self, name):
        """"""
        name = MigrationFile.normalize_name(name)
        migrations = self.get_migration_files()
        migration_id = migrations[-1].id if migrations else 0
        migration_id += 1
        return '{:04}_{}.py'.format(migration_id, name)
677071
public function renameFile(FileInfo $fileInfo, $new_file_name)
    {
        try {
            $this->validateFile($fileInfo, $new_file_name);
            $fm = new Filesystem();
            $old_file = $fileInfo->getFilepath(true);
            $new_file = $new_file_name;
            $fm->rename($old_file, $new_file);
        } catch (\Exception $e) {
            $this->getFileManager()->throwError("Cannot rename file or directory", 500, $e);
        }
    }
1279829
def update_folder_name(self, name):
        
        if self.root:
            return False
        if not name:
            return False

        url = self.build_url(
            self._endpoints.get('get_folder').format(id=self.folder_id))

        response = self.con.patch(url, data={self._cc('displayName'): name})
        if not response:
            return False

        folder = response.json()

        self.name = folder.get(self._cc('displayName'), '')
        self.parent_id = folder.get(self._cc('parentFolderId'), None)

        return True
362827
function(info, file, opts) {
  if (typeof opts == 'boolean') { // old arugment backup
    opts = {backup: opts};
  }
  opts = opts || {};
  var err = null;
  try {
    ensureDirectoryExists(path.dirname(file));
    if (opts.backup && fileExists(file)) {
      fs.renameSync(file, file + '.bak');
    }
    jsonfile.writeFileSync(file, info, { spaces: 2 });
  } catch (e) {
    err = e;
  }
  return err;
}
190362
def project_rename_folder(object_id, input_params={}, always_retry=False, **kwargs):
    
    return DXHTTPRequest('/%s/renameFolder' % object_id, input_params, always_retry=always_retry, **kwargs)
271525
def rename(self, path, destination, **kwargs):
        
        return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
1167082
def action_rename(self, courseid, taskid, path, new_path):
        
        # normalize
        path = path.strip()
        new_path = new_path.strip()
        if not path.startswith("/"):
            path = "/" + path
        if not new_path.startswith("/"):
            new_path = "/" + new_path

        old_path = self.verify_path(courseid, taskid, path)
        if old_path is None:
            return self.show_tab_file(courseid, taskid, _("Internal error"))

        wanted_path = self.verify_path(courseid, taskid, new_path, True)
        if wanted_path is None:
            return self.show_tab_file(courseid, taskid, _("Invalid new path"))

        try:
            self.task_factory.get_task_fs(courseid, taskid).move(old_path, wanted_path)
            return self.show_tab_file(courseid, taskid)
        except:
            return self.show_tab_file(courseid, taskid, _("An error occurred while moving the files"))
1234548
def rename_script(rename=None):  # noqa: E501
    
    if connexion.request.is_json:
        rename = Rename.from_dict(connexion.request.get_json())  # noqa: E501

    if(not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultDriver()
    if (not driver.renameScript(rename.original.name, rename.new.name)):
        return ErrorResponse(status=500, message='Cannot rename to an existing file.')
    return Response(status=200, body={'file-name': rename.new.name})
358569
public function renameFolder($old_name, $new_name, $expunge = true) {
        $this->checkConnection();
        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
        if($expunge) $this->expunge();

        return $status;
    }
862656
def rename(name, new_name, root=None):
    '''
    
    '''
    if info(new_name, root=root):
        raise CommandExecutionError('User \'{0}\' already exists'.format(new_name))

    return _chattrib(name, 'name', new_name, '-l', root=root)
521115
def rename(self, dn: str, new_rdn: str, new_base_dn: Optional[str] = None) -> None:
        
        raise NotImplementedError()
926671
def update_safe(filename: str, **kw: Any) -> Generator[IO, None, None]:
    
    with tempfile.NamedTemporaryFile(
        dir=os.path.dirname(filename),
        delete=False,
        prefix=f"{os.path.basename(filename)}.",
        **kw,
    ) as tf:
        if os.path.exists(filename):
            os.chmod(tf.name, os.stat(filename).st_mode & 0o7777)
        tf.has_changed = False  # type: ignore
        yield tf
        if not os.path.exists(tf.name):
            return
        filename_tmp = tf.name
    if os.path.exists(filename) and filecmp.cmp(filename, filename_tmp, shallow=False):
        os.unlink(filename_tmp)
    else:
        os.rename(filename_tmp, filename)
        tf.has_changed = True
263565
def rename(self, name, **kwargs):
        

        return self._rename(self._dxid, {"project": self._proj,
                                         "name": name}, **kwargs)
510316
function renameFiles(files)
{
  files.forEach(function (file)
  {
    var originalName = path.basename(file);
    var newFileName = originalName.toLowerCase();
    var directory = path.dirname(file);
    if (originalName != newFileName)
    {
      fs.renameSync(file, directory + "/" + newFileName); //, function(err)

      if (debug)
        console.log('Renamed: %s --> %s', originalName, newFileName);

      originalFiles.push(originalName);
      renamedFiles.push(newFileName);
    }
  });
}
139474
def rename(name, new_name):
    '''
    
    '''
    current_info = info(name)
    if not current_info:
        raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
    new_info = info(new_name)
    if new_info:
        raise CommandExecutionError(
            'User \'{0}\' already exists'.format(new_name)
        )
    cmd = ['pw', 'usermod', '-l', new_name, '-n', name]
    __salt__['cmd.run'](cmd)
    post_info = info(new_name)
    if post_info['name'] != current_info['name']:
        return post_info['name'] == new_name
    return False
1310857
def __rename_file(self, source, target):
        

        for file_node in self.__script_editor.model.get_file_nodes(source, self.__script_editor.model.root_node):
            self.__script_editor.unregister_node_path(file_node)
            self.__rename_path(source, target)
            self.__script_editor.register_node_path(file_node)
            if self.__script_editor.model.is_authoring_node(file_node):
                self.__set_authoring_nodes(source, target)
            else:
                self.__script_editor.model.update_project_nodes(file_node.parent)