Renames this router.

        :param new_name: new name string
516959
def set_name(self, new_name):
        

        # change the hostname in the startup-config
        if os.path.isfile(self.startup_config_path):
            try:
                with open(self.startup_config_path, "r+", encoding="utf-8", errors="replace") as f:
                    old_config = f.read()
                    new_config = re.sub(r"^hostname .+$", "hostname " + new_name, old_config, flags=re.MULTILINE)
                    f.seek(0)
                    f.write(new_config)
            except OSError as e:
                raise DynamipsError("Could not amend the configuration {}: {}".format(self.startup_config_path, e))

        # change the hostname in the private-config
        if os.path.isfile(self.private_config_path):
            try:
                with open(self.private_config_path, "r+", encoding="utf-8", errors="replace") as f:
                    old_config = f.read()
                    new_config = old_config.replace(self.name, new_name)
                    f.seek(0)
                    f.write(new_config)
            except OSError as e:
                raise DynamipsError("Could not amend the configuration {}: {}".format(self.private_config_path, e))

        yield from self._hypervisor.send('vm rename "{name}" "{new_name}"'.format(name=self._name, new_name=new_name))
        log.info('Router "{name}" [{id}]: renamed to "{new_name}"'.format(name=self._name, id=self._id, new_name=new_name))
        self._name = new_name
689052
def rename(self, old_name, new_name):
        """"""
        try:
            self.api.rename(mkey(old_name), mkey(new_name))
        except ResponseError, exc:
            if "no such key" in exc.args:
                raise KeyError(old_name)
            raise
777471
public function rename( string $old_name, string $new_name ): Prop
	{
		// check old
		$row = self::getEventItem($old_name);
		if( !$row )
		{
			throw new NotFoundException("Event '{$old_name}' not found");
		}

		$this->permissible($row->module_id, $old_name);

		// is update ?

		$prop = new Prop([
			"action" => "rename",
			"renamed" => false
		]);

		if( $old_name === $new_name )
		{
			return $prop;
		}

		// check new
		if( self::hasName($new_name) )
		{
			throw new \InvalidArgumentException("Duplicate event name '{$new_name}'");
		}

		if( ! $this->isValidModuleName($new_name) )
		{
			throw new \InvalidArgumentException("Invalid event name '{$new_name}' for the " . $this->getModule()->getName() . " module");
		}

		// dispatch event
		$event = new EventRenameDriverEvent($this, $old_name, $new_name);
		$dispatcher = EventManager::dispatcher($event->getName());
		$dispatcher->dispatch($event);

		$prop->set(
			"renamed",
			\DB::
				table("events")
					->whereId($row->id)
					->update(['name' => $new_name]) > 0
		);

		$prop->get("renamed") && $this->addLogDebug(Text::createInstance("The %s event is successfully renamed. New event name is %s", $old_name, $new_name));
		$dispatcher->complete($prop);
		return $prop;
	}
114752
def obsolete_rename(oldname, newfunc):
    
    newname = newfunc.__name__
    def __obsolete(*args, **kwargs):
        warnings.warn(
            "{oldname} is obsolete and is removed in PyQt5. "
            "Use {newname} instead.".format(oldname=oldname, newname=newname),
            DeprecationWarning,
            stacklevel=2
        )
        return newfunc(*args, **kwargs)
    __obsolete.__name__ = oldname
    return __obsolete
296214
def update_name(self, new_name):
        

        if not dtoolcore.utils.name_is_valid(new_name):
            raise(DtoolCoreInvalidNameError())

        self._admin_metadata['name'] = new_name
        if self._storage_broker.has_admin_metadata():
            self._storage_broker.put_admin_metadata(self._admin_metadata)
1318272
def rename_window(self, new_name):
        

        import shlex

        lex = shlex.shlex(new_name)
        lex.escape = ' '
        lex.whitespace_split = False

        try:
            self.cmd('rename-window', new_name)
            self['window_name'] = new_name
        except Exception as e:
            logger.error(e)

        self.server._update_windows()

        return self
1007952
def _rename(self):
        
        newname = self.action['newname']
        try:
            newpath = self.fs.rename(self.fp,newname)
        except OSError:
            raise tornado.web.HTTPError(400)
        return newpath
1080205
def rename(self, **mapping):
        
        params = {k: v for k, v in self.get_param_values() if k != 'name'}
        return self.__class__(rename=mapping,
                              source=(self._source() if self._source else None),
                              linked=self.linked, **params)
1098456
def rename(self, new_name):
        

        if _lxc.Container.rename(self, new_name):
            return Container(new_name)

        return False
317484
def rename(mapping)
      new_attributes = map do |attr|
        alias_name = mapping[attr.name]
        alias_name ? attr.aliased(alias_name) : attr
      end

      new(new_attributes)
    end
798729
def rename_module(new, old):
    
    try:
        sys.modules[new] = imp.load_module(old, *imp.find_module(old))
        return True
    except ImportError:
        return False
337479
def rename(self, newname):
    
    dic = self.to_json_dict()
    if self._get_resource_root().version < 6:
      dic['name'] = newname
    else:
      dic['displayName'] = newname
    return self._put_cluster(dic)
1146841
def new(self, name):
        
        #XXX:dc: assert that the name is somewhat sane and follows python
        # naming conventions
        next_id = 0
        cls_name = '_'.join((name, next_id))
        with open(pjoin(self.migration_home, name), "w+") as new_migration:
            print >> new_migration, migration_tmpl.format(
                cls_name=cls_name, migration_name=name)
1211249
def _rename_node(self, name, new_name):
        
        # Update parent
        if not self.is_root(name):
            parent = self._db[name]["parent"]
            self._db[parent]["children"].remove(name)
            self._db[parent]["children"] = sorted(
                self._db[parent]["children"] + [new_name]
            )
        # Update children
        iobj = self._get_subtree(name) if name != self.root_name else self.nodes
        for key in iobj:
            new_key = key.replace(name, new_name, 1)
            new_parent = (
                self._db[key]["parent"]
                if key == name
                else self._db[key]["parent"].replace(name, new_name, 1)
            )
            self._db[new_key] = {
                "parent": new_parent,
                "children": [
                    child.replace(name, new_name, 1)
                    for child in self._db[key]["children"]
                ],
                "data": copy.deepcopy(self._db[key]["data"]),
            }
            del self._db[key]
        if name == self.root_name:
            self._root = new_name
            self._root_hierarchy_length = len(
                self.root_name.split(self._node_separator)
            )
929078
def name(self, new_name):
        

        if self.startup_config_file:
            content = self.startup_config_content
            content = re.sub(r"^hostname .+$", "hostname " + new_name, content, flags=re.MULTILINE)
            self.startup_config_content = content

        super(IOUVM, IOUVM).name.__set__(self, new_name)
314059
def rename(self, new_name):
        
        new_collection = Collection(self.db, new_name, create=False)
        assert not new_collection.exists()

        self.db.execute("alter table %s rename to %s" % (self.name, new_name))
        self.name = new_name
1374711
def rename(self, new_name, *args, **kwargs):
        
        new = self.reddit_session.rename_multireddit(self.name, new_name,
                                                     *args, **kwargs)
        self.__dict__ = new.__dict__  # pylint: disable=W0201
        return self