Helper call to Bugzilla.get_attachments. If you want to fetch
        specific attachment IDs, use that function instead
353969
def get_attachments(self, include_fields=None, exclude_fields=None):
        
        if "attachments" in self.__dict__:
            return self.attachments

        data = self.bugzilla.get_attachments([self.bug_id], None,
                include_fields, exclude_fields)
        return data["bugs"][str(self.bug_id)]
821436
def post_attachment(self, bugid, attachment):
        ''''''
        assert type(attachment) is DotDict
        assert 'data' in attachment
        assert 'file_name' in attachment
        assert 'summary' in attachment
        if (not 'content_type' in attachment): attachment.content_type = 'text/plain'
        attachment.ids = bugid
        attachment.data = base64.standard_b64encode(bytearray(attachment.data, 'ascii')).decode('ascii')

        return self._post('bug/{bugid}/attachment'.format(bugid=bugid), json.dumps(attachment))
1129600
def _get_attachment_data(self, id, filename):
        
        uri = '/'.join([self.base_url, self.name, id, 'Attachments', filename])
        return uri, {}, 'get', None, None, False
532396
def get_urls(session, name, data, find_changelogs_fn, **kwargs):
    
    # check if there's a changelog in ../custom/pypi/map.txt
    map = get_url_map()
    if name.lower().replace("_", "-") in map:
        logger.info("Package {name}'s URL is in pypi/map.txt, returning".format(name=name))
        return [map[name.lower().replace("_", "-")]], set()
    # if this package has valid meta data, build up a list of URL candidates we can possibly
    # search for changelogs on
    if "info" in data:
        # add all URLs in pypi's meta data:
        # {
        #   "info": {
        #       "home_page":
        #       "docs_url":
        #       "bugtrack_url":
        #   }
        # }
        candidates = [
            url for url in
            [data["info"].get(attr) for attr in ("home_page", "docs_url", "bugtrack_url")]
            if url
        ]
        # the latest release page on pypi might also contain links, add it
        candidates.append("https://pypi.python.org/pypi/{name}/{latest_release}".format(
            name=name,
            latest_release=next(iter(get_releases(data)))
        ))
        # Check the download URL as well.
        if "download_url" in data:
            candidates.append(data["download_url"])
        if data['info']['description']:
            candidates.extend(changelogs.url_re.findall(data["info"]["description"]))
        return find_changelogs_fn(session=session, name=name, candidates=candidates)
    return set(), set()
867219
function getAttachment(binaryKey) {
    // console.log('Adding binary attachment', binaryKey);
    const index = attachments.findIndex((att) => (att.key === binaryKey));
    if (index !== -1) {
      const result = attachments[index].data;
      // TODO if attachment is sent mulitple times, we shouldn't remove it yet.
      attachments.splice(index, 1);
      return result;
    }
    console.error('Binary attachment key found without matching attachment');
    return null;
  }
1067159
def _extract_links_from_lecture_assets(self, asset_ids):
        
        links = {}

        def _add_asset(name, url, destination):
            filename, extension = os.path.splitext(clean_url(name))
            if extension is '':
                return

            extension = clean_filename(
                extension.lower().strip('.').strip(),
                self._unrestricted_filenames)
            basename = clean_filename(
                os.path.basename(filename),
                self._unrestricted_filenames)
            url = url.strip()

            if extension not in destination:
                destination[extension] = []
            destination[extension].append((url, basename))

        for asset_id in asset_ids:
            for asset in self._get_asset_urls(asset_id):
                _add_asset(asset['name'], asset['url'], links)

        return links
988376
def get_attachment_formset(self, formset_class):
        
        if (
            self.request.forum_permission_handler.can_attach_files(
                self.get_forum(), self.request.user,
            )
        ):
            return formset_class(**self.get_attachment_formset_kwargs())
827356
function loadAttachments (doc, directory, callback) {
  doc._attachments = doc._attachments || {};
  glob('**/*', { cwd: directory }, function (err, files) {
    async.each(files, function (file, done) {
      if (file.indexOf('_') === 0) return done();
      fs.stat(path.join(directory, file), function (err, stat) {
        if (err) return done(err);
        if (stat.isFile()) {
          fs.readFile(path.join(directory, file), function (err, data) {
            if (err) return done(err);
            var ext = file.split('.').pop()
            doc._attachments[file] = {}
            doc._attachments[file]['content_type'] = lookup(ext);
            doc._attachments[file]['data'] = data.toString('base64');
            done();
          });
        } else {
          done();
        }
      });
    }, function (err) {
      callback.call(null, err, doc);
    });
  });
}
317656
public function getAttachments()
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        if (!empty(parent::getAttachments())) {
            /** @noinspection PhpUndefinedMethodInspection */
            return parent::getAttachments();
        }

        $attachments = $this->_storage->getAttachments($this);

        /** @noinspection PhpUndefinedMethodInspection */
        $this->setAttachments($attachments);

        return $attachments;
    }
876266
def get_attachments(self):
        
        # Create a mapping of source ARs for copy
        uids = self.request.form.get("attachment_uids", [])
        return map(self.get_object_by_uid, uids)
958054
def fetch_bug_details(self, bug_ids):
        """"""

        params = {'include_fields': 'product, component, priority, whiteboard, id'}
        params['id'] = bug_ids
        try:
            response = self.session.get(settings.BZ_API_URL + '/rest/bug', headers=self.session.headers,
                                        params=params, timeout=30)
            response.raise_for_status()
        except RequestException as e:
            logger.warning('error fetching bugzilla metadata for bugs due to {}'.format(e))
            return None

        if response.headers['Content-Type'] == 'text/html; charset=UTF-8':
            return None

        data = response.json()
        if 'bugs' not in data:
            return None

        return data['bugs']
724530
def retrieve_info(self):
        """"""

        scheme = urlparse(self.url).scheme
        netloc = urlparse(self.url).netloc
        query = urlparse(self.url).query

        if scheme not in ('http', 'https'):
            return

        for item in query.split('&'):
            if 'id=' in item:
                ticket_id = item.split('=')[1]
                break
        else:
            return

        bugzilla_url = '%s://%s/%s%s' % (scheme, netloc, _URI_BASE, ticket_id)

        result = requests.get(bugzilla_url)
        self.status_code = result.status_code

        if result.status_code == 200:
            tree = ElementTree.fromstring(result.content)

            self.title = tree.findall("./bug/short_desc").pop().text
            self.issue_id = tree.findall("./bug/bug_id").pop().text
            self.reporter = tree.findall("./bug/reporter").pop().text
            self.assignee = tree.findall("./bug/assigned_to").pop().text
            self.status = tree.findall("./bug/bug_status").pop().text
            self.product = tree.findall("./bug/product").pop().text
            self.component = tree.findall("./bug/component").pop().text
            self.created_at = tree.findall("./bug/creation_ts").pop().text
            self.updated_at = tree.findall("./bug/delta_ts").pop().text
            try:
                self.closed_at = (
                    tree.findall("./bug/cf_last_closed").pop().text
                )
            except IndexError:
                # cf_last_closed is present only if the issue has been closed
                # if not present it raises an IndexError, meaning the issue
                # isn't closed yet, which is a valid use case.
                pass
1052753
def fetch_all_bug_details(self, bug_ids):
        """"""
        min = 0
        max = 600
        bugs_list = []
        bug_ids_length = len(bug_ids)

        while bug_ids_length >= min and bug_ids_length > 0:
            data = self.fetch_bug_details(bug_ids[min:max])
            if data:
                bugs_list += data
            min = max
            max = max + 600

        return {bug['id']: bug for bug in bugs_list} if len(bugs_list) else None
147845
def get_attachment_data(self, attachment):
        
        f = attachment.getAttachmentFile()
        attachment_type = attachment.getAttachmentType()
        attachment_keys = attachment.getAttachmentKeys()
        filename = f.filename
        filesize = self.get_filesize(f)
        mimetype = f.getContentType()
        report_option = attachment.getReportOption()

        return {
            "obj": attachment,
            "attachment_type": attachment_type,
            "attachment_keys": attachment_keys,
            "file": f,
            "uid": api.get_uid(attachment),
            "filesize": filesize,
            "filename": filename,
            "mimetype": mimetype,
            "report_option": report_option,
        }
712102
function getFormIds(req, res, next) {
  var params = {
    appId: req.params.projectid || req.params.id
  };

  forms.getAppFormsForApp(_.extend(req.connectionOptions, params), function(err, appFormResult) {
    if (err) {
      return next(err);
    }

    //Only Want The Form Ids
    req.appformsResultPayload = {
      data: _.map(_.compact(appFormResult.forms), function(form) {
        return form._id.toString();
      }),
      type: constants.resultTypes.formProjects
    };

    next();
  });
}
47568
def get_snippet_content(snippet_name, **format_kwargs):
    
    filename = snippet_name + '.snippet'
    snippet_file = os.path.join(SNIPPETS_ROOT, filename)
    if not os.path.isfile(snippet_file):
        raise ValueError('could not find snippet with name ' + filename)
    ret = helpers.get_file_content(snippet_file)
    if format_kwargs:
        ret = ret.format(**format_kwargs)
    return ret
421689
def macros_attachment_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/macros/attachments/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)