Remove files from model.
427813
public function detachFile($page, $file)
    {
        $filesIds = $page->files->pluck('id')->toArray();
        $pivotData = [];
        $position = 1;
        foreach ($filesIds as $fileId) {
            if ($fileId != $file->id) {
                $pivotData[$fileId] = ['position' => $position++];
            }
        }
        $page->files()->sync($pivotData);
        $this->forgetCache();
    }
893454
def delete(self):
        """"""
        self.__class__.objects.filter(pk=self.pk).delete()
537812
private function doDelete()
    {
        if (!$this->model->trashed()) {
            $this->model->delete();
            event(new ModelSoftDelete($this));

            return;
        }

        $this->model->forceDelete();
        event(new ModelDelete($this));
    }
1204059
public function cleanUp()
    {
        $this->filesystem->remove($this->compressedArchivePath);
        $this->filesystem->remove($this->outputPath);
    }
34655
def cleanup(self):
        """"""
        if self.image:
            try:
                self.image.close()
            except Exception:
                pass
        if (self.outtmp is not None):
            try:
                os.unlink(self.outtmp)
            except OSError as e:
                self.logger.warning("Failed to cleanup tmp output file %s"
                                    % (self.outtmp))
1110418
def remove_file(self):
        """"""
        if not self.fullpath or not self.archived:
            raise RuntimeError("""Can't remove a non-archived data product""")
        try:
            os.remove(self.fullpath)
        except:
            print("Error removing %s: %s" % (self.fullpath, sys.exc_info()[1]))
1297258
def rmrf(items, verbose=True):
    ""
    if isinstance(items, str):
        items = [items]

    for item in items:
        if verbose:
            print("Removing {}".format(item))
        shutil.rmtree(item, ignore_errors=True)
        # rmtree doesn't remove bare files
        try:
            os.remove(item)
        except FileNotFoundError:
            pass
898864
public function delete($model)
    {
        if ($model->files) {
            $model->files->each(function (File $file) {
                $file->delete();
            });
        }
        if ($model->delete()) {
            return true;
        }

        return false;
    }
26878
def delete_file(self, filename):
        """"""
        log.info("deleting %s", filename)
        if not self.dry_run:
            os.unlink(filename)
368363
def remove_attributes(self, model):
        
        for child in model.children():
            if 'nn.modules.container' in str(type(child)):
                self.remove_attributes(child)
            else:
                try:
                    del child.x
                except AttributeError:
                    pass
                try:
                    del child.y
                except AttributeError:
                    pass
255327
def filedict(self, kv):
        """"""

        k, v = kv
        if v is not None:
            self.__files.update({k: v})
        else:
            with suppress(KeyError):
                del self.__files[k]
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)
1172859
function cleanUpModel(bbDocumentModel) {
    var x;
    for (x in bbDocumentModel) {
        if (Object.keys(bbDocumentModel[x]).length === 0) {
            delete bbDocumentModel[x];
        }
    }
    var data = bbDocumentModel.data;
    for (x in data) {
        if (Object.keys(data[x]).length === 0) {
            delete data[x];
        }
    }
}
545856
def _delete_images(self, instance):
        """"""
        UserMediaImage.objects.filter(
            content_type=ContentType.objects.get_for_model(instance),
            object_id=instance.pk,
            user=instance.user,
        ).delete()
1214153
def clean_source_files(self):
        """"""

        self.build_source_files.file(File.BSFILE.SOURCESCHEMA).remove()
        self.build_source_files.file(File.BSFILE.SCHEMA).remove()
        self.commit()
269073
def remove(*models)
      @connection.delete_by_id(
        models.map { |model| Adapters::InstanceAdapter.adapt(model).index_id }
      )
    end
858917
async def drop_model_tables(models, **drop_table_kwargs):
    """"""
    for m in reversed(sort_models_topologically(models)):
        await m.drop_table(**drop_table_kwargs)