Retrieve a list of attachments associated with this Xero object.
974272
def _get_attachments(self, id):
        """"""
        uri = '/'.join([self.base_url, self.name, id, 'Attachments']) + '/'
        return uri, {}, 'get', None, None, False
253197
def attach_attachment(self, analysis, attachment):
        
        if not attachment:
            return
        if isinstance(attachment, list):
            for attach in attachment:
                self.attach_attachment(analysis, attach)
            return
        # current attachments
        an_atts = analysis.getAttachment()
        atts_filenames = [att.getAttachmentFile().filename for att in an_atts]
        if attachment.getAttachmentFile().filename not in atts_filenames:
            an_atts.append(attachment)
            logger.info(
                "Attaching %s to %s" % (attachment.UID(), analysis))
            analysis.setAttachment([att.UID() for att in an_atts])
            analysis.reindexObject()
        else:
            self.warn("Attachment %s was not linked to analysis %s" %
                      (attachment.UID(), analysis))
679792
public java.util.List<AttachmentContent> getAttachmentsContent() {
        if (attachmentsContent == null) {
            attachmentsContent = new com.amazonaws.internal.SdkInternalList<AttachmentContent>();
        }
        return attachmentsContent;
    }
618659
public function get_attachments() {

        global $CFG;

        require_once($CFG->libdir.'/filelib.php');

        $syscontext = context_system::instance();

        $fs = get_file_storage();
        $files = $fs->get_area_files($syscontext->id, 'blog', 'attachment', $this->id);

        // Adding a blog_entry_attachment for each non-directory file.
        $attachments = array();
        foreach ($files as $file) {
            if ($file->is_directory()) {
                continue;
            }
            $attachments[] = new blog_entry_attachment($file, $this->id);
        }

        return $attachments;
    }
1258368
private static function gatherAttachments(PartInterface $part): array
    {
        $attachments = [];
        foreach ($part->getParts() as $childPart) {
            if ($childPart instanceof Attachment) {
                $attachments[] = $childPart;
            }
            if ($childPart->hasChildren()) {
                $attachments = \array_merge($attachments, self::gatherAttachments($childPart));
            }
        }

        return $attachments;
    }
1264051
def get(self):
        
        attachment = {}
        if self.file_content is not None:
            attachment["content"] = self.file_content.get()

        if self.file_type is not None:
            attachment["type"] = self.file_type.get()

        if self.file_name is not None:
            attachment["filename"] = self.file_name.get()

        if self.disposition is not None:
            attachment["disposition"] = self.disposition.get()

        if self.content_id is not None:
            attachment["content_id"] = self.content_id.get()
        return attachment
192810
def attachment(self, attachment):
        
        if isinstance(attachment, list):
            for a in attachment:
                self.add_attachment(a)
        else:
            self.add_attachment(attachment)
1268928
def attachments(resource_id)
      http.get(attachment_endpoint(resource_id)) do |response|
        Rexpense::Entities::AttachmentCollection.build response
      end
    end
1327886
public function urlsForAttachment($attachmentName)
    {
        $urls = [];

        if (isset($this->attachedFiles[ $attachmentName ])) {
            $attachment = $this->attachedFiles[ $attachmentName ];

            foreach ($attachment->variants(true) as $variant) {
                $urls[ $variant ] = $attachment->url($variant);
            }
        }

        return $urls;
    }
450220
def parse_attachments(self, node):
        

        if 'name' in node.lattrib:
            name = node.lattrib['name']
        else:
            self.raise_error('<Attachments> must specify a name.')

        if 'type' in node.lattrib:
            type_ = node.lattrib['type']
        else:
            self.raise_error("Attachment '{0}' must specify a type.",
                             name)

        description = node.lattrib.get('description', '')
        self.current_component_type.add_attachments(Attachments(name, type_, description))
412752
def get_files(files, extnames=['.root']):
    """"""

    files_out = []
    for f in files:

        mime = mimetypes.guess_type(f)
        if os.path.splitext(f)[1] in extnames:
            files_out += [f]
        elif mime[0] == 'text/plain':
            files_out += list(np.loadtxt(f, unpack=True, dtype='str'))
        else:
            raise Exception('Unrecognized input type.')

    return files_out
1152004
def get_image_files(c:PathOrStr, check_ext:bool=True, recurse=False)->FilePathList:
    ""
    return get_files(c, extensions=(image_extensions if check_ext else None), recurse=recurse)
1028030
def to_api_data(self):
        
        return [attachment.to_api_data() for attachment in self.__attachments if
                attachment.on_cloud is False]
1206153
public Attachment getAttachmentMetaData(String assetId, String attachmentId) throws IOException, BadVersionException, RequestFailureException {
        // At the moment can only get all attachments
        Asset ass = getAsset(assetId);
        List<Attachment> allAttachments = ass.getAttachments();
        for (Attachment attachment : allAttachments) {
            if (attachmentId.equals(attachment.get_id())) {
                return attachment;
            }
        }

        // Didn't find it so just return null
        return null;
    }
1111163
protected function detectPaperclipAttachments()
    {
        $model = $this->model();

        if ( ! ($model instanceof PaperclippableInterface)) {
            return [];
        }

        $files = $model->getAttachedFiles();

        $attachments = [];

        /** @var PaperclipAttachmentInstance[] $files */
        foreach ($files as $attribute => $file) {

            $variants = $file->variants();

            $normalizedVariants = [];

            foreach ($variants as $variant) {

                if ($variant === 'original') {
                    continue;
                }

                $normalizedVariants[ $variant ] = $this->extractPaperclipVariantInfo($file, $variant);
            }

            $attachments[ $attribute ] = new PaperclipAttachmentData([
                'image'      => (is_array($variants) && count($variants) > 1),
                'resizes'    => array_pluck($normalizedVariants, 'dimensions'),
                'variants'   => $variants,
                'extensions' => array_pluck($normalizedVariants, 'extension'),
                'types'      => array_pluck($normalizedVariants, 'mimeType'),
            ]);
        }

        return $attachments;
    }
394573
def attachments
      attachments = Attachment.from_response client.get("/cards/#{id}/attachments")
      MultiAssociation.new(self, attachments).proxy
    end
781308
def multipart_content(*files):
    
    outer = MIMEMultipart()
    for fname in files:
        mtype = get_type(fname)
        maintype, subtype = mtype.split('/', 1)
        with open(fname) as f:
            msg = MIMEText(f.read(), _subtype=subtype)
        msg.add_header('Content-Disposition', 'attachment', 
                       filename=os.path.basename(fname))
        outer.attach(msg)
    return outer.as_string()