Return the identities from an item
434494
def get_identities(self, item):
        

        item = item['data']
        for identity in self.issue_roles:
            if item[identity]:
                user = self.get_sh_identity(item[identity])
                if user:
                    yield user
1176926
def item_sectie_adapter(obj, request):
    
    return {
        'id': obj.id,
        'afdeling': {
            'id': obj.afdeling.id,
            'naam': obj.afdeling.naam,
            'gemeente': {
                'id': obj.afdeling.gemeente.id,
                'naam': obj.afdeling.gemeente.naam
            },
        },
        'centroid': obj.centroid,
        'bounding_box': obj.bounding_box
    }
263193
def get_obj_id(self, item):
        
        if item is not None:
            if isinstance(item, six.string_types):
                return item
            elif hasattr(item, 'id'):
                return item.id
1331966
def get_identities(self, item):
        """"""

        category = item['category']
        item = item['data']

        if category == "issue":
            identity_types = ['user', 'assignee']
        elif category == "pull_request":
            identity_types = ['user', 'merged_by']
        else:
            identity_types = []

        for identity in identity_types:
            if item[identity]:
                # In user_data we have the full user data
                user = self.get_sh_identity(item[identity + "_data"])
                if user:
                    yield user
811304
def identity_map(self):
        
        pk = self.identity_attributes()
        values = {}
        for name in pk:
            values[name] = getattr(self, name)
        return values
384639
def get_identities(self, identity=None, attrs=None):
        
        resp = self.request('GetIdentities')

        if 'identity' in resp:
            identities = resp['identity']
            if type(identities) != list:
                identities = [identities]

            if identity or attrs:
                wanted_identities = []

                for u_identity in [
                        zobjects.Identity.from_dict(i) for i in identities]:
                    if identity:
                        if isinstance(identity, zobjects.Identity):
                            if u_identity.name == identity.name:
                                return [u_identity]
                        else:
                            if u_identity.name == identity:
                                return [u_identity]

                    elif attrs:
                        for attr, value in attrs.items():
                            if (attr in u_identity._a_tags and
                                    u_identity._a_tags[attr] == value):
                                wanted_identities.append(u_identity)
                return wanted_identities
            else:
                return [zobjects.Identity.from_dict(i) for i in identities]
        else:
            return []
97639
def find_by_name(self, item_name, items_list, name_list=None):
        
        if not name_list:
            names = [item.name for item in items_list if item]
        else:
            names = name_list
        if item_name in names:
            ind = names.index(item_name)
            return items_list[ind]
        return False
984923
def get_item_key(self, item):
        """"""
        try:
            ret = item[item['key']]
        except KeyError:
            logger.error("No 'key' available in {}".format(item))
        if isinstance(ret, list):
            return ret[0]
        else:
            return ret
1223508
def __get_genestr(self, itemid):
        """"""
        if self.id2symbol is not None:
            symbol = self.id2symbol.get(itemid, None)
            if symbol is not None:
                return symbol
        if isinstance(itemid, int):
            return str(itemid)
        return itemid
757070
def get_list_w_id2nts(ids, id2nts, flds, dflt_null=""):
    """"""
    combined_nt_list = []
    # 1. Instantiate namedtuple object
    ntobj = cx.namedtuple("Nt", " ".join(flds))
    # 2. Fill dict with namedtuple objects for desired ids
    for item_id in ids:
        # 2a. Combine various namedtuples into a single namedtuple
        nts = [id2nt.get(item_id) for id2nt in id2nts]
        vals = _combine_nt_vals(nts, flds, dflt_null)
        combined_nt_list.append(ntobj._make(vals))
    return combined_nt_list
624303
def _return_object(self, container, item_name):
        """"""
        coll = container.get_collection()
        for item in coll:
            if item.name == item_name:
                return item
41573
def ids(self):
        """"""
        as_list = [seq.description.split()[0] for seq in self]
        as_set = frozenset(as_list)
        assert len(as_set) == len(as_list)
        return as_set
821876
def get_item_ids_metadata(self):
        """"""
        metadata = dict(self._item_ids_metadata)
        metadata.update({'existing_id_values': self.my_osid_object_form._my_map['itemIds']})
        return Metadata(**metadata)
333968
def get_identities(self, item):
        """"""

        user = self.get_sh_identity(item, self.get_field_author())
        yield user
1210865
def get_identities(self, item):
        

        # question
        user = self.get_sh_identity(item, self.get_field_author())
        yield user

        # answers
        if 'answers' in item['data']:
            for answer in item['data']['answers']:
                # avoid "answered_by" : "This post is a wiki" corner case
                if type(answer['answered_by']) is dict:
                    user = self.get_sh_identity(answer['answered_by'])
                    yield user
                if 'comments' in answer:
                    for comment in answer['comments']:
                        commenter = self.get_sh_identity(comment)
                        yield commenter
76077
def get_identities(self, item):
        

        user = self.get_sh_identity(item, self.get_field_author())
        yield user

        # Get the identities from the releases
        for release in item['data']['releases']:
            user = self.get_sh_identity(release['module'], self.get_field_author())
            yield user
98861
def get_identities(self, item):
        """"""

        item = item['data']

        for field in ["assignee", "reporter", "creator"]:
            if field not in item["fields"]:
                continue
            if item["fields"][field]:
                user = self.get_sh_identity(item["fields"][field])
                yield user

        comments = item.get('comments_data', [])
        for comment in comments:
            if 'author' in comment and comment['author']:
                user = self.get_sh_identity(comment['author'])
                yield user
            if 'updateAuthor' in comment and comment['updateAuthor']:
                user = self.get_sh_identity(comment['updateAuthor'])
                yield user