Converts a list of EDBObjects into a list of JPAObjects
6393
public static List<JPAObject> convertEDBObjectsToJPAObjects(List<EDBObject> objects) {
        List<JPAObject> result = new ArrayList<JPAObject>();
        for (EDBObject object : objects) {
            result.add(convertEDBObjectToJPAObject(object));
        }
        return result;
    }
419915
def dumpable_obj(obj):
    ''' '''

    if isinstance(obj, list):
        _return_list = []
        for item in obj:
            if isinstance(item, list):
                _return_list.append(dumpable_obj(item))
            elif isinstance(item, set):
                _return_list.append(list(item))
            elif isinstance(item, dict):
                _return_list.append(dumpable_obj(item))
            else:
                try:
                    json.dumps(item)
                    _return_list.append(item)
                except:
                    _return_list.append(str(type(item)))
        return _return_list
    elif isinstance(obj, set):
        return list(obj)
    elif isinstance(obj, dict):
        _return_obj = {}
        for key, item in obj.items():
            if isinstance(item, list):
                _return_obj[key] = dumpable_obj(item)
            elif isinstance(item, set):
                _return_obj[key] = list(item)
            elif isinstance(item, dict):
                _return_obj[key] = dumpable_obj(item)
            else:
                try:
                    json.dumps(item)
                    _return_obj[key] = item
                except:
                    _return_obj[key] = str(type(item))
        return _return_obj
    else:
        try:
            json.dumps(obj)
            return obj
        except:
            return str(type(obj))
1026927
def to_db(self, value):
        

        # ensure value is valid
        self.validate(value)

        assert isinstance(value, list)
        value = list(value)
        for i, v in enumerate(value):
            value[i] = self.value_to_db(v)

        # return result
        assert isinstance(value, list)
        return value
1327019
private <T extends D6Model> T[] toArray(List<Object> objectList, Class<T> modelClazz) {

    if (objectList == null) {
      return (T[]) Array.newInstance(modelClazz, 0);
    }

    final T[] resultObjects = objectList.toArray((T[]) Array.newInstance(modelClazz, 0));

    return resultObjects;
  }
616345
private List<Object> convertToObjectKeys(Collection keys) {
        if (keys == null || keys.isEmpty()) {
            return Collections.emptyList();
        }
        final List<Object> objectKeys = new ArrayList<>(keys.size());
        for (Object key : keys) {
            objectKeys.add(toObject(key));
        }
        return objectKeys;
    }
661775
def make_list(obj, cast=True):
    
    if isinstance(obj, list):
        return list(obj)
    if isinstance(obj, types.GeneratorType):
        return list(obj)
    if isinstance(obj, (tuple, set)) and cast:
        return list(obj)
    else:
        return [obj]
31782
private List<String> convertEDBObjectList(List<EDBObject> objects) {
        List<String> oids = new ArrayList<>();
        for (EDBObject object : objects) {
            oids.add(object.getOID());
        }
        return oids;
    }
85210
def _as_list(obj):
    """"""
    if obj is None:
        return None
    elif isinstance(obj, string_types):
        return [obj]
    elif isinstance(obj, tuple):
        return list(obj)
    elif not hasattr(obj, '__len__'):
        return [obj]
    else:
        return obj
836902
private Object convertEDBObjectToUncheckedModel(Class<?> model, EDBObject object) {
        if (!checkEDBObjectModelType(object, model)) {
            return null;
        }
        filterEngineeringObjectInformation(object, model);
        List<OpenEngSBModelEntry> entries = new ArrayList<>();
        for (PropertyDescriptor propertyDescriptor : getPropertyDescriptorsForClass(model)) {
            if (propertyDescriptor.getWriteMethod() == null
                    || propertyDescriptor.getName().equals(ModelUtils.MODEL_TAIL_FIELD_NAME)) {
                continue;
            }
            Object value = getValueForProperty(propertyDescriptor, object);
            Class<?> propertyClass = propertyDescriptor.getPropertyType();
            if (propertyClass.isPrimitive()) {
                entries.add(new OpenEngSBModelEntry(propertyDescriptor.getName(), value, ClassUtils
                    .primitiveToWrapper(propertyClass)));
            } else {
                entries.add(new OpenEngSBModelEntry(propertyDescriptor.getName(), value, propertyClass));
            }
        }

        for (Map.Entry<String, EDBObjectEntry> objectEntry : object.entrySet()) {
            EDBObjectEntry entry = objectEntry.getValue();
            Class<?> entryType;
            try {
                entryType = model.getClassLoader().loadClass(entry.getType());
                entries.add(new OpenEngSBModelEntry(entry.getKey(), entry.getValue(), entryType));
            } catch (ClassNotFoundException e) {
                LOGGER.error("Unable to load class {} of the model tail", entry.getType());
            }
        }
        return ModelUtils.createModel(model, entries);
    }
217284
public static EDBObject convertJPAObjectToEDBObject(JPAObject object) {
        EDBObject result = new EDBObject(object.getOID());
        for (JPAEntry kvp : object.getEntries()) {
            EDBObjectEntry entry = convertJPAEntryToEDBObjectEntry(kvp);
            result.put(entry.getKey(), entry);
        }
        result.setDeleted(object.isDeleted());
        if (object.getTimestamp() != null) {
            result.updateTimestamp(object.getTimestamp());
        }
        return result;
    }
295872
public Object[] readObjects(Class pObjClass, Hashtable pMapping)
        throws SQLException {
        return readObjects(pObjClass, pMapping, null);
    }
489546
def element_to_objects(payload: Dict) -> List:
    
    entities = []
    cls = MAPPINGS.get(payload.get('type'))
    if not cls:
        return []

    transformed = transform_attributes(payload, cls)
    entity = cls(**transformed)

    if hasattr(entity, "post_receive"):
        entity.post_receive()

    entities.append(entity)

    return entities
1014344
private void createObjectDiffs() throws EDBException {
        diff = new HashMap<String, EDBObjectDiff>();
        List<EDBObject> tempList = new ArrayList<EDBObject>();
        for (EDBObject o : this.endState) {
            tempList.add(o);
        }

        addModifiedOrDeletedObjects(tempList);
        addNewObjects(tempList);
    }
1347114
public static Object[] toArray(List<?> list) {
	Iterator<?> it = list.iterator();
	Class clazz = null;
	while (it.hasNext()) {
	    Object v = it.next();
	    if (v == null) continue;
	    if (clazz == null) clazz = v.getClass();
	    else if (clazz != v.getClass()) return list.toArray();
	}
	if (clazz == Object.class || clazz == null) return list.toArray();

	Object arr = java.lang.reflect.Array.newInstance(clazz, list.size());
	return list.toArray((Object[]) arr);
    }
1053689
def paged_object_to_list(paged_object):
    '''
    
    '''
    paged_return = []
    while True:
        try:
            page = next(paged_object)
            paged_return.append(page.as_dict())
        except CloudError:
            raise
        except StopIteration:
            break

    return paged_return
451031
function listToObject(list, key) {
        var length, result, i, obj, keyValue;
        if (!list) {
            list = [];
        }
        length = list.length;
        result = { valids: {}, discarded: [] };
        for (i = 0; i < length; i += 1) {
            obj = list[i];
            keyValue = obj[key];
            // discard the object without a key
            if (keyValue) {
                result.valids[keyValue] = obj;
            } else {
                result.discarded.push(obj);
            }
        }
        return result;
    }
1068551
def object_list(self):
        

        def _sort(ob, ol):
            reverse = ob.startswith("-")
            ob = ob[1:] if reverse else ob
            for column in self.columns:
                if column.sort_key_fn is not None and column.name == ob:
                    return sorted(ol, key=column.sort_key_fn, reverse=reverse)
            if self._meta.order_by and hasattr(ol, "order_by"):
                return list(ol.order_by(*self._meta.order_by.split("|")))
            return ol

        ol = self._object_list
        ob = self._meta.order_by
        if not ob: return ol
        if isinstance(ob, basestring):
            return _sort(ob, ol)
        elif isinstance(ob, list):
            ob.reverse()
            for fn in ob:
                ol = _sort(fn, ol)
        return ol