Renames given source with given target name.

        :param source: Source file.
        :type source: unicode
        :param target: Target file.
        :type target: unicode
492057
def __rename_path(self, source, target):
        

        if not foundations.common.path_exists(source):
            return

        parent_directory = os.path.dirname(source)
        is_path_registered = self.__engine.file_system_events_manager.is_path_registered(parent_directory)
        is_path_registered and self.__engine.file_system_events_manager.unregister_path(parent_directory)
        os.rename(source, target)
        is_path_registered and self.__engine.file_system_events_manager.register_path(parent_directory)
972913
def rename(self, path, raise_if_exists=False):
        
        if isinstance(path, HdfsTarget):
            path = path.path
        if raise_if_exists and self.fs.exists(path):
            raise RuntimeError('Destination exists: %s' % path)
        self.fs.rename(self.path, path)
91063
public void setTargetName (String targetName) {
        if (targetName == null) target = null;
        target = targetServer.getTarget(targetName);
    }
86294
def renames(from_path, to_path, user=None):
    
    to_dir = path.dirname(to_path)
    if to_dir:
        mkdir(to_dir, user=user)
    rename(from_path, to_path, user=user)
1350923
private void updateProperties(T target, Map<String, Object> source) {
        Map<String, PropertyDescriptor> mapTargetProps = MappingUtils.mapPropertyDescriptors(target.getClass());

        for (String sourceKey : source.keySet()) {
            if (mapTargetProps.containsKey(sourceKey) == true) {
                MappingUtils.callSetter(target, mapTargetProps.get(sourceKey), source.get(sourceKey));
            }
        }
    }
357994
public static final void copyResource(String source, Path target, Class<?> cls) throws IOException
    {
        try (InputStream is = cls.getResourceAsStream(source))
        {
            Files.copy(is, target, REPLACE_EXISTING);
        }
    }
498453
def _copy_files(source, target):
    
    source_files = listdir(source)
    if not exists(target):
        makedirs(target)
    for filename in source_files:
        full_filename = join(source, filename)
        if isfile(full_filename):
            shutil.copy(full_filename, target)
887081
def __rename_directory(self, source, target):
        

        for node in itertools.chain(self.__script_editor.model.get_project_nodes(source),
                                    self.__script_editor.model.get_directory_nodes(source)):
            self.__script_editor.model.unregister_project_nodes(node)
            self.__script_editor.unregister_node_path(node)
            self.__rename_path(source, target)
            node.name = os.path.basename(target)
            node.path = target
            self.__script_editor.model.node_changed(node)
            self.__script_editor.register_node_path(node)
            self.__script_editor.model.set_project_nodes(node)
803510
public function moveFile($source, $target, $file)
    {
        if (file_exists($source.$file)) {
            rename($source.$file, $target.$file);
        }
    }
359406
def rename(self, src, dst):
        
        with self.pipe as pipe:
            return pipe.rename(self.redis_key(src), self.redis_key(dst))
1049630
def rename_source_file(self, src, dst):
        
        try:
            os.rename(self.source_msgs_dir.joinpath(src), self.source_msgs_dir.joinpath(dst))
        except OSError:
            pass
744048
def __extend_targets_sources(target, source):
    
    if not SCons.Util.is_List(target):
        target = [target]
    if not source:
        source = target[:]
    elif not SCons.Util.is_List(source):
        source = [source]
    if len(target) < len(source):
        target.extend(source[len(target):])
        
    return target, source
127344
def _source_roots_for_target(target):
    
    def root_package_prefix(source_file):
      source = os.path.dirname(source_file)
      return os.path.join(get_buildroot(), target.target_base, source), source.replace(os.sep, '.')
    return {root_package_prefix(source) for source in target.sources_relative_to_source_root()}
644529
def source_debianize_name(name):
    ""
    name = name.replace('_','-')
    name = name.replace('.','-')
    name = name.lower()
    return name
1040524
public static void copyDirectory(File source, File target) {
        if (source.isDirectory()) {
            if (!target.exists()) {
                target.mkdir();
            }
            for (String child : source.list()) {
                copyDirectory(new File(source, child), new File(target, child));
            }
        } else {
            try {
                write(new FileInputStream(source), new FileOutputStream(target));
            } catch (IOException e) {
                if (target.isDirectory()) {
                    if (!target.exists()) {
                        if (!target.mkdirs()) {
                            throw E.ioException("cannot copy [%s] to [%s]", source, target);
                        }
                    }
                    target = new File(target, source.getName());
                } else {
                    File targetFolder = target.getParentFile();
                    if (!targetFolder.exists()) {
                        if (!targetFolder.mkdirs()) {
                            throw E.ioException("cannot copy [%s] to [%s]", source, target);
                        }
                    }
                }
                try {
                    write(new FileInputStream(source), new FileOutputStream(target));
                } catch (IOException e0) {
                    throw E.ioException(e0);
                }
            }
        }
    }
654244
def rename(self, new_name, range=None):
        """"""
        self.log.debug('rename: in')
        if not new_name:
            new_name = self.editor.ask_input("Rename to:")
        self.editor.write(noautocmd=True)
        b, e = self.editor.word_under_cursor_pos()
        current_file = self.editor.path()
        self.editor.raw_message(current_file)
        self.send_refactor_request(
            "RefactorReq",
            {
                "typehint": "RenameRefactorDesc",
                "newName": new_name,
                "start": self.get_position(b[0], b[1]),
                "end": self.get_position(e[0], e[1]) + 1,
                "file": current_file,
            },
            {"interactive": False}
        )
566925
def add_sources_from_file(file_name, update=True):
    

    key_regex = re.compile(r'(?P<source>[^()]*)(\s+\((?P<key>.*)\))?$')
    for line in _read_lines_from_file(file_name):
        kwargs = key_regex.match(line).groupdict()
        kwargs['update'] = False
        add_apt_source(**kwargs)
    if update:
        update_apt_sources()