List metadata for a given issue key.
168259
def issue(ctx, accountable, issue_key):
    
    accountable.issue_key = issue_key
    if not ctx.invoked_subcommand:
        issue = accountable.issue_meta()
        headers = issue.keys()
        rows = [headers, [v for k, v in issue.items()]]
        print_table(SingleTable(rows))
651797
def metadata():
    """"""
    with open(os.path.join(charm_dir(), 'metadata.yaml')) as md:
        return yaml.safe_load(md)
602691
def list_key_policies(key_id, limit=None, marker=None, region=None, key=None,
                      keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if key_id.startswith('alias/'):
        key_id = _get_key_id(key_id)
    r = {}
    try:
        key_policies = conn.list_key_policies(
            key_id,
            limit=limit,
            marker=marker
        )
        # TODO: handle limit, marker and truncation automatically.
        r['key_policies'] = key_policies['PolicyNames']
    except boto.exception.BotoServerError as e:
        r['error'] = __utils__['boto.get_error'](e)
    return r
1361358
def metadata_index_json(self):
        """"""
        try:
            return op.join(self.metadata_dir, 'INDEX.json')
        except FileNotFoundError:
            return op.join(self.metadata_dir, 'INDEX_JSON')
334576
def get_issues():
        """"""
        issues = []
        for entry in Logger.journal:
            if entry.level >= WARNING:
                issues.append(entry)
        return issues
1142829
def partition_metadata(self, partition_key):
        
        resp = self.r_session.get(self.database_partition_url(partition_key))
        resp.raise_for_status()
        return response_to_json_dict(resp)
770860
def index(self, key):
        
        if isinstance(key, str):
            for idx, (item, quality) in enumerate(self):
                if self._value_matches(key, item):
                    return idx
            raise ValueError(key)
        return list.index(self, key)
871913
def get_metadata(self, key) -> str:
        
        return self.metadata[key] if key in self.metadata else None
1021002
def list(self, request):
        """"""
        query = get_query_params(request).get("search", "")
        results = []
        base = self.model.get_base_class()
        doctypes = indexable_registry.families[base]
        for doctype, klass in doctypes.items():
            name = klass._meta.verbose_name.title()
            if query.lower() in name.lower():
                results.append(dict(
                    name=name,
                    doctype=doctype
                ))
                results.sort(key=lambda x: x["name"])
        return Response(dict(results=results))
1317793
def keys(request):
    """"""
    iDisplayStart = parse_int_param(request, 'iDisplayStart')
    iDisplayLength = parse_int_param(request, 'iDisplayLength')
    sEcho = parse_int_param(request, 'sEcho')
    iSortCol_0 = parse_int_param(request, 'iSortCol_0')
    sSortDir_0 = request.GET.get('sSortDir_0', 'asc')
    sSearch = request.GET.get('sSearch')

    columns = ['key', 'email', 'calls', 'latest_call', 'issued_on']
    qry = Key.objects
    if sSearch not in (None, ''):
        qry = qry.filter(Q(key__icontains=sSearch)
                         | Q(email__icontains=sSearch)
                         | Q(name__icontains=sSearch)
                         | Q(org_name__icontains=sSearch)
                         | Q(org_url__icontains=sSearch))
    qry = qry.values('key', 'email', 'issued_on').annotate(calls=Sum('reports__calls'),
                                                           latest_call=Max('reports__date'))
    qry = qry.filter(calls__isnull=False)
    qry = exclude_internal_keys(qry)
    # TODO: Add multi-column sorting
    if iSortCol_0 not in (None, ''):
        sort_col_field = columns[iSortCol_0]
        sort_spec = '{dir}{col}'.format(dir='-' if sSortDir_0 == 'desc' else '',
                                        col=sort_col_field)
        qry = qry.order_by(sort_spec)

    result = {
        'iTotalRecords': Key.objects.count(),
        'iTotalDisplayRecords': qry.count(),
        'sEcho': sEcho,
        'aaData': [[k['key'],
                    '<a href="{0}">{1}</a>'.format(reverse('key_analytics', args=(k['key'], )), k['email']),
                    k['calls'],
                    k['latest_call'].isoformat(),
                    k['issued_on'].date().isoformat()]
                   for k in qry[iDisplayStart:iDisplayStart+iDisplayLength]]
    }
    return HttpResponse(content=json.dumps(result), status=200, content_type='application/json')
604679
def issuetypes(accountable, project_key):
    
    projects = accountable.issue_types(project_key)
    headers = sorted(['id', 'name', 'description'])
    rows = []
    for key, issue_types in sorted(projects.items()):
        for issue_type in issue_types:
            rows.append(
                [key] + [v for k, v in sorted(issue_type.items())
                         if k in headers]
            )
    rows.insert(0, ['project_key'] + headers)
    print_table(SingleTable(rows))
543530
@RequestMapping(value = "configuration/{configuration:.*}/issue/{key}", method = RequestMethod.GET)
    public Resource<OntrackSVNIssueInfo> issueInfo(@PathVariable String configuration, @PathVariable String key) {
        return Resource.of(
                svnInfoService.getIssueInfo(configuration, key),
                uri(on(getClass()).issueInfo(configuration, key))
        ).withView(Build.class);
    }
523760
def get_metadata_or_fail(metadata_key):
  
  try:
    return http_get_metadata(metadata_key)
  except IOError as error:
    fail("Exception in http_get_metadata {} {}".format(metadata_key, repr(error)))
759613
def get_build_metadata(key):
    '''
    '''
    headers = {"Metadata-Flavor":"Google"}
    url = "http://metadata.google.internal/computeMetadata/v1/instance/attributes/%s" %(key)        
    response = requests.get(url=url,headers=headers)
    if response.status_code == 200:
        return response.text
    return None
497623
def doc_metadata(doc):
    """"""

    r = doc['Root'].as_dict()
    r.update(doc['Contacts'].as_dict())
    r['author'] = r.get('author', r.get('creator', r.get('wrangler')))

    return r
1141086
def _process_meta(self, response):
        """"""
        for key in self.META_ENVELOPES:
            self.meta[key] = response.get(key)
765047
public String[] getIssueKeys() {
        Issues issues = getAnnotation(Issues.class);
        if (issues == null) {
            return new String[0];
        }
        List<String> keys = new ArrayList<>();
        for (Issue issue : issues.value()) {
            keys.add(issue.value());
        }
        return keys.toArray(new String[keys.size()]);
    }