Returns a list of dicts containing the name, value and critical value of
    any extension contained in a csr object.
506620
def _get_csr_extensions(csr):
    '''
    
    '''
    ret = OrderedDict()

    csrtempfile = tempfile.NamedTemporaryFile()
    csrtempfile.write(csr.as_pem())
    csrtempfile.flush()
    csryaml = _parse_openssl_req(csrtempfile.name)
    csrtempfile.close()
    if csryaml and 'Requested Extensions' in csryaml['Certificate Request']['Data']:
        csrexts = csryaml['Certificate Request']['Data']['Requested Extensions']

        if not csrexts:
            return ret

        for short_name, long_name in six.iteritems(EXT_NAME_MAPPINGS):
            if long_name in csrexts:
                csrexts[short_name] = csrexts[long_name]
                del csrexts[long_name]
        ret = csrexts
    return ret
337447
def keys(self):
        
        return_value = []
        for s in self.serializers:
            return_value += s.content_type
        return return_value
801979
def getCaCerts(self):
        '''
        
        '''
        retn = []

        path = s_common.genpath(self.certdir, 'cas')

        for name in os.listdir(path):
            if not name.endswith('.crt'):
                continue

            full = s_common.genpath(self.certdir, 'cas', name)
            retn.append(self._loadCertPath(full))

        return retn
1204746
def _value_list_to_sciobj_dict(
    sciobj_value_list, lookup_list, lookup_dict, generate_dict
):
    """"""

    sciobj_dict = {}

    # for sciobj_value, lookup_str in zip(sciobj_value_list, lookup_list):
    lookup_to_value_dict = {k: v for k, v in zip(lookup_list, sciobj_value_list)}

    for field_name, r_dict in lookup_dict.items():
        if r_dict["lookup_str"] in lookup_to_value_dict.keys():
            sciobj_dict[field_name] = lookup_to_value_dict[r_dict["lookup_str"]]

    for field_name, annotate_dict in generate_dict.items():
        for final_name, generate_func in annotate_dict["generate_dict"].items():
            sciobj_dict[field_name] = generate_func(lookup_to_value_dict)

    return sciobj_dict
548716
def list_extensions(request):
    
    neutron_api = neutronclient(request)
    try:
        extensions_list = neutron_api.list_extensions()
    except exceptions.ServiceCatalogException:
        return {}
    if 'extensions' in extensions_list:
        return tuple(extensions_list['extensions'])
    else:
        return ()
818471
def as_dict(self):
        
        ce_list_dict = [{str(cn): [ce.as_dict() if ce is not None else None for ce in ce_dict[cn]]
                         for cn in ce_dict} if ce_dict is not None else None for ce_dict in self.ce_list]
        nbs_sets_dict = [{str(cn): [nb_set.as_dict() for nb_set in nb_sets]
                          for cn, nb_sets in site_nbs_sets.items()}
                         if site_nbs_sets is not None else None
                         for site_nbs_sets in self.neighbors_sets]
        info_dict = {key: val for key, val in self.info.items() if key not in ['sites_info']}
        info_dict['sites_info'] = [{'nb_sets_info': {str(cn): {str(inb_set): nb_set_info
                                                               for inb_set, nb_set_info in cn_sets.items()}
                                                     for cn, cn_sets in site_info['nb_sets_info'].items()},
                                    'time': site_info['time']} if 'nb_sets_info' in site_info else {}
                                   for site_info in self.info['sites_info']]

        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "voronoi": self.voronoi.as_dict(),
                "valences": self.valences,
                "sites_map": self.sites_map,
                "equivalent_sites": [[ps.as_dict() for ps in psl] for psl in self.equivalent_sites],
                "ce_list": ce_list_dict,
                "structure": self.structure.as_dict(),
                "neighbors_sets": nbs_sets_dict,
                "info": info_dict}
865654
def list(gandi, id, altnames, csr, cert, all_status, status, dates, limit):
    
    options = {'items_per_page': limit}

    if not all_status:
        options['status'] = ['valid', 'pending']

    output_keys = ['cn', 'plan']

    if id:
        output_keys.append('id')

    if status:
        output_keys.append('status')

    if dates:
        output_keys.extend(['date_created', 'date_end'])

    if altnames:
        output_keys.append('altnames')

    if csr:
        output_keys.append('csr')

    if cert:
        output_keys.append('cert')

    result = gandi.certificate.list(options)
    for num, cert in enumerate(result):
        if num:
            gandi.separator_line()
        cert['plan'] = package_desc(gandi, cert['package'])
        output_cert(gandi, cert, output_keys)

    return result
269718
def get_extensions(self, support=None):
        
        return [x for x in self.extensions.values() if support
                and support in x.supported or not support]
518328
def _list_class_vars(cls, exclude=None):
    
    cvars = {k: v for k, v in vars(cls).items()
             if not k.startswith('_')}
    cvars = deepcopy(cvars)
    if exclude is not None:
        for e in exclude:
            cvars.pop(e)
    return cvars
1066939
def _descriptor_names(self):
        

        descriptor_names = []

        for name in dir(self):
            try:
                attr = getattr(type(self), name)

                if isinstance(attr, DJANGO_RELATED_FIELD_DESCRIPTOR_CLASSES):
                    descriptor_names.append(name)

            except AttributeError:
                pass

        return descriptor_names
689907
def list_by_x(self, item=None):
        
        prs = self._processors

        if item is None or item == "cid":  # Default.
            res = [(cid, [prs[cid]]) for cid in sorted(prs.keys())]

        elif item in ("type", "extensions"):
            res = list_by_x(prs.values(), item)
        else:
            raise ValueError("keyword argument 'item' must be one of "
                             "None, 'cid', 'type' and 'extensions' "
                             "but it was '%s'" % item)
        return res
1149436
def _getExtensionKVArgs(self, aliases=None):
        
        if aliases is None:
            aliases = NamespaceMap()

        ax_args = {}

        for type_uri, values in self.data.iteritems():
            alias = aliases.add(type_uri)

            ax_args['type.' + alias] = type_uri
            ax_args['count.' + alias] = str(len(values))

            for i, value in enumerate(values):
                key = 'value.%s.%d' % (alias, i + 1)
                ax_args[key] = value

        return ax_args
736065
def iter_extensions(extension):
    
    for _, ext in inspect.getmembers(extension, is_extension):
        for item in iter_extensions(ext):
            yield item
        yield ext
737844
def to_dict(cls, acl):
        
        return {
            "perms": acl.perms,
            "id": {
                "scheme": acl.id.scheme,
                "id": acl.id.id
            }
        }
573701
def serializable_attributes(self):
        

        if hasattr(self, 'blacklist_attributes'):
            return [attr for attr in self.attributes if attr not in
                    self.blacklist_attributes]
        else:
            return self.attributes
1154909
def get_es_mappings(self):
        

        es_mappings = json.loads(requests.get(self.mapping_url).text)
        es_mappings = {"_".join(key.split("_")[:-1]): value['mappings'] \
                       for key, value in es_mappings.items()}
        return es_mappings
403795
def items(self):
    
    return [(value_descriptor.name, value_descriptor.number)
            for value_descriptor in self._enum_type.values]