Ejemplo n.º 1
0
    def get_object(self):
        """
        Returns the representation of our object from it's stored environment
        :return dict: the data representing this object

        Use this at your own peril. You can't overwrite anything without editing it in the saved environment but
        the interior elements of this dictionary are NOT the same as the classes representing them. If you want data
        from the interior of the object, it is best to use the abstractions provided by it's more specific type.
        """
        self._check_rep()
        meta_data = service.get_object(self.object_id, self.workspace_id)
        self._data = meta_data[0]
        self._name = meta_data[1][1]
        self._ver = meta_data[1][4]

        return self.data
Ejemplo n.º 2
0
    def get_object(self):
        """
        Returns the representation of our object from it's stored environment
        :return dict: the data representing this object

        Use this at your own peril. You can't overwrite anything without editing it in the saved environment but
        the interior elements of this dictionary are NOT the same as the classes representing them. If you want data
        from the interior of the object, it is best to use the abstractions provided by it's more specific type.
        """
        self._check_rep()
        meta_data = service.get_object(self.object_id, self.workspace_id)
        self._data = meta_data[0]
        self._name = meta_data[1][1]
        self._ver = meta_data[1][4]

        return self.data
Ejemplo n.º 3
0
def get_object(objid, wsid, name=None):
    '''
    Returns an object and it's associated KBase information

    Returns an ObjectData (dictionary) like what is returned in the workspace service 'get_objects' function:

	/* The data and supplemental info for an object.

		UnspecifiedObject data - the object's data or subset data.
		object_info info - information about the object.
		list<ProvenanceAction> provenance - the object's provenance.
		username creator - the user that first saved the object to the
			workspace.
		timestamp created - the date the object was first saved to the
			workspace.
		list<obj_ref> - the references contained within the object.
		obj_ref copied - the reference of the source object if this object is
			a copy and the copy source exists and is accessible.
			null otherwise.
		boolean copy_source_inaccessible - true if the object was copied from
			another object, but that object is no longer accessible to the
			user. False otherwise.
		mapping<id_type, list<extracted_id>> extracted_ids - any ids extracted
			from the object.
		string handle_error - if an error occurs while setting ACLs on
			embedded handle IDs, it will be reported here.
		string handle_stacktrace - the stacktrace for handle_error.

	*/
	typedef structure {
		UnspecifiedObject data;
		object_info info;
		list<ProvenanceAction> provenance;
		username creator;
		timestamp created;
		list<obj_ref> refs;
		obj_ref copied;
		boolean copy_source_inaccessible;
		mapping<id_type, list<extracted_id>> extracted_ids;
		string handle_error;
		string handle_stacktrace;
	} ObjectData;

    '''
    obj = service.get_object(objid, wsid, name=name)
    return {'data': obj[0], 'info': obj[1]}