Closes a text document.
        :param path: Path of the document to close.
770691
def close_document(self, path):
        
        to_close = []
        for widget in self.widgets(include_clones=True):
            p = os.path.normpath(os.path.normcase(widget.file.path))
            path = os.path.normpath(os.path.normcase(path))
            if p == path:
                to_close.append(widget)
        for widget in to_close:
            tw = widget.parent_tab_widget
            tw.remove_tab(tw.indexOf(widget))
4899
def remove_resource(self, path):
        

        path = path.strip("/")
        paths = path.split("/")
        actual_path = ""
        i = 0
        for p in paths:
            i += 1
            actual_path += "/" + p
        try:
            res = self.root[actual_path]
        except KeyError:
            res = None
        if res is not None:
            del(self.root[actual_path])
        return res
686160
def delete(path, fatal=True, logger=LOG.debug):
    
    islink = path and os.path.islink(path)
    if not islink and (not path or not os.path.exists(path)):
        return 0

    if is_dryrun():
        LOG.debug("Would delete %s", short(path))
        return 1

    if logger:
        logger("Deleting %s", short(path))

    try:
        if islink or os.path.isfile(path):
            os.unlink(path)
        else:
            shutil.rmtree(path)
        return 1

    except Exception as e:
        return abort("Can't delete %s: %s", short(path), e, fatal=(fatal, -1))
1221034
def __rmtree(path):
    
    logger.info("rmtree: %s" % path)
    try:
        shutil.rmtree(path)
        return True
    except Exception as e:
        logger.error("rmtree: %s failed! Error: %s" % (path, e))
        return False
997682
def _robust_remove(path):
        
        tries = itertools.count()
        max_tries = 50
        while os.path.isdir(path):
            try:
                shutil.rmtree(path)
            except WindowsError:
                if next(tries) >= max_tries:
                    raise
                time.sleep(0.2)
1122888
def unregister_path(self, path):
        

        if not path in self:
            raise umbra.exceptions.PathExistsError("{0} | '{1}' path isn't registered!".format(
                self.__class__.__name__, path))

        del (self.__paths[path])
        return True
1109922
def rm(path):
    
    if path and os.path.exists(path):
        if os.path.isdir(path):
            shutil.rmtree(path)
        else:
            os.remove(path)
262990
def save(self, path):
        
        with open(path, 'w') as f:
            f.write(self.contents())
1252877
def delete(self, path):
        
        mountpoint, chunks = self.get_mountpoint(path)
        apath = self._join_chunks(chunks)

        if mountpoint is None:
            try:
                simfile = self._files.pop(apath)
            except KeyError:
                return False
            else:
                self.state.history.add_event('fs_unlink', path=apath, unlink_idx=len(self.unlinks))
                self.unlinks.append((apath, simfile))
                return True
        else:
            return mountpoint.delete(chunks)
733512
def clear_path(path):
    
    from time import time
    if not os.path.exists(path):
        return
    if TRASH_PATH == '.':
        shutil.rmtree(path, ignore_errors=True)
    else:
        shutil.move(path, '%s/%s_%s' % (
            TRASH_PATH, os.path.basename(path), time()))
236046
static void deletePath(String path) {
        try {
            ZkConnection.client.delete().guaranteed().deletingChildrenIfNeeded().forPath(path);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
1283374
def write(path, doc, mode=MODE_TSV, **kwargs):
    '''  '''
    if mode == MODE_TSV:
        with TxtWriter.from_path(path) as writer:
            writer.write_doc(doc)
    elif mode == MODE_JSON:
        write_json(path, doc, **kwargs)
1299429
def open_file(self, path):
        
        if path:
            editor = self.tabWidget.open_document(path)
            editor.cursorPositionChanged.connect(
                self.on_cursor_pos_changed)
            self.recent_files_manager.open_file(path)
            self.menu_recents.update_actions()
96884
def close(self):
        
        if self._file:
            if not(self._file.closed):
                self._file.close()
        self.closed = True
1007985
public static void setXwpfDocument(String path) throws IOException {
        InputStream is = new FileInputStream(path);
        xwpfDocument = new XWPFDocument(is);
        is.close();
    }
1283786
def close_client_stream(client_stream, unix_path):
    
    try:
        client_stream.shutdown(socket.SHUT_RDWR)
        if unix_path:
            logger.debug('%s: Connection closed', unix_path)
        else:
            peer = client_stream.getpeername()
            logger.debug('%s:%s: Connection closed', peer[0], peer[1])
    except (socket.error, OSError) as exception:
        logger.debug('Connection closing error: %s', exception)
    client_stream.close()
37324
def delete(self, path, callback=None, timeout=None, **kwargs):  # pragma: no cover
        
        request = self.mk_request(defines.Codes.DELETE, path)

        for k, v in kwargs.items():
            if hasattr(request, k):
                setattr(request, k, v)

        return self.send_request(request, callback, timeout)