Remove Documents
331639
public function remove($criteria = array(), array $options = array())
    {
        if ($criteria) {
            $query = new Query($criteria, $this);
            $query->compress();
            $criteria = $query->compressed;
        }

        return $this->native->remove($criteria, $options);
    }
1024047
def remove_files(self, *filenames):
        """"""
        filenames = list_strings(filenames)

        for dirpath, dirnames, fnames in os.walk(self.workdir):
            for fname in fnames:
                if fname in filenames:
                    filepath = os.path.join(dirpath, fname)
                    os.remove(filepath)
1030126
function (options, callback) {
  var Deleter = {}
  // Delete all docs with the IDs found in deleteBatch
  Deleter.deleteBatch = function (deleteBatch, APICallback) {
    tryDeleteBatch(options, deleteBatch, function (err) {
      return APICallback(err)
    })
  }
  // Flush the db (delete all entries)
  Deleter.flush = function (APICallback) {
    flush(options, function (err) {
      return APICallback(err)
    })
  }
  return callback(null, Deleter)
}
1047751
function destroyDocument(params) {
  var collection = collections[params.collection]

  if (collection === undefined) {
    return false
  }

  var doc = collection[params.id]

  delete collection[params.id]

  eventEmitter.emit('documentDestroyed', params.collection, doc)

  return true
}
235895
def remove(self):
        """"""
        import shutil
        printtime('Removing large and/or temporary files', self.start)
        removefolder = list()
        for sample in self.metadata:
            # Use os.walk to iterate through all the files in the sample output directory
            for path, dirs, files in os.walk(sample.general.outputdirectory):
                for item in files:
                    # Use regex to find files to remove
                    if re.search(".fastq$", item) or re.search(".fastq.gz$", item) or re.search(".bam$", item) \
                            or re.search(".bt2$", item) or re.search(".tab$", item) or re.search("^before", item) \
                            or re.search("^baitedtargets", item) or re.search("_combined.csv$", item) \
                            or re.search("^scaffolds", item) or re.search(".fastg$", item) or re.search(".gfa$", item) \
                            or re.search(".bai$", item) or 'coregenome' in path or 'prophages' in path:
                        # Keep the baitedtargets.fa, core genome, and merged metagenome files
                        if item != 'baitedtargets.fa' and not re.search("coregenome", item) \
                                and not re.search("paired", item):
                            # Remove the unnecessary files
                            try:
                                os.remove(os.path.join(path, item))
                            except IOError:
                                pass
        # Clear out the folders
        for folder in removefolder:
            try:
                shutil.rmtree(folder)
            except (OSError, TypeError):
                pass
523659
def delete(self, docids):
        """"""
        logger.debug("deleting %i documents from %s" % (len(docids), self))
        deleted = 0
        for docid in docids:
            try:
                del self.id2pos[docid]
                deleted += 1
                del self.id2sims[docid]
            except:
                pass
        self.id2sims.sync()
        if deleted:
            logger.info("deleted %i documents from %s" % (deleted, self))
        self.update_mappings()
1077745
def _flush(self):
        
        remove = self.store.query(_RemoveDocument)
        documentIdentifiers = list(remove.getColumn("documentIdentifier"))
        if VERBOSE:
            log.msg("%s/%d removing %r" % (self.store, self.storeID, documentIdentifiers))
        reader = self.openReadIndex()
        map(reader.remove, documentIdentifiers)
        reader.close()
        remove.deleteFromStore()
183211
private void removeOldFiles()
    {
        if (_retainDays>0)
        {
            Calendar retainDate = Calendar.getInstance();
            retainDate.add(Calendar.DATE,-_retainDays);
            int borderYear = retainDate.get(java.util.Calendar.YEAR);
            int borderMonth = retainDate.get(java.util.Calendar.MONTH) + 1;
            int borderDay = retainDate.get(java.util.Calendar.DAY_OF_MONTH);

            File file= new File(_filename);
            File dir = new File(file.getParent());
            String fn=file.getName();
            int s=fn.toLowerCase().indexOf(YYYY_MM_DD);
            if (s<0)
                return;
            String prefix=fn.substring(0,s);
            String suffix=fn.substring(s+YYYY_MM_DD.length());

            String[] logList=dir.list();
            for (int i=0;i<logList.length;i++)
            {
                fn = logList[i];
                if(fn.startsWith(prefix)&&fn.indexOf(suffix,prefix.length())>=0)
                {        
                    try
                    {
                        StringTokenizer st = new StringTokenizer (fn.substring(prefix.length(), prefix.length()+YYYY_MM_DD.length()), "_.");
                        int nYear = Integer.parseInt(st.nextToken());
                        int nMonth = Integer.parseInt(st.nextToken());
                        int nDay = Integer.parseInt(st.nextToken());
                        
                        if (nYear<borderYear ||
                            (nYear==borderYear && nMonth<borderMonth) ||
                            (nYear==borderYear &&
                             nMonth==borderMonth &&
                             nDay<=borderDay))
                        {
                            log.info("Log age "+fn);
                            new File(dir,fn).delete();
                        }
                    }
                    catch(Exception e)
                    {
                        if (log.isDebugEnabled())
                            e.printStackTrace();
                    }
                }
            }
        }
    }
682479
def remove(self):
        """"""
        num, sp, newfile = 0, "", []
        if os.path.isfile(self.filename):
            with open(self.filename, "r") as r:
                oldfile = r.read().splitlines()
                for line in oldfile:
                    if self.number:
                        num += 1
                        sp = ": "
                    if self.case_ins:
                        line = line.lower()
                    if self.ignore_blank and not line:
                        newfile.append(line)
                    elif line not in newfile:
                        newfile.append(line)
                    else:
                        if (self.args[0] in self.options[4:5] or
                                self.args[0] in self.options[6:7]):
                            if num == 0:
                                num = str()
                            print("{0}{1}{2}".format(num, sp, line))
            if self.args[0] not in self.options[6:7]:
                with open(self.filename, "w") as w:
                    for line in newfile:
                        w.write(line + "\n")
        else:
            self.not_access()
1310493
public function remove_files() {
        $fs = get_file_storage();
        $files = $fs->get_external_files($this->id);
        foreach ($files as $storedfile) {
            $storedfile->delete();
        }
    }
281518
public function deleteContent()
  {
    $files = glob($this->folderPath . '*');
    foreach ($files as $file) {
      if (is_file($file)) {
        unlink($file);
      }
    }
  }
979420
def delete_many(cls, documents):
        """"""

        # Ensure all documents have been converted to frames
        frames = cls._ensure_frames(documents)

        all_count = len(documents)
        assert len([f for f in frames if '_id' in f._document]) == all_count, \
                "Can't delete documents without `_id`s"

        # Send delete signal
        signal('delete').send(cls, frames=frames)

        # Prepare the documents to be deleted
        ids = [f._id for f in frames]

        # Delete the documents
        cls.get_collection().delete_many({'_id': {'$in': ids}})

        # Send deleted signal
        signal('deleted').send(cls, frames=frames)
616136
function cleanDocs(docs) {
  for (var i = 0; i < docs.length; i++) {
    var doc = docs[i];
    if (doc._deleted) {
      delete doc._attachments; // ignore atts for deleted docs
    } else if (doc._attachments) {
      // filter out extraneous keys from _attachments
      var atts = Object.keys(doc._attachments);
      for (var j = 0; j < atts.length; j++) {
        var att = atts[j];
        doc._attachments[att] = pouchdbUtils.pick(doc._attachments[att],
          ['data', 'digest', 'content_type', 'length', 'revpos', 'stub']);
      }
    }
  }
}
175418
def clear_document(self):
        
        self._components.clear()
        self._sequences.clear()
        self._namespaces.clear()
        self._models.clear()
        self._modules.clear()
        self._collections.clear()
        self._annotations.clear()
        self._functional_component_store.clear()
        self._collection_store.clear()
542302
def remove(self, document):
        
        assert '_id' in document, 'Document must have an id'
        self.db.execute("delete from %s where id = ?" % self.name, (document['_id'],))
846575
def delete_files(self, selections) -> None:
        """"""
        try:
            currentpath = self.currentpath
            for selection in selections:
                name = str(selection)
                if name == 'complete':
                    continue
                if not name.endswith('.py'):
                    name += '.py'
                path = os.path.join(currentpath, name)
                os.remove(path)
        except BaseException:
            objecttools.augment_excmessage(
                f'While trying to remove the network files of '
                f'selections `{selections}`')
1268371
public function deleteDocumentFile()
    {
        if ($this->hasCategory('document')) {
            // Get file path
            $path = __DIR__."/../../../web".$this->getDocument();
            // Delete file if exists
            if (is_file($path)) {
                unlink($path);
            }
        }
    }