Retrieves a single bug by it's Launchpad bug_id

            :param bug_id: The Launchpad id for the bug.
199678
def get_bug_by_id(self, bug_id):
        
        uri = '{base}/bugs/{bug_id}'.format(base=self.BASE_URI, bug_id=bug_id)
        resp = self._client.get(uri, model=models.Bug)

        return resp
260229
def provision(self,
                  bug: Bug,
                  *,
                  plugins: Optional[List[Tool]] = None
                  ) -> Container:
        
        if plugins is None:
            plugins = []

        logger.info("provisioning container for bug: %s", bug.name)
        endpoint = 'bugs/{}/provision'.format(bug.name)
        payload = {
            'plugins': [p.to_dict() for p in plugins]
        }  # type: Dict[str, Any]
        r = self.__api.post(endpoint, json=payload)

        if r.status_code == 200:
            container = Container.from_dict(r.json())
            logger.info("provisioned container (id: %s) for bug: %s",
                               container.uid,
                               bug.name)
            return container

        if r.status_code == 404:
            raise KeyError("no bug registered with given name: {}".format(bug.name))

        self.__api.handle_erroneous_response(r)
169707
def usable_id(cls, id):
        
        try:
            # id is maybe a sshkey name
            qry_id = cls.from_name(id)
            if not qry_id:
                qry_id = int(id)
        except DuplicateResults as exc:
            cls.error(exc.errors)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
611690
def get_bugs_summaries(self, bugids):
        
        payload = {'ids': bugids, 'include_fields': ['id', 'summary']}
        d = self.call('Bug.get', payload)
        d.addCallback(self._parse_bugs_callback)
        return d
789143
def get_startup(self, id_):
    
    return _get_request(_STARTUP.format(c_api=_C_API_BEGINNING,
                                        api=_API_VERSION,
                                        id_=id_,
                                        at=self.access_token))
1330990
def get(cls, id):
        

        # cached?
        if CACHE:
            if id in _cache['VRF']:
                log.debug('cache hit for VRF %d' % id)
                return _cache['VRF'][id]
            log.debug('cache miss for VRF %d' % id)

        try:
            vrf = VRF.list({ 'id': id })[0]
        except IndexError:
            raise NipapNonExistentError('no VRF with ID ' + str(id) + ' found')

        _cache['VRF'][id] = vrf
        return vrf
616211
def is_installed(self, bug: Bug) -> bool:
        
        r = self.__api.get('bugs/{}/installed'.format(bug.name))

        if r.status_code == 200:
            answer = r.json()
            assert isinstance(answer, bool)
            return answer

        # TODO bug not registered on server
        if r.status_code == 404:
            raise KeyError("no bug found with given name: {}".format(bug.name))

        self.__api.handle_erroneous_response(r)
671005
def get_bugs_simple(self, bugids):
        
        payload = {'ids': bugids}
        d = self.call('Bug.get', payload)
        d.addCallback(self._parse_bugs_callback)
        return d
1242363
def get_bug_report():
        
        platform_info = BugReporter.get_platform_info()
        module_info = {
            'version': hal_version.__version__,
            'build': hal_version.__build__
        }

        return {
            'platform': platform_info,
            'pyhal': module_info
        }
18324
def issue(self, issue_instance_id):
        
        with self.db.make_session() as session:
            selected_issue = (
                session.query(IssueInstance)
                .filter(IssueInstance.id == issue_instance_id)
                .scalar()
            )

            if selected_issue is None:
                self.warning(
                    f"Issue {issue_instance_id} doesn't exist. "
                    "Type 'issues' for available issues."
                )
                return

            self.sources = self._get_leaves_issue_instance(
                session, issue_instance_id, SharedTextKind.SOURCE
            )

            self.sinks = self._get_leaves_issue_instance(
                session, issue_instance_id, SharedTextKind.SINK
            )

        self.current_issue_instance_id = int(selected_issue.id)
        self.current_frame_id = -1
        self.current_trace_frame_index = 1  # first one after the source

        print(f"Set issue to {issue_instance_id}.")
        if int(selected_issue.run_id) != self.current_run_id:
            self.current_run_id = int(selected_issue.run_id)
            print(f"Set run to {self.current_run_id}.")
        print()

        self._generate_trace_from_issue()
        self.show()
933668
def get_project_by_id(self, project_id):
        
        return self._create_item_response(
            self.data_service.get_project_by_id(project_id),
            Project)
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']
627601
def get_issue_comment(self, id):
        
        assert isinstance(id, (int, long)), id
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self._parentUrl(self.issue_url) + "/comments/" + str(id)
        )
        return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
841837
def _get_one(self, id):
        
        try:
            return self._to_dict(models.User.objects.get(pk=id))
        except models.User.DoesNotExist:
            raise errors.NotFound()
1287776
def reboot_droplet(self, droplet_id):
        
        if not droplet_id:
            raise DOPException('droplet_id is required to reboot a droplet!')
        json = self.request('/droplets/%s/reboot' % droplet_id, method='GET')
        status = json.get('status')
        if status == 'OK':
            return json.get('event_id')
        else:
            message = json.get('message')
            raise DOPException('[%s]: %s' % (status, message))
987095
def get_gist(self, id):
        
        assert isinstance(id, (str, unicode)), id
        headers, data = self.__requester.requestJsonAndCheck(
            "GET",
            "/gists/" + id
        )
        return github.Gist.Gist(self.__requester, headers, data, completed=True)
992533
def updateattachmentflags(self, bugid, attachid, flagname, **kwargs):
        
        # Bug ID was used for the original custom redhat API, no longer
        # needed though
        ignore = bugid

        flags = {"name": flagname}
        flags.update(kwargs)
        update = {'ids': [int(attachid)], 'flags': [flags]}

        return self._proxy.Bug.update_attachment(update)