Returns a description of the bug inside a given container.
489310
def bug(self, container: Container) -> Bug:
        
        name = container.bug
        return self.__installation.bugs[name]
723048
def _parse_status(bug_el):
    """"""
    bug = Bugreport()

    # plain fields
    for field in ('originator', 'subject', 'msgid', 'package', 'severity',
                  'owner', 'summary', 'location', 'source', 'pending',
                  'forwarded'):
        setattr(bug, field, _parse_string_el(bug_el(field)))

    bug.date = datetime.utcfromtimestamp(float(bug_el('date')))
    bug.log_modified = datetime.utcfromtimestamp(float(bug_el('log_modified')))
    bug.tags = [_uc(tag) for tag in str(bug_el('tags')).split()]
    bug.done = _parse_bool(bug_el('done'))
    bug.archived = _parse_bool(bug_el('archived'))
    bug.unarchived = _parse_bool(bug_el('unarchived'))
    bug.bug_num = int(bug_el('bug_num'))
    bug.mergedwith = [int(i) for i in str(bug_el('mergedwith')).split()]
    bug.blockedby = [int(i) for i in str(bug_el('blockedby')).split()]
    bug.blocks = [int(i) for i in str(bug_el('blocks')).split()]

    bug.found_versions = [_uc(str(el)) for el in
                          bug_el('found_versions').children() or []]
    bug.fixed_versions = [_uc(str(el)) for el in
                          bug_el('fixed_versions').children() or []]
    affects = [_f for _f in str(bug_el('affects')).split(',') if _f]
    bug.affects = [_uc(a).strip() for a in affects]
    # Also available, but unused or broken
    # bug.keywords = [_uc(keyword) for keyword in
    #                 str(bug_el('keywords')).split()]
    # bug.fixed = _parse_crappy_soap(tmp, "fixed")
    # bug.found = _parse_crappy_soap(tmp, "found")
    # bug.found_date = \
    #     [datetime.utcfromtimestamp(i) for i in tmp["found_date"]]
    # bug.fixed_date = \
    #     [datetime.utcfromtimestamp(i) for i in tmp["fixed_date"]]
    return bug
749807
def _report_container_state_metrics(self, pod_list, instance_tags):
        """"""
        if pod_list.get('expired_count'):
            self.gauge(self.NAMESPACE + '.pods.expired', pod_list.get('expired_count'), tags=instance_tags)

        for pod in pod_list['items']:
            pod_name = pod.get('metadata', {}).get('name')
            pod_uid = pod.get('metadata', {}).get('uid')

            if not pod_name or not pod_uid:
                continue

            for ctr_status in pod['status'].get('containerStatuses', []):
                c_name = ctr_status.get('name')
                cid = ctr_status.get('containerID')
                if not c_name or not cid:
                    continue

                if self.pod_list_utils.is_excluded(cid, pod_uid):
                    continue

                tags = tagger.tag('%s' % cid, tagger.ORCHESTRATOR) + instance_tags

                restart_count = ctr_status.get('restartCount', 0)
                self.gauge(self.NAMESPACE + '.containers.restarts', restart_count, tags)

                for (metric_name, field_name) in [('state', 'state'), ('last_state', 'lastState')]:
                    c_state = ctr_status.get(field_name, {})

                    for state_name in ['terminated', 'waiting']:
                        state_reasons = WHITELISTED_CONTAINER_STATE_REASONS.get(state_name, [])
                        self._submit_container_state_metric(metric_name, state_name, c_state, state_reasons, tags)
756882
def inspect_container(self, container_alias):

        '''
            
        '''

        title = '%s.inspect_container' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'container_alias': container_alias
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # send inspect command
        import json
        sys_command = 'docker inspect %s' % container_alias
        output_dict = json.loads(self.command(sys_command))
        container_settings = output_dict[0]

        return container_settings
982131
void bugMessage(Throwable ex) {
        log.printLines(PrefixKind.JAVAC, "msg.bug", JavaCompiler.version());
        ex.printStackTrace(log.getWriter(WriterKind.NOTICE));
    }
386075
def post_bug(self, bug):
        ''''''
        assert type(bug) is DotDict
        assert 'product' in bug
        assert 'component' in bug
        assert 'summary' in bug
        if (not 'version' in bug): bug.version = 'other'
        if (not 'op_sys' in bug): bug.op_sys = 'All'
        if (not 'platform' in bug): bug.platform = 'All'

        return self._post('bug', json.dumps(bug))
69420
function(container) {

    // Inspect the container
    return kbox.engine.inspect(container)

    // Return summary of info
    .then(function(data) {

      // Get service name =
      var name = data.Config.Labels['com.docker.compose.service'];
      var project = data.Config.Labels['com.docker.compose.project'];

      // Defaults
      var serviceSummary = {
        name: name,
        project: project
      };

      // See if these are proxied services
      var proxied = _.find(config.pluginconfig.services, function(data, key) {
        return key === name;
      });
      if (!_.isEmpty(proxied)) {
        serviceSummary.url = _.flatten(getServiceUrls(proxied));
      }

      // Add in database credentials
      // @todo: get engine ip from provider.getIp()
      if (name === 'db') {

        // Get port from inspect data
        var portInfo = _.get(data, 'NetworkSettings.Ports.3306/tcp');
        var host = [app.name, app.domain].join('.');

        // Build a creds array
        serviceSummary.external_connection_info = {
          database: app.env.getEnv('KALABOX_APP_PANTHEON_DB_NAME'),
          user: app.env.getEnv('KALABOX_APP_PANTHEON_DB_USER'),
          password: app.env.getEnv('KALABOX_APP_PANTHEON_DB_PASSWORD'),
          host: host,
          port: portInfo[0].HostPort
        };
      }

      return serviceSummary;

    });

  }
291045
def get_container_for(self, instance):
        
        if IReferenceAnalysis.providedBy(instance):
            return api.get_uid(instance.getSample())
        return instance.getRequestUID()
130920
@Override
    public final void reportBug(@Nonnull BugInstance bugInstance) {
        if (isRelaxed()) {
            doReportBug(bugInstance);
            return;
        }
        if (priorityThreshold == 0) {
            throw new IllegalStateException("Priority threshold not set");
        }

        ClassAnnotation primaryClass = bugInstance.getPrimaryClass();
        if (primaryClass != null && !AnalysisContext.currentAnalysisContext().isApplicationClass(primaryClass.getClassName())) {
            LOG.debug("AbstractBugReporter: Filtering due to non-primary class");
            return;
        }
        int priority = bugInstance.getPriority();
        int bugRank = bugInstance.getBugRank();
        if (priority <= priorityThreshold && bugRank <= rankThreshold) {
            doReportBug(bugInstance);
        } else {
            if (priority <= priorityThreshold) {
                LOG.debug("AbstractBugReporter: Filtering due to priorityThreshold {} > {}", priority,
                        priorityThreshold);
            } else {
                LOG.debug("AbstractBugReporter: Filtering due to rankThreshold {} > {}", bugRank, rankThreshold);
            }
        }
    }
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)
467773
def inspect(self, refresh=True):
        
        if refresh or not self._inspect_data:
            ident = self._id or self.name
            if not ident:
                raise ConuException("This container does not have a valid identifier.")
            self._inspect_data = self.d.inspect_container(ident)
        return self._inspect_data
411225
public String debugInfo(Object key) {
      EntryPosition entry = temporaryTable.get(key);
      if (entry != null) {
         return "temporaryTable: " + entry;
      } else {
         try {
            entry = index.getPosition(key, marshaller.objectToByteBuffer(key));
            return "index: " + entry;
         } catch (Exception e) {
            log.debugf(e, "Cannot debug key %s", key);
            return "exception: " + e;
         }
      }
   }
628708
def search_bugs(self, terms):
        ''''''
        params = ''
        for i in terms:
            k = i.popitem()
            params = '{p}&{new}={value}'.format(p=params, new=quote_url(k[0]),
                        value=quote_url(k[1]))
        return DotDict(self._get('bug', params=params))
861929
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "FCBL_FIELD_COULD_BE_LOCAL", justification = "False positives occur when state is maintained across callbacks")
    @Override
    public void visitCode(Code obj) {
        try {
            Method m = getMethod();
            if (m.isPublic() && !m.isSynthetic() && "clone".equals(m.getName()) && (m.getArgumentTypes().length == 0)) {

                String returnClsName = m.getReturnType().getSignature();
                returnClsName = SignatureUtils.stripSignature(returnClsName);
                if (!clsName.equals(returnClsName)) {
                    if (Values.DOTTED_JAVA_LANG_OBJECT.equals(returnClsName)) {
                        bugReporter.reportBug(
                                new BugInstance(this, BugType.CU_CLONE_USABILITY_OBJECT_RETURN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this));
                    } else {
                        JavaClass clonedClass = Repository.lookupClass(returnClsName);
                        if (!cls.instanceOf(clonedClass)) {
                            bugReporter.reportBug(
                                    new BugInstance(this, BugType.CU_CLONE_USABILITY_MISMATCHED_RETURN.name(), HIGH_PRIORITY).addClass(this).addMethod(this));
                        }
                    }
                }

                ExceptionTable et = m.getExceptionTable();

                if ((et != null) && (et.getLength() > 0)) {

                    throwsCNFE = false;
                    if (prescreen(m)) {
                        stack.resetForMethodEntry(this);
                        super.visitCode(obj);
                    }

                    if (!throwsCNFE) {
                        bugReporter.reportBug(new BugInstance(this, BugType.CU_CLONE_USABILITY_THROWS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this));
                    }
                }
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        }
    }
683670
function validateContainer (container) {
  if (!container) {
    return Boom.create(504, 'instance has no container');
  }
  if (container.error) {
    return Boom.create(504, 'instance container has error', container.error);
  }
  if (container.inspect.error) {
    return Boom.create(503, 'instance inspect failed (try again)', container.inspect.error);
  }
  return null;
}
1001651
def instance_contains(container, item):
    """"""
    return item in (member for _, member in inspect.getmembers(container))
610549
def _get_container_state(self):
        
        try:
            result = yield from self.manager.query("GET", "containers/{}/json".format(self._cid))
        except DockerError:
            return "exited"

        if result["State"]["Paused"]:
            return "paused"
        if result["State"]["Running"]:
            return "running"
        return "exited"