Replace records contained in `iterable` with their corresponding IDs:

        >>> groups = list(odoo.env.user.groups_id)
        >>> records2ids(groups)
        [1, 2, 3, 14, 17, 18, 19, 7, 8, 9, 5, 20, 21, 22, 23]
189084
def records2ids(iterable):
    
    def record2id(elt):
        """If `elt` is a record, return its ID."""
        if isinstance(elt, Model):
            return elt.id
        return elt
    return [record2id(elt) for elt in iterable]
925456
def each_object_id(collection):
    """"""
    c_path = collection_path(collection)
    paths = glob('%s/*.%s' % (c_path, _ext))
    for path in paths:
        match = regex.match(r'.+/(.+)\.%s$' % _ext, path)
        yield match.groups()[0]
801484
def get_group_by_id(self, group_id) -> typing.Optional['Group']:
        
        for group in self.groups:

            if group.group_id == group_id:
                return group

        return None
474107
def _grouped(iterable, n):
        
        args = [iter(iterable)] * n
        return [[e for e in t if not e is None] for t in zip_longest(*args, fillvalue=None)]
236429
def group_records_by_type(records):
    """"""
    update_records, delete_records = [], []
    for r in records:
        if isinstance(r, str):
            break

        if r['detail']['eventName'] in UPDATE_EVENTS:
            update_records.append(r)
        else:
            delete_records.append(r)
    return update_records, delete_records
1299028
def update(self, iterable):
        
        inserted_any = False
        for header in iterable:
            key = header.lower()
            if key not in self._set:
                self._headers.append(header)
                self._set.add(key)
                inserted_any = True
        if inserted_any and self.on_update is not None:
            self.on_update(self)
74991
def records( self ):
        
        if ( self.isGroupingActive() ):
            self._records.setGroupBy(self.currentGrouping())
        else:
            self._records.setGroupBy(None)
        return self._records
132148
def filter_by_ids(original_list, ids_to_filter):
    """"""
    if not ids_to_filter:
        return original_list

    return [i for i in original_list if i['id'] in ids_to_filter]
1304469
def selected(self, ids):
        
        # Cleanup the ID list
        if self.get_field_name() == 'pk':
            ids = filter(lambda x: "{}".format(x).isdigit(), copy(ids))
        else:
            ids = filter(lambda x: len("{}".format(x)) > 0, copy(ids))
        # Prepare the QS
        # TODO: not contextually filtered, check if it's possible at some point
        qs = self.get_model_queryset().filter(
            **{'{}__in'.format(self.get_field_name()): ids})
        result = []
        for item in qs:
            item_repr = self.item(item)
            result.append(
                (item_repr['value'], item_repr['label'])
            )
        return result
661713
def map_ids(queries,frm='ACC',to='ENSEMBL_PRO_ID',
            organism_taxid=9606,test=False):
    
    url = 'https://www.uniprot.org/uploadlists/'
    params = {
    'from':frm,
    'to':to,
    'format':'tab',
    'organism':organism_taxid,    
    'query':' '.join(queries),
    }
    response = requests.get(url, params=params)
    if test:
        print(response.url)
    if response.ok:
        df=pd.read_table(response.url)
        df.columns=[frm,to]
        return df
    else:
        print('Something went wrong ', response.status_code)
1135050
def update(self, uid: int, flag_set: Iterable[Flag],
               op: FlagOp = FlagOp.REPLACE) -> FrozenSet[Flag]:
        
        orig_set = self._flags.get(uid, frozenset())
        new_flags = op.apply(orig_set, self & flag_set)
        if new_flags:
            self._flags[uid] = new_flags
        else:
            self._flags.pop(uid, None)
        return new_flags
1026494
def remove_isoforms(ids):
    
    key = lambda x: x.rsplit(".", 1)[0]
    iso_number = lambda x: get_number(x.split(".")[-1])
    ids = sorted(ids, key=key)
    newids = []
    for k, ii in groupby(ids, key=key):
        min_i = min(list(ii), key=iso_number)
        newids.append(min_i)
    return newids
149493
def _convert(cls, record):
        
        if not record:
            return {}

        converted_dict = {}
        for field in cls.conversion:
            key = field[0]
            if len(field) >= 2 and field[1]:
                converted_key = field[1]
            else:
                converted_key = key
            if len(field) >= 3 and field[2]:
                conversion_method = field[2]
            else:
                conversion_method = cls.default_conversion_method
            if len(field) >= 4:
                converter = field[3]
            else:
                converter = None
            try:
                value = conversion_method(record[key])
            except KeyError:
                continue
            if converter:
                value = converter._convert_internal(value)
            if converted_key is APPEND:
                if isinstance(value, list):
                    for v in value:
                        converted_dict.update(v)
                else:
                    converted_dict.update(value)
            else:
                converted_dict[converted_key] = value
        return converted_dict
72902
def __search_record(self, task_group_id):
		
		for i in range(len(self.__records)):
			record = self.__records[i]
			if record.task_group_id() == task_group_id:
				yield record, i
1073180
def uniq_by_id(self, records):
        """"""
        uniq = []
        keys = set()
        for rec in records:
            rec_id = rec[self._id_field]
            if rec_id not in keys:
                uniq.append(rec)
                keys.add(rec_id)
        return uniq
446309
def rel2id(self, xs):
        
        if isinstance(xs, list):
            return [self._rel2id[x] for x in xs]
        return self._rel2id[xs]
1268330
def _rebuild_key_ids(self):
        """"""
        self._key_ids = collections.defaultdict(list)
        for i, x in enumerate(self._pairs):
            self._key_ids[x[0]].append(i)