Remove an attachment

@param   mixed  $attachment  File path (string) or object (Swift_Mime_MimeEntity)
@return  object
551557
public function removeAttachment($attachment)
	{
		if (!($attachment instanceof Swift_Mime_MimeEntity))
		{
			$attachment = \Swift_Attachment::fromPath($attachment);
		}

		return $this->detach($attachment);
	}
242279
public function deleteFile($path)
    {
        event(new Events\FileDeleting($path));
        $deleted = $this->disk()->delete($path);
        event(new Events\FileDeleted($path, $deleted));

        return $deleted;
    }
974409
def delete_attachment(self, attachment):
        

        # Get the holding parent of this attachment
        parent = None
        if attachment.getLinkedRequests():
            # Holding parent is an AR
            parent = attachment.getRequest()
        elif attachment.getLinkedAnalyses():
            # Holding parent is an Analysis
            parent = attachment.getAnalysis()

        if parent is None:
            logger.warn(
                "Attachment {} is nowhere assigned. This should never happen!"
                .format(repr(attachment)))
            return False

        # Get the other attachments of the holding parent
        attachments = parent.getAttachment()

        # New attachments to set
        if attachment in attachments:
            attachments.remove(attachment)

        # Set the attachments w/o the current attachments
        parent.setAttachment(attachments)

        retain = False

        # Attachment is referenced by another Analysis
        if attachment.getLinkedAnalyses():
            holder = attachment.getAnalysis()
            logger.info("Attachment {} referenced by {} -> RETAIN"
                        .format(repr(attachment), repr(holder)))
            retain = True

        # Attachment is referenced by another AR
        if attachment.getLinkedRequests():
            holder = attachment.getRequest()
            logger.info("Attachment {} referenced by {} -> RETAIN"
                        .format(repr(attachment), repr(holder)))
            retain = True

        # Delete attachment finally
        if retain is False:
            client = api.get_parent(attachment)
            client.manage_delObjects([attachment.getId(), ])
736039
protected function find_attachment($file)
	{
		foreach($this->get_config('attach_paths') as $path)
		{
			if(is_file($path.$file))
			{
				return $path.$file;
			}
		}

		// No file found?
		throw new \AttachmentNotFoundException('Email attachment not found: '.$file);
	}
713926
public function delete( $file )
	{
		// check for absolut path
		if ( substr( $file, 0, 1 ) == '/' ) 
		{
			return CCFile::delete( $file );
		}
		
		return CCFile::delete( $this->path( $file ) );
	}
1133036
public function withAttachments($attachments)
    {
        if (! is_array($attachments)) {
            $attachments = [$attachments];
        }

        foreach ($attachments as $attachment) {
            $this->withAttachment($attachment);
        }

        return $this;
    }
53941
public function delete($fileName)
    {
        $path = $this->getPathBase($fileName);

        if (!file_exists($path)) {
            return;
        }

        return unlink($path);
    }
921089
public function attach($attach)
    {
        if (is_array($attach)) {
            $this->attach = $attach;
        } else {
            $this->attach = (array) $attach;
        }

        return $this;
    }
147848
public function removeProperty($property)
    {
        $property = $this->resolvePropertyName($property);
        unset($this->properties[$property]);
        return $this;
    }
146569
def remove(self, attachments):
        
        if isinstance(attachments, (list, tuple)):
            attachments = ({attachment.name
                            if isinstance(attachment, BaseAttachment)
                            else attachment for attachment in attachments})
        elif isinstance(attachments, str):
            attachments = {attachments}
        elif isinstance(attachments, BaseAttachment):
            attachments = {attachments.name}
        else:
            raise ValueError('Incorrect parameter type for attachments')

        new_attachments = []
        for attachment in self.__attachments:
            if attachment.name not in attachments:
                new_attachments.append(attachment)
            else:
                if attachment.on_cloud:
                    # add to removed_attachments so later we can delete them
                    self.__removed_attachments.append(
                        attachment)
        self.__attachments = new_attachments
        self._update_parent_attachments()
        self._track_changes()
1212457
public static function remove($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return false;
        }
        return unlink($path);
    }
1274878
def delete_attachment(request, link_field=None, uri=None):
    """"""
    if link_field is None:
        link_field = "record_uri"
    if uri is None:
        uri = record_uri(request)

    # Remove file.
    filters = [Filter(link_field, uri, core_utils.COMPARISON.EQ)]
    storage = request.registry.storage
    file_links, _ = storage.get_all("", FILE_LINKS, filters=filters)
    for link in file_links:
        request.attachment.delete(link['location'])

    # Remove link.
    storage.delete_all("", FILE_LINKS, filters=filters, with_deleted=False)
1242797
def delete_attachment(self, id):
        
        url = self._get_url('attachment/' + str(id))
        return self._session.delete(url)
60313
public function remove($remove)
    {
        $this->cached = null;
        $idx = is_callable($remove) ? 0 : 1;
        $this->stack = array_values(array_filter(
            $this->stack,
            function ($tuple) use ($idx, $remove) {
                return $tuple[$idx] !== $remove;
            }
        ));
    }
792775
static function delete($from)
    {
        $from = self::makeVirtualDir($from, false);
        $result = false;
        if (is_file($from)){
            @unlink($from);
            $result = true;
        }
        self::deleteVirtualDir($from);
        return $result;
    }
1185436
public function disposition($disposition = null)
	{
		if (!is_null($disposition))
		{
			if (strcasecmp($disposition, 'inline') == 0)
			{
				$disposition = 'inline';
			}
			else if (strcasecmp($disposition, 'attachment') == 0)
			{
				$disposition = 'attachment';
			}
			else
			{
				$disposition = 'inline';
			}

			$this->_disposition = $disposition;
		}

		return $this->_disposition;
	}
1165204
public function remove(ExpressionContract $expression)
    {
        $filtered = array_filter($this->_expressions, function ($known) use ($expression) {
            return "$known" != "$expression";
        });

        $this->_expressions = array_values($filtered);

        return $this;
    }