code stringlengths 1 18.2k |
|---|
def get_input_score_start_range_metadata(self): """Gets the metadata for the input score start range. return: (osid.Metadata) - metadata for the input score start range *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template ... |
def set_input_score_start_range(self, score): """Sets the input score start range. arg: score (decimal): the new start range raise: InvalidArgument - ``score`` is invalid raise: NoAccess - ``range`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.g... |
def clear_input_score_start_range(self): """Clears the input score start. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score if (self.... |
def get_input_score_end_range_metadata(self): """Gets the metadata for the input score start range. return: (osid.Metadata) - metadata for the input score start range *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template me... |
def set_input_score_end_range(self, score): """Sets the input score start range. arg: score (decimal): the new start range raise: InvalidArgument - ``score`` is invalid raise: NoAccess - ``range`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.gra... |
def clear_input_score_end_range(self): """Clears the input score start. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score if (self.ge... |
def get_output_score_metadata(self): """Gets the metadata for the output score start range. return: (osid.Metadata) - metadata for the output score start range *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metadata ... |
def set_output_score(self, score): """Sets the output score. arg: score (decimal): the new output score raise: InvalidArgument - ``score`` is invalid raise: NoAccess - ``score`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemFor... |
def clear_output_score(self): """Clears the output score. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score if (self.get_output_score... |
def get_grade_ids(self): """Gets the grade ``Ids`` in this system ranked from highest to lowest. return: (osid.id.IdList) - the list of grades ``Ids`` raise: IllegalState - ``is_based_on_grades()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.reposito... |
def get_grades(self): """Gets the grades in this system ranked from highest to lowest. return: (osid.grading.GradeList) - the list of grades raise: IllegalState - ``is_based_on_grades()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # I... |
def get_lowest_numeric_score(self): """Gets the lowest number in a numeric grading system. return: (decimal) - the lowest number raise: IllegalState - ``is_based_on_grades()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.is_based_on_grades(): raise errors.IllegalState('This GradeS... |
def get_numeric_score_increment(self): """Gets the incremental step. return: (decimal) - the increment raise: IllegalState - ``is_based_on_grades()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.is_based_on_grades(): raise errors.IllegalState('This GradeSystem is based on grades')... |
def get_highest_numeric_score(self): """Gets the highest number in a numeric grading system. return: (decimal) - the highest number raise: IllegalState - ``is_based_on_grades()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.is_based_on_grades(): raise errors.IllegalState('This Gra... |
def _init_metadata(self, **kwargs): """Initialize form metadata""" osid_objects.OsidObjectForm._init_metadata(self, **kwargs) self._numeric_score_increment_default = self._mdata['numeric_score_increment']['default_decimal_values'][0] self._lowest_numeric_score_default = self._mdata['lowest_numeric_score']['default_deci... |
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidObjectForm._init_map(self, record_types=record_types) self._my_map['numericScoreIncrement'] = self._numeric_score_increment_default self._my_map['lowestNumericScore'] = self._lowest_numeric_score_default self._my_map['basedOnGr... |
def get_based_on_grades_metadata(self): """Gets the metadata for a grade-based designation. return: (osid.Metadata) - metadata for the grade-based designation *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metadata =... |
def set_based_on_grades(self, grades): """Sets the grade-based designation. arg: grades (boolean): the grade-based designation raise: InvalidArgument - ``grades`` is invalid raise: NoAccess - ``grades`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for os... |
def clear_based_on_grades(self): """Clears the based on grades designation. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_group_template if (self.get_ba... |
def get_lowest_numeric_score_metadata(self): """Gets the metadata for the lowest numeric score. return: (osid.Metadata) - metadata for the lowest numeric score *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metadata ... |
def set_lowest_numeric_score(self, score): """Sets the lowest numeric score. arg: score (decimal): the lowest numeric score raise: InvalidArgument - ``score`` is invalid raise: NoAccess - ``score`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.gr... |
def clear_lowest_numeric_score(self): """Clears the lowest score. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score if (self.get_lowe... |
def get_numeric_score_increment_metadata(self): """Gets the metadata for the lowest numeric score. return: (osid.Metadata) - metadata for the lowest numeric score *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metada... |
def set_numeric_score_increment(self, increment): """Sets the numeric score increment. arg: increment (decimal): the numeric score increment raise: InvalidArgument - ``increment`` is invalid raise: NoAccess - ``increment`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented ... |
def clear_numeric_score_increment(self): """Clears the numeric score increment. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score if ... |
def get_highest_numeric_score_metadata(self): """Gets the metadata for the highest numeric score. return: (osid.Metadata) - metadata for the highest numeric score *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metada... |
def set_highest_numeric_score(self, score): """Sets the highest numeric score. arg: score (decimal): the highest numeric score raise: InvalidArgument - ``score`` is invalid raise: NoAccess - ``score`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid... |
def clear_highest_numeric_score(self): """Clears the highest numeric score. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score if (sel... |
def get_gradebook_column_id(self): """Gets the ``Id`` of the ``GradebookColumn``. return: (osid.id.Id) - the ``Id`` of the ``GradebookColumn`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective_id if not bool(self._my_map['gradebookColumn... |
def get_gradebook_column(self): """Gets the ``GradebookColumn``. return: (osid.grading.GradebookColumn) - the ``GradebookColumn`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective if no... |
def get_overridden_calculated_entry(self): """Gets the calculated entry this entry overrides. return: (osid.grading.GradeEntry) - the calculated entry raise: IllegalState - ``overrides_calculated_entry()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be imp... |
def get_grade_id(self): """Gets the grade ``Id`` in this entry if the grading system is based on grades. return: (osid.id.Id) - the grade ``Id`` raise: IllegalState - ``is_graded()`` is ``false`` or ``GradeSystem.isBasedOnGrades()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # Implemen... |
def get_grade(self): """Gets the grade in this entry if the grading system is based on grades. return: (osid.grading.Grade) - the grade raise: IllegalState - ``is_graded()`` is ``false`` or ``GradeSystem.isBasedOnGrades()`` is ``false`` raise: OperationFailed - unable to complete request *compliance: mandatory -- This ... |
def get_time_graded(self): """Gets the time the gradeable object was graded. return: (osid.calendaring.DateTime) - the timestamp of the grading entry raise: IllegalState - ``is_graded()`` is ``false`` or ``is_derived()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if not self.is_graded()... |
def get_grading_agent_id(self): """Gets the ``Id`` of the ``Agent`` that created this entry. return: (osid.id.Id) - the ``Id`` of the ``Agent`` raise: IllegalState - ``is_graded()`` is ``false`` or ``is_derived()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if not self.is_graded or self... |
def get_ignored_for_calculations_metadata(self): """Gets the metadata for the ignore flag. return: (osid.Metadata) - metadata for the ignore flag *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metadata = dict(self._m... |
def set_ignored_for_calculations(self, ignore): """Sets the ignore for calculations flag. arg: ignore (boolean): the new ignore flag raise: InvalidArgument - ``ignore`` is invalid raise: NoAccess - ``ignore`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ # Implemented from template ... |
def clear_ignored_for_calculations(self): """Clears the ignore for calculations flag. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_group_template if (s... |
def get_grade_metadata(self): """Gets the metadata for a grade. return: (osid.Metadata) - metadata for the grade *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metadata = dict(self._mdata['grade']) metadata.update({'... |
def set_grade(self, grade_id): """Sets the grade. arg: grade_id (osid.id.Id): the new grade raise: InvalidArgument - ``grade_id`` is invalid or ``GradebookColumn.getGradeSystem().isBasedOnGrades()`` is ``false`` raise: NoAccess - ``grade_id`` cannot be modified raise: NullArgument - ``grade_id`` is ``null`` *compliance... |
def clear_grade(self): """Clears the grade. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if not self._grade_system.is_based_on_grades(): return # do nothing, spec does not raise error if (self.get_grade_metadata().is... |
def get_score_metadata(self): """Gets the metadata for a score. return: (osid.Metadata) - metadata for the score *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metadata = dict(self._mdata['score']) metadata.update({'... |
def set_score(self, score): """Sets the score. arg: score (decimal): the new score raise: InvalidArgument - ``score`` is invalid or ``GradebookColumn.getGradeSystem().isBasedOnGrades()`` is ``true`` raise: NoAccess - ``score`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ if self._g... |
def clear_score(self): """Clears the score. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self._grade_system.is_based_on_grades(): return # do nothing, spec does not raise error if (self.get_score_metadata().is_rea... |
def _init_metadata(self, **kwargs): """Initialize form metadata""" osid_objects.OsidObjectForm._init_metadata(self, **kwargs) self._grade_system_default = self._mdata['grade_system']['default_id_values'][0] |
def _get_entries_for_calculation(self): """Ignores entries flagged with ignoreForCalculation""" mgr = self._get_provider_manager('Grading') # what about the Proxy? if not mgr.supports_gradebook_column_lookup(): raise errors.OperationFailed('Grading does not support GradebookColumn lookup') gradebook_id = Id(self._my_ma... |
def _get_entry_scores(self): """Takes entries from self._entries and returns a list of scores (or output scores, if based on grades)""" if self.get_gradebook_column().get_grade_system().is_based_on_grades(): return [e.get_grade().get_output_score() for e in self._entries if e.is_graded()] else: return [e.get_score() fo... |
def get_mode(self): """Gets the mode of the score. If this system is based on grades, the mode of the output score is returned. return: (decimal) - the median score *compliance: mandatory -- This method must be implemented.* """ # http://stackoverflow.com/questions/10797819/finding-the-mode-of-a-list-in-python return m... |
def get_rms(self): """Gets the root mean square of the score. If this system is based on grades, the RMS of the output score is returned. return: (decimal) - the median score *compliance: mandatory -- This method must be implemented.* """ return np.sqrt(np.mean(np.square(self._entry_scores))) |
def get_gradebook(self): """Gets the ``Gradebook`` at this node. return: (osid.grading.Gradebook) - the gradebook represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('GRADING', runtime=self._runtime, proxy=self._proxy) self... |
def get_parent_gradebook_nodes(self): """Gets the parents of this gradebook. return: (osid.grading.GradebookNodeList) - the parents of the ``id`` *compliance: mandatory -- This method must be implemented.* """ parent_gradebook_nodes = [] for node in self._my_map['parentNodes']: parent_gradebook_nodes.append(GradebookNo... |
def register_filter(filter_cls): """ Adds the ``filter_cls`` to our registry. """ if filter_cls.name is None: return elif filter_cls.name in FILTER_REGISTRY: raise RuntimeError( "Filter class already registered: {}".format(filter_cls.name)) else: FILTER_REGISTRY[filter_cls.name] = filter_cls |
def build_filter(filter_or_string, *args, **kwargs): """ Overloaded filter construction. If ``filter_or_string`` is a string we look up it's corresponding class in the filter registry and return it. Otherwise, assume ``filter_or_string`` is an instance of a filter. :return: :class:`~es_fluent.filters.Filter` """ if isi... |
def Options(**kwargs): """ A method for declaring options for the class""" construct = GPDOptions #IMPORTANT! Set this names = construct._fields d = {} for name in names: d[name] = None #default values for k,v in kwargs.iteritems(): if k in names: d[k] = v else: raise ValueError('Error '+k+' is not a property of these ... |
def get_asset(self, asset_id): """Gets the ``Asset`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Asset`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to an ``Asset`` and retained for compat... |
'repository').get_identifier())}, **self._view_filter())) return objects.Asset(osid_object_map=result, runtime=self._runtime, proxy=self._proxy) |
def get_assets_by_ids(self, asset_ids): """Gets an ``AssetList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the assets specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inacce... |
for # osid.resource.ResourceLookupSession.get_resources_by_ids # NOTE: This implementation currently ignores plenary view collection = JSONClientValidated('repository', collection='Asset', runtime=self._runtime) object_id_list = [] for i in asset_ids: object_id_list.append(ObjectId(self._get_id(i, 'repository').get_ide... |
def get_assets_by_genus_type(self, asset_genus_type): """Gets an ``AssetList`` corresponding to the given asset genus ``Type`` which does not include assets of types derived from the specified ``Type``. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may co... |
def get_assets(self): """Gets all ``Assets``. In plenary mode, the returned list contains all known assets or an error results. Otherwise, the returned list may contain only those assets that are accessible through this session. return: (osid.repository.AssetList) - a list of ``Assets`` raise: OperationFailed - unable ... |
def get_asset_content(self, asset_content_id): """Gets the ``AssetContent`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``AssetContent`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to an ``A... |
NotFound exception will be thrown by find_one, so # the below should always work asset_content_map = [ac for ac in result['assetContents'] if ac['_id'] == asset_content_identifier][0] return objects.AssetContent(osid_object_map=asset_content_map, runtime=self._runtime, proxy=self._proxy) |
def get_asset_contents_by_ids(self, asset_content_ids): """Gets an ``AssetList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the asset contents specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied lis... |
= JSONClientValidated('repository', collection='Asset', runtime=self._runtime) object_id_list = [ObjectId(self._get_id(i, 'repository').get_identifier()) for i in asset_content_ids] results = collection.find( dict({'assetContents._id': {'$in': object_id_list}}, **self._view_filter())) # if a match is not found, NotFoun... |
def get_asset_contents_by_genus_type(self, asset_content_genus_type): """Gets an ``AssetContentList`` corresponding to the given asset content genus ``Type`` which does not include asset contents of types derived from the specified ``Type``. In plenary mode, the returned list contains all known asset contents or an err... |
so # the below should always work asset_content_maps = [ac for asset in results for ac in asset['assetContents'] if ac['genusTypeId'] == str(asset_content_genus_type)] return objects.AssetContentList(asset_content_maps, runtime=self._runtime, proxy=self._proxy) |
def get_asset_contents_for_asset(self, asset_id): """Gets an ``AssetList`` from the given Asset. In plenary mode, the returned list contains all known asset contents or an error results. Otherwise, the returned list may contain only those asset contents that are accessible through this session. :param asset_id: an asse... |
def get_assets_by_query(self, asset_query): """Gets a list of ``Assets`` matching the given asset query. arg: asset_query (osid.repository.AssetQuery): the asset query return: (osid.repository.AssetList) - the returned ``AssetList`` raise: NullArgument - ``asset_query`` is ``null`` raise: OperationFailed - unable to co... |
DESCENDING) else: result = [] return objects.AssetList(result, runtime=self._runtime, proxy=self._proxy) |
def get_assets_by_search(self, asset_query, asset_search): """Gets the search results matching the given search query using the given search. arg: asset_query (osid.repository.AssetQuery): the asset query arg: asset_search (osid.repository.AssetSearch): the asset search return: (osid.repository.AssetSearchResults) - th... |
view_filter: and_list.append(view_filter) if and_list: query_terms = {'$and': and_list} collection = JSONClientValidated('repository', collection='Asset', runtime=self._runtime) if asset_search.start is not None and asset_search.end is not None: result = collection.find(query_terms)[asset_search.start:asset_search.end]... |
def get_asset_form_for_create(self, asset_record_types): """Gets the asset form for creating new assets. A new form should be requested for each create transaction. arg: asset_record_types (osid.type.Type[]): array of asset record types return: (osid.repository.AssetForm) - the asset form raise: NullArgument - ``asset_... |
def create_asset(self, asset_form): """Creates a new ``Asset``. arg: asset_form (osid.repository.AssetForm): the form for this ``Asset`` return: (osid.repository.Asset) - the new ``Asset`` raise: IllegalState - ``asset_form`` already used in a create transaction raise: InvalidArgument - one or more of the form elements... |
raise errors.Unsupported('asset_form did not originate from this session') if not asset_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') insert_result = collection.insert_one(asset_form._my_map) self._forms[asset_form.get_id().get_identifier()] = CREATED result = objects.Asse... |
def update_asset(self, asset_form): """Updates an existing asset. arg: asset_form (osid.repository.AssetForm): the form containing the elements to be updated raise: IllegalState - ``asset_form`` already used in anupdate transaction raise: InvalidArgument - the form contains an invalid value raise: NullArgument - ``asse... |
this session') if not asset_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(asset_form._my_map) self._forms[asset_form.get_id().get_identifier()] = UPDATED # Note: this is out of spec. The OSIDs don't require an object to be returned: return objects.Asset( os... |
def delete_asset(self, asset_id): """Deletes an ``Asset``. arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset`` to remove raise: NotFound - ``asset_id`` not found raise: NullArgument - ``asset_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compli... |
def alias_asset(self, asset_id, alias_id): """Adds an ``Id`` to an ``Asset`` for the purpose of creating compatibility. The primary ``Id`` of the ``Asset`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another asset, it is reassigned to the given ... |
def get_asset_content_form_for_create(self, asset_id, asset_content_record_types): """Gets an asset content form for creating new assets. arg: asset_id (osid.id.Id): the ``Id`` of an ``Asset`` arg: asset_content_record_types (osid.type.Type[]): array of asset content record types return: (osid.repository.AssetContentFo... |
# WHY are we passing repository_id = self._catalog_id below, seems redundant: obj_form = objects.AssetContentForm( repository_id=self._catalog_id, asset_id=asset_id, catalog_id=self._catalog_id, runtime=self._runtime, proxy=self._proxy) else: obj_form = objects.AssetContentForm( repository_id=self._catalog_id, record_t... |
def create_asset_content(self, asset_content_form): """Creates new ``AssetContent`` for a given asset. arg: asset_content_form (osid.repository.AssetContentForm): the form for this ``AssetContent`` return: (osid.repository.AssetContent) - the new ``AssetContent`` raise: IllegalState - ``asset_content_form`` already use... |
errors.IllegalState('asset_content_form already used in a create transaction') except KeyError: raise errors.Unsupported('asset_content_form did not originate from this session') if not asset_content_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') asset_content_form._my_map[... |
def get_asset_content_form_for_update(self, asset_content_id): """Gets the asset content form for updating an existing asset content. A new asset content form should be requested for each update transaction. arg: asset_content_id (osid.id.Id): the ``Id`` of the ``AssetContent`` return: (osid.repository.AssetContentForm... |
sub_doc obj_form = AssetContentForm( osid_object_map=result, runtime=self._runtime, proxy=self._proxy) obj_form._for_update = True self._forms[obj_form.get_id().get_identifier()] = not UPDATED return obj_form |
def update_asset_content(self, asset_content_form): """Updates an existing asset content. arg: asset_content_form (osid.repository.AssetContentForm): the form containing the elements to be updated raise: IllegalState - ``asset_content_form`` already used in an update transaction raise: InvalidArgument - the form contai... |
except KeyError: raise errors.Unsupported('asset_content_form did not originate from this session') if not asset_content_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') asset_id = Id(asset_content_form._my_map['assetId']).get_identifier() asset = collection.find_one( {'$and'... |
def delete_asset_content(self, asset_content_id): """Deletes content from an ``Asset``. arg: asset_content_id (osid.id.Id): the ``Id`` of the ``AssetContent`` raise: NotFound - ``asset_content_id`` is not found raise: NullArgument - ``asset_content_id`` is ``null`` raise: OperationFailed - unable to complete request ra... |
def _get_asset_id_with_enclosure(self, enclosure_id): """Create an Asset with an enclosed foreign object. This is here to support AssetCompositionSession.set_asset. May need to add this in other objects to support other osid.Containable objects. return: (osid.id.Id) - the id of the new Asset """ mgr = self._get_provide... |
def register_for_new_assets_by_genus_type(self, asset_genus_type): """Registers for notification of new assets of the given asset genus type. ``AssetReceiver.newAssets()`` is invoked when an asset is appears in this repository. arg: asset_genus_type (osid.type.Type): the genus type of the ``Asset`` to monitor raise: Nu... |
def register_for_deleted_asset(self, asset_id): """Registers for notification of a deleted asset. ``AssetReceiver.deletedAssets()`` is invoked when the specified asset is deleted or removed from this repository. arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset`` to monitor raise: NullArgument - ``asset_id`` is ``n... |
def get_asset_ids_by_repository(self, repository_id): """Gets the list of ``Asset`` ``Ids`` associated with a ``Repository``. arg: repository_id (osid.id.Id): ``Id`` of the ``Repository`` return: (osid.id.IdList) - list of related asset ``Ids`` raise: NotFound - ``repository_id`` is not found raise: NullArgument - ``re... |
def get_assets_by_repository(self, repository_id): """Gets the list of ``Assets`` associated with a ``Repository``. arg: repository_id (osid.id.Id): ``Id`` of the ``Repository`` return: (osid.repository.AssetList) - list of related assets raise: NotFound - ``repository_id`` is not found raise: NullArgument - ``reposito... |
def get_asset_ids_by_repositories(self, repository_ids): """Gets the list of ``Asset Ids`` corresponding to a list of ``Repository`` objects. arg: repository_ids (osid.id.IdList): list of repository ``Ids`` return: (osid.id.IdList) - list of asset ``Ids`` raise: NullArgument - ``repository_ids`` is ``null`` raise: Oper... |
def get_assets_by_repositories(self, repository_ids): """Gets the list of ``Assets`` corresponding to a list of ``Repository`` objects. arg: repository_ids (osid.id.IdList): list of repository ``Ids`` return: (osid.repository.AssetList) - list of assets raise: NullArgument - ``repository_ids`` is ``null`` raise: Operat... |
def get_repository_ids_by_asset(self, asset_id): """Gets the list of ``Repository`` ``Ids`` mapped to an ``Asset``. arg: asset_id (osid.id.Id): ``Id`` of an ``Asset`` return: (osid.id.IdList) - list of repository ``Ids`` raise: NotFound - ``asset_id`` is not found raise: NullArgument - ``asset_id`` is ``null`` raise: O... |
def get_repositories_by_asset(self, asset_id): """Gets the list of ``Repository`` objects mapped to an ``Asset``. arg: asset_id (osid.id.Id): ``Id`` of an ``Asset`` return: (osid.repository.RepositoryList) - list of repositories raise: NotFound - ``asset_id`` is not found raise: NullArgument - ``asset_id`` is ``null`` ... |
def get_assignable_repository_ids(self, repository_id): """Gets a list of repositories including and under the given repository node in which any asset can be assigned. arg: repository_id (osid.id.Id): the ``Id`` of the ``Repository`` return: (osid.id.IdList) - list of assignable repository ``Ids`` raise: NullArgument ... |
def assign_asset_to_repository(self, asset_id, repository_id): """Adds an existing ``Asset`` to a ``Repository``. arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset`` arg: repository_id (osid.id.Id): the ``Id`` of the ``Repository`` raise: AlreadyExists - ``asset_id`` already assigned to ``repository_id`` raise: Not... |
def unassign_asset_from_repository(self, asset_id, repository_id): """Removes an ``Asset`` from a ``Repository``. arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset`` arg: repository_id (osid.id.Id): the ``Id`` of the ``Repository`` raise: NotFound - ``asset_id`` or ``repository_id`` not found or ``asset_id`` not as... |
def get_composition_assets(self, composition_id): """Gets the list of assets mapped to the given ``Composition``. arg: composition_id (osid.id.Id): ``Id`` of the ``Composition`` return: (osid.repository.AssetList) - list of assets raise: NotFound - ``composition_id`` not found raise: NullArgument - ``composition_id`` i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.