Return list of lists of idents grouped by shared rank
177080
def _group(self, taxslice):
        ''''''
        res = []
        while taxslice:
            taxref, lident = taxslice.pop()
            if lident == '':
                res.append(([taxref], lident))
            else:
                # identify idents in the same group and pop from taxslice
                i = 0
                group = []
                while i < len(taxslice):
                    if taxslice[i][1] == lident:
                        group.append(taxslice.pop(i)[0])
                    else:
                        i += 1
                group.append(taxref)
                res.append((group, lident))
        return res
366996
def grouped_mappings(self,id):
        
        g = self.get_xref_graph()
        m = {}
        for n in g.neighbors(id):
            [prefix, local] = n.split(':')
            if prefix not in m:
                m[prefix] = []
            m[prefix].append(n)
        return m
978933
def get_uniques(l):
    
    result = []

    for i in l:
        if i not in result:
            result.append(i)

    return result
290901
def get_ids(cs):
    """"""
    records = []
    for c in cs:
        records.append({k: c[k] for k in c if k in {'names', 'labels'}})
    return records
949256
def getPublicAttrs(obj):
    ''
    return [k for k in dir(obj) if not k.startswith('_') and not callable(getattr(obj, k))]
746038
def get_unique_groups(input_list):
    """"""
    out_list = []
    for item in input_list:
        if item not in out_list:
            out_list.append(item)
    return out_list
1259905
def items(self):
        """"""
        return [(k, unidecode.unidecode(v))
                for k, v in self.identity_dict.items()]
1226774
def _group_matching(tlist, cls):
    """"""
    opens = []
    tidx_offset = 0
    for idx, token in enumerate(list(tlist)):
        tidx = idx - tidx_offset

        if token.is_whitespace:
            # ~50% of tokens will be whitespace. Will checking early
            # for them avoid 3 comparisons, but then add 1 more comparison
            # for the other ~50% of tokens...
            continue

        if token.is_group and not isinstance(token, cls):
            # Check inside previously grouped (i.e. parenthesis) if group
            # of different type is inside (i.e., case). though ideally  should
            # should check for all open/close tokens at once to avoid recursion
            _group_matching(token, cls)
            continue

        if token.match(*cls.M_OPEN):
            opens.append(tidx)

        elif token.match(*cls.M_CLOSE):
            try:
                open_idx = opens.pop()
            except IndexError:
                # this indicates invalid sql and unbalanced tokens.
                # instead of break, continue in case other "valid" groups exist
                continue
            close_idx = tidx
            tlist.group_tokens(cls, open_idx, close_idx)
            tidx_offset += close_idx - open_idx
558262
def shared_otuids(groups):
    
    for g in sorted(groups):
        print("Number of OTUs in {0}: {1}".format(g, len(groups[g].results["otuids"])))
    number_of_categories = len(groups)
    shared = defaultdict()
    for i in range(2, number_of_categories+1):
        for j in combinations(sorted(groups), i):
            combo_name = " & ".join(list(j))
            for grp in j:
                # initialize combo values
                shared[combo_name] = groups[j[0]].results["otuids"].copy()
                """iterate through all groups and keep updating combo OTUIDs with set
                intersection_update"""
                for grp in j[1:]:
                    shared[combo_name].intersection_update(groups[grp].results["otuids"])
    return shared
53937
def get_hierarchies_by_ids(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinLookupSession.get_bins_by_ids
        catalogs = self._get_provider_session('hierarchy_lookup_session').get_hierarchies_by_ids(*args, **kwargs)
        cat_list = []
        for cat in catalogs:
            cat_list.append(Hierarchy(self._provider_manager, cat, self._runtime, self._proxy))
        return HierarchyList(cat_list)
896755
def list(self):
        """"""
        return [x["_id"] for x in self._db.system.js.find(projection=["_id"])]
1328082
def get_list(self, ids: List[str]) -> List[Account]:
        
        query = (
            self.query
            .filter(Account.guid.in_(ids))
        )
        return query.all()
170903
def getanymentions(idf, anidfobject):
    """"""
    name = anidfobject.obj[1]
    foundobjs = []
    keys = idfobjectkeys(idf)
    idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
    for idfobjects in idfkeyobjects:
        for idfobject in idfobjects:
            if name.upper() in [item.upper() 
                                    for item in idfobject.obj 
                                        if isinstance(item, basestring)]:
                foundobjs.append(idfobject)
    return foundobjs
712621
def group_by_source(self):
        """"""
        from collections import defaultdict
        docs = defaultdict(list)

        for k, v in self.items():
            if 'source' in v:
                docs[v.source].append(dict(v.items()))

        return docs
1307128
def get_gid_list(user, include_default=True):
    '''
    
    '''
    if HAS_GRP is False or HAS_PWD is False:
        return []
    gid_list = list(
        six.itervalues(
            get_group_dict(user, include_default=include_default)
        )
    )
    return sorted(set(gid_list))
597309
def related_identifiers(self):
        """"""
        yield dict(
            identifier=u'https://github.com/{0}/tree/{1}'.format(
                self.repository['full_name'], self.release['tag_name']
            ),
            relation='isSupplementTo',
        )
822256
def _hierarchy(self):
        ''''''
        self.hierarchy = {}
        for rank in self.taxonomy:
            # extract lineage idents for this rank
            taxslice = self._slice(level=self.taxonomy.index(rank))
            # group idents by shared group at this rank
            self.hierarchy[rank] = self._group(taxslice)