def _paste(self, sources, destination, copy):
        """
        Copies the files listed in ``sources`` to destination. Source are
        removed if copy is set to False.
        """
        for src in sources:
            debug('%s <%s> to <%s>' % (
                'copying' if copy else 'cutting', src, destination))
            perform_copy = True
            ext = os.path.splitext(src)[1]
            original = os.path.splitext(os.path.split(src)[1])[0]
            filename, status = QtWidgets.QInputDialog.getText(
                self.tree_view, _('Copy'), _('New name:'),
                QtWidgets.QLineEdit.Normal, original)
            if filename == '' or not status:
                return
            filename = filename + ext
            final_dest = os.path.join(destination, filename)
            if os.path.exists(final_dest):
                rep = QtWidgets.QMessageBox.question(
                    self.tree_view, _('File exists'),
                    _('File <%s> already exists. Do you want to erase it?') %
                    final_dest,
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                    QtWidgets.QMessageBox.No)
                if rep == QtWidgets.QMessageBox.No:
                    perform_copy = False
            if not perform_copy:
                continue
            try:
                if os.path.isfile(src):
                    shutil.copy(src, final_dest)
                else:
                    shutil.copytree(src, final_dest)
            except (IOError, __HOLE__) as e:
                QtWidgets.QMessageBox.warning(
                    self.tree_view, _('Failed to copy file'), str(e))
                _logger().exception('failed to copy %s to %s', src,
                                    destination)
            else:
                debug('file copied %s', src)
            if not copy:
                debug('removing source (cut operation)')
                if os.path.isfile(src):
                    os.remove(src)
                else:
                    shutil.rmtree(src)
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/widgets/filesystem_treeview.py/FileSystemHelper._paste