Remove the indicated filename from the namespace.  This may
invalidate some blocks that make up the file.
330871
boolean deleteInternal(String src, INode[] inodes, boolean recursive,
                         boolean enforcePermission) throws IOException {
    ArrayList<BlockInfo> collectedBlocks = new ArrayList<BlockInfo>();
    INode targetNode = null;

    byte[][] components = inodes == null ?
      INodeDirectory.getPathComponents(src) : null;

    writeLock();
    try {
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("DIR* NameSystem.delete: " + src);
      }
      if (isInSafeMode()) {
        throw new SafeModeException("Cannot delete " + src, safeMode);
      }
      if (inodes == null) {
        inodes = new INode[components.length];
        dir.rootDir.getExistingPathINodes(components, inodes);
      }
      if (enforcePermission && isPermissionEnabled
          && isPermissionCheckingEnabled(inodes)) {
        checkPermission(src, inodes, false, null, FsAction.WRITE, null, FsAction.ALL);
      }
      if (neverDeletePaths.contains(src)) {
        NameNode.stateChangeLog.warn("DIR* NameSystem.delete: " +
          " Trying to delete a whitelisted path " + src +
          " by user " + getCurrentUGI() +
          " from server " + Server.getRemoteIp());
        throw new IOException("Deleting a whitelisted directory is not allowed. " + src);
      }

      if ((!recursive) && (!dir.isDirEmpty(inodes[inodes.length-1]))) {
        throw new IOException(src + " is non empty");
      }

      targetNode = dir.delete(src, inodes, collectedBlocks,
          BLOCK_DELETION_INCREMENT);
      if (targetNode == null) {
        return false;
      }
    } finally {
      writeUnlock();
    }
    List<INode> removedINodes = new ArrayList<INode>();
    while (targetNode.name != null) {
      // Interatively Remove blocks
      collectedBlocks.clear();
      // sleep to make sure that the lock can be grabbed by another thread
      try {
        Thread.sleep(1);
      } catch (InterruptedException e) {
        throw new InterruptedIOException(e.getMessage());
      }
      writeLock();
      try {
        int filesRemoved = targetNode.collectSubtreeBlocksAndClear(
            collectedBlocks, BLOCK_DELETION_INCREMENT, removedINodes);
        incrDeletedFileCount(this, filesRemoved);
        removeBlocks(collectedBlocks);
        // remove from inodeMap
        dir.removeFromInodeMap(removedINodes);
      } finally {
        writeUnlock();
      }   
    }
       
    collectedBlocks.clear();
    removedINodes.clear();
    
    return true;
  }
912317
public function clearNamespace()
    {
        if (! $this->enabled) {
            return;
        }
        $error = false;

        set_error_handler(function () use (&$error) {
            $error = true;
        }, E_WARNING);

        foreach (glob($this->getPath() . '/*.dat') as $file) {
            unlink($file);
        }
        restore_error_handler();

        return ! $error;
    }
541728
boolean remove(BlockInfo blockInfo, RaidCodec codec) {
    if(queues.get(codec).remove(blockInfo)) {
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug(
                                      "BLOCK* NameSystem.RaidMissingBlocks.remove:"
                                      + blockInfo
                                      + " file "+ blockInfo.getINode()
                                      + " codec " + codec.id);
      }
      return true;
    }
    return false;
  }
106020
def remove(in_bam):
    
    if utils.file_exists(in_bam):
        utils.remove_safe(in_bam)
    if utils.file_exists(in_bam + ".bai"):
        utils.remove_safe(in_bam + ".bai")
229773
def remove_if_exists(filename):
    
    try:
        os.unlink(filename)
    except OSError as ex:
        if ex.errno != errno.ENOENT:
            raise
1263148
def _clear_namespace():
    
    ok_names = set(default_backend.__dict__)
    ok_names.update(['gl2', 'glplus'])  # don't remove the module
    NS = globals()
    for name in list(NS.keys()):
        if name.lower().startswith('gl'):
            if name not in ok_names:
                del NS[name]
747020
def delete_namespace(self):
        '''

        '''
        conn = redis.Redis(connection_pool=self.pool)
        keys = conn.keys("%s*" % self._namespace_str)
        for i in xrange(0, len(keys), 10000):
            conn.delete(*keys[i:i+10000])
        logger.debug('tearing down %r', self._namespace_str)
1043019
def delete(self, name):
        
        try:
            super(StaticCompilerFileStorage, self).delete(name)
        except OSError, e:
            if e.errno != errno.ENOENT:
                raise
1349288
def _delete_entry_file(self, entry_name=None, entry=None):
        
        if entry_name is None and entry is None:
            raise RuntimeError("Either `entry_name` or `entry` must be given.")
        elif entry_name is not None and entry is not None:
            raise RuntimeError("Cannot use both `entry_name` and `entry`.")

        if entry_name is not None:
            entry = self.entries[entry_name]
        else:
            entry_name = entry[ENTRY.NAME]

        # FIX: do we also need to check for gzipped files??
        entry_filename = self.entry_filename(entry_name)

        if self.args.write_entries:
            self.log.info("Deleting entry file '{}' of entry '{}'".format(
                entry_filename, entry_name))
            if not os.path.exists(entry_filename):
                self.log.error(
                    "Filename '{}' does not exist".format(entry_filename))
            os.remove(entry_filename)
        else:
            self.log.debug("Not deleting '{}' because `write_entries`"
                           " is False".format(entry_filename))

        return
1121934
public static String cleanFilename(String fileName){
        int lastIndex = fileName.lastIndexOf(".");
        return fileName.substring(0, lastIndex);
    }
1166089
def remove_file_no_raise(file_name, config):
    """"""
    # The removal can be disabled by the config for debugging purposes.
    if config.keep_xml:
        return True

    try:
        if os.path.exists(file_name):
            os.remove(file_name)
    except IOError as error:
        loggers.root.error(
            "Error occurred while removing temporary created file('%s'): %s",
            file_name, str(error))
1171414
def remove_namespace(self, ns_uri):
        """"""
        if not self.contains_namespace(ns_uri):
            return

        ni = self.__ns_uri_map.pop(ns_uri)
        for prefix in ni.prefixes:
            del self.__prefix_map[prefix]
559480
def remove(self, filename):
        
        files = self.get_value('list', [])
        files.remove(filename)
        self.set_value('list', files)
        self.updated.emit()
385002
public void removeNamespace( String prefix, String elementName ) {
      if( prefix == null ){
         prefix = "";
      }
      if( StringUtils.isBlank( elementName ) ){
         rootNamespace.remove( prefix.trim() );
      }else{
         Map nameSpaces = (Map) namespacesPerElement.get( elementName );
         nameSpaces.remove( prefix );
      }
   }
654963
def cleanupFilename(self, name):
        """"""

        context = self.context
        id = ''
        name = name.replace('\\', '/')  # Fixup Windows filenames
        name = name.split('/')[-1]  # Throw away any path part.
        for c in name:
            if c.isalnum() or c in '._':
                id += c

        # Raise condition here, but not a lot we can do about that
        if context.check_id(id) is None and getattr(context, id, None) is None:
            return id

        # Now make the id unique
        count = 1
        while 1:
            if count == 1:
                sc = ''
            else:
                sc = str(count)
            newid = "copy{0:s}_of_{1:s}".format(sc, id)
            if context.check_id(newid) is None \
                    and getattr(context, newid, None) is None:
                return newid
            count += 1
683996
void removePathAndBlocks(String src, List<BlockInfo> blocks) throws IOException {
    // No need for lock until we start accepting requests from clients.
    assert (!nameNode.isRpcServerRunning() || hasWriteLock());
    leaseManager.removeLeaseWithPrefixPath(src);
    removeBlocks(blocks);
  }
136951
public static void removeName(Node n) {
    checkState(n.isFunction() || n.isClass());
    Node originalName = n.getFirstChild();
    Node emptyName = n.isFunction() ? IR.name("") : IR.empty();
    n.replaceChild(originalName, emptyName.useSourceInfoFrom(originalName));
  }