Return a list with distinct elements of "objs" (different ids).
    Preserves order.
970726
def _get_distinct_objs(objs):
    
    ids = set()
    res = []
    for obj in objs:
        if not id(obj) in ids:
            ids.add(id(obj))
            res.append(obj)
    return res
1197574
function(obj) {
		const keys = Object.keys(obj).sort(function(key1, key2) {
			return key1 === 'id' ? false : key1 > key2;
		});
		return keys;
	}
627783
def uniqueify(my_list: Any) -> List[Any]:
    """"""
    if sys.version_info >= (3, 6):
        # An implementation specific detail of py3.6 is the retention of order
        # within a dictionary. In py3.7 this becomes the documented behaviour.
        return list(dict.fromkeys(my_list))

    # Slower method of order preserving unique list in older python versions
    seen = set()
    return [x for x in my_list if x not in seen and not seen.add(x)]
1071089
def objref(obj):
    """"""
    ref = _objrefs.get(obj)
    if ref is None:
        clsname = obj.__class__.__name__.split('.')[-1]
        seqno = _lastids.setdefault(clsname, 1)
        ref = '{}-{}'.format(clsname, seqno)
        _objrefs[obj] = ref
        _lastids[clsname] += 1
    return ref
998425
def _build_jss_object_list(self, response, obj_class):
        """"""
        response_objects = [item for item in response
                            if item is not None and
                            item.tag != "size"]
        objects = [
            JSSListData(obj_class, {i.tag: i.text for i in response_object},
                        self) for response_object in response_objects]

        return JSSObjectList(self, obj_class, objects)
979033
def unique_list_dicts(dlist, key):
    

    return list(dict((val[key], val) for val in dlist).values())
125515
def unique (inlist):
    
    uniques = []
    for item in inlist:
        if item not in uniques:
            uniques.append(item)
    return uniques
352987
def get_object_id(obj):
    """"""
    try:
        idx = objIds.index(obj)
        return idx + 1
    except ValueError:
        objIds.append(obj)
        return len(objIds)
241731
def _remove_duplicates(objects):
    
    seen = {}
    result = []
    for item in objects:
        marker = id(item)
        if marker in seen:
            continue
        seen[marker] = 1
        result.append(item)
    return result
978933
def get_uniques(l):
    
    result = []

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

    return result
1028450
def flat_list(input_list):
    

    """
    x = input_list
    if isinstance(x, list):
        return [a for i in x for a in flat_list(i)]
    else:
        return [x]
948258
def duplicate_object_hook(ordered_pairs):
    """"""
    json_dict = {}
    for key, val in ordered_pairs:
        existing_val = json_dict.get(key)
        if not existing_val:
            json_dict[key] = val
        else:
            if isinstance(existing_val, list):
                existing_val.append(val)
            else:
                json_dict[key] = [existing_val, val]

    return json_dict
1371818
def ids(self, content_ids, object_ids):
        """"""
        result = []

        content_ids = self.split(content_ids, False)
        object_ids = self.split(object_ids)

        for cid in content_ids:
            result.append('{}:{}'.format(cid, ':'.join(object_ids)))

        return result
612037
def unique(_list):
    
    ret = []

    for item in _list:
        if item not in ret:
            ret.append(item)

    return ret
486673
def get_many(self, ids):
        """"""
        return [self.instance(id, **fields)
                    for id, fields in zip(ids, self.api.mget(ids))]
558284
def ensure_list(obj):
        
        if not obj:
            return []
        elif isinstance(obj, (str, unicode, bytes, bytearray)):
            return [obj]
        elif hasattr(obj, '__iter__') or hasattr(obj, '__getitem__'):
            return list(obj)
        else:
            return [obj]
1029290
def get_for_model(self, obj):
        """"""
        qs = Tag.objects.language(get_language())
        qs = qs.filter(
            tagged_items__content_type=ctype_models.ContentType.objects.get_for_model(obj))  # NOQA
        return qs.distinct()