Helper function to remove resources.

        :param path: the path for the unwanted resource
        :rtype : the removed object
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
537113
public static boolean deletePathRecursive(Tree<ResourceMeta> tree, Path path){
        if(tree.hasResource(path)) {
            //delete just this resource
            return tree.deleteResource(path);
        }else if (tree.hasDirectory(path)) {
            //list resources and delete
            Set<Resource<ResourceMeta>> resources = tree.listDirectory(path);
            boolean failed=false;
            for (Resource<ResourceMeta> resource : resources) {
                if(resource.isDirectory()){
                    if(!deletePathRecursive(tree,resource.getPath())){
                        failed=true;
                    }
                }else {
                    if(!tree.deleteResource(resource.getPath())){
                        failed=true;
                    }
                }
            }
            return !failed;
        }else{
            return true;
        }
    }
798483
def delete(path, params)
      headers = {}

      request('DELETE', path, nil, headers) do |resp|
        yield(resp) if block_given?
      end
    end
999688
def remove_field(self, path, name):
        
        path = make_path(path)
        container = self.get_container(path)
        try:
            value = container._values[name]
            if isinstance(value, ValueTree):
                raise TypeError()
            del container._values[name]
        except KeyError:
            pass
80460
def remove(name, path):
    '''
    
    '''
    cmd = [_get_cmd(), '--remove', name, path]
    out = __salt__['cmd.run_all'](cmd, python_shell=False)
    if out['retcode'] > 0:
        return out['stderr']
    return out['stdout']
272761
def delete(path, options = {}, headers = {}, raw = false)
      request(:delete, path, options, headers, raw)
    end
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)
747008
def delete(self, path, data, **options):
        
        data, options = self._update_request(data, options)
        return self.request('delete', path, data=data, **options)
525349
def remove_environment(self, name=None, path=None, **kwargs):
        
        return self.remove(name=name, path=path, all=True, **kwargs)
1157903
def delete(path, options={}, format=format)
      respond request(:delete, path, options, format)
    end
123815
def remove(self):
        # type: () -> int
        
        removes = 0
        for path, info in self._make_iter(search="depth"):
            if info.is_dir:
                self.fs.removetree(path)
            else:
                self.fs.remove(path)
            removes += 1
        return removes
1136970
def remove_path(path):
    """"""
    if path is None or not os.path.exists(path):
        return
    if platform.system() == 'Windows':
        # Need to have write permission before deleting the file.
        os.chmod(path, stat.S_IWRITE)
    try:
        if os.path.isdir(path):
            shutil.rmtree(path)
        elif os.path.isfile(path):
            shutil.os.remove(path)
    except OSError:
        logger.exception("Could not remove path: %s" % path)
26470
def remove(self, path, relative=False):
        
        if not relative:
            path = self.relpath(path)
        self._remove(self.get_client_kwargs(path))
694567
def safe_remove(path):
    
    if not os.path.exists(path):
        return

    try:
        if os.path.isdir(path) and not os.path.islink(path):
            shutil.rmtree(path)
        else:
            os.remove(path)
    except OSError:
        if os.path.exists(path):
            raise
601447
def remove_file(self, path):
        """"""
        self.get_file(path).remove()
        self.remove_cache_buster(path)
74223
def delete(self):
        
        if os.path.isfile(self.path):
            os.remove(self.path)
        else:
            shutil.rmtree(self.path)
1289093
def clean(cls, path):
        ''''''
        for pth in os.listdir(path):
            pth = os.path.abspath(os.path.join(path, pth))
            if os.path.isdir(pth):
                logger.debug('Removing directory %s' % pth)
                shutil.rmtree(pth)
            else:
                logger.debug('Removing file %s' % pth)
                os.remove(pth)