code stringlengths 1 18.2k |
|---|
def create_resource(self, resource_form): """Creates a new ``Resource``. arg: resource_form (osid.resource.ResourceForm): the form for this ``Resource`` return: (osid.resource.Resource) - the new ``Resource`` raise: IllegalState - ``resource_form`` already used in a create transaction raise: InvalidArgument - one or mo... |
raise errors.Unsupported('resource_form did not originate from this session') if not resource_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') insert_result = collection.insert_one(resource_form._my_map) self._forms[resource_form.get_id().get_identifier()] = CREATED result = ... |
def update_resource(self, resource_form): """Updates an existing resource. arg: resource_form (osid.resource.ResourceForm): the form containing the elements to be updated raise: IllegalState - ``resource_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value raise: Null... |
from this session') if not resource_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(resource_form._my_map) self._forms[resource_form.get_id().get_identifier()] = UPDATED # Note: this is out of spec. The OSIDs don't require an object to be returned: return obj... |
def delete_resource(self, resource_id): """Deletes a ``Resource``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` to remove raise: NotFound - ``resource_id`` not found raise: NullArgument - ``resource_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authoriza... |
def alias_resource(self, resource_id, alias_id): """Adds an ``Id`` to a ``Resource`` for the purpose of creating compatibility. The primary ``Id`` of the ``Resource`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another resource it is reassigned ... |
def register_for_deleted_resource(self, resource_id): """Registers for notification of a deleted resource. ``ResourceReceiver.deletedResources()`` is invoked when the specified resource is deleted or removed from this bin. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` to monitor raise: NullArgument - ``... |
def get_resource_ids_by_bin(self, bin_id): """Gets the list of ``Resource`` ``Ids`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.id.IdList) - list of related resource ``Ids`` raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` raise: Operation... |
def get_resources_by_bin(self, bin_id): """Gets the list of ``Resources`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.resource.ResourceList) - list of related resources raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFaile... |
def get_resource_ids_by_bins(self, bin_ids): """Gets the list of ``Resource Ids`` corresponding to a list of ``Bin`` objects. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.id.IdList) - list of resource ``Ids`` raise: NullArgument - ``bin_ids`` is ``null`` raise: OperationFailed - unable to complete r... |
def get_resources_by_bins(self, bin_ids): """Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` is ``null`` raise: OperationFailed - unable to complete request r... |
def get_bin_ids_by_resource(self, resource_id): """Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise: Ope... |
def get_bins_by_resource(self, resource_id): """Gets the list of ``Bin`` objects mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.resource.BinList) - list of bins raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise: Operat... |
def get_assignable_bin_ids(self, bin_id): """Gets a list of bins including and under the given bin node in which any resource can be assigned. arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` return: (osid.id.IdList) - list of assignable bin ``Ids`` raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed... |
def assign_resource_to_bin(self, resource_id, bin_id): """Adds an existing ``Resource`` to a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: AlreadyExists - ``resource_id`` is already assigned to ``bin_id`` raise: NotFound - ``resource_id... |
def unassign_resource_from_bin(self, resource_id, bin_id): """Removes a ``Resource`` from a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: NotFound - ``resource_id`` or ``bin_id`` not found or ``resource_id`` not assigned to ``bin_id`` r... |
def get_resource_by_agent(self, agent_id): """Gets the ``Resource`` associated with the given agent. arg: agent_id (osid.id.Id): ``Id`` of the ``Agent`` return: (osid.resource.Resource) - associated resource raise: NotFound - ``agent_id`` is not found raise: NullArgument - ``agent_id`` is ``null`` raise: OperationFaile... |
def get_agent_ids_by_resource(self, resource_id): """Gets the list of ``Agent`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of agent ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` rais... |
def get_agents_by_resource(self, resource_id): """Gets the list of ``Agents`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.authentication.AgentList) - list of agents raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise:... |
def assign_agent_to_resource(self, agent_id, resource_id): """Adds an existing ``Agent`` to a ``Resource``. arg: agent_id (osid.id.Id): the ``Id`` of the ``Agent`` arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` raise: AlreadyExists - ``agent_id`` is already assigned to ``resource_id`` raise: NotFound - `... |
def unassign_agent_from_resource(self, agent_id, resource_id): """Removes an ``Agent`` from a ``Resource``. arg: agent_id (osid.id.Id): the ``Id`` of the ``Agent`` arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` raise: NotFound - ``agent_id`` or ``resource_id`` not found or ``agent_id`` not assigned to ``... |
def get_bins_by_query(self, bin_query): """Gets a list of ``Bins`` matching the given bin query. arg: bin_query (osid.resource.BinQuery): the bin query return: (osid.resource.BinList) - the returned ``BinList`` raise: NullArgument - ``bin_query`` is ``null`` raise: OperationFailed - unable to complete request raise: Pe... |
def can_create_bin_with_record_types(self, bin_record_types): """Tests if this user can create a single ``Bin`` using the desired record types. While ``ResourceManager.getBinRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``Bin``... |
return self._catalog_session.can_create_catalog_with_record_types(catalog_record_types=bin_record_types) return True |
def update_bin(self, bin_form): """Updates an existing bin. arg: bin_form (osid.resource.BinForm): the form containing the elements to be updated raise: IllegalState - ``bin_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value raise: NullArgument - ``bin_id`` or ``bin... |
update transaction') except KeyError: raise errors.Unsupported('bin_form did not originate from this session') if not bin_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(bin_form._my_map) # save is deprecated - change to replace_one self._forms[bin_form.get_i... |
def alias_bin(self, bin_id, alias_id): """Adds an ``Id`` to a ``Bin`` for the purpose of creating compatibility. The primary ``Id`` of the ``Bin`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another bin, it is reassigned to the given bin ``Id``.... |
def get_root_bins(self): """Gets the root bins in the bin hierarchy. A node with no parents is an orphan. While all bin ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node. return: (osid.resource.BinList) - the root bins raise: O... |
def has_parent_bins(self, bin_id): """Tests if the ``Bin`` has any parents. arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the bin has parents, ``false`` otherwise raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to com... |
def is_parent_of_bin(self, id_, bin_id): """Tests if an ``Id`` is a direct parent of a bin. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if this ``id`` is a parent of ``bin_id,`` ``false`` otherwise raise: NotFound - ``bin_id`` is not found raise: NullArgume... |
def get_parent_bin_ids(self, bin_id): """Gets the parent ``Ids`` of the given bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (osid.id.IdList) - the parent ``Ids`` of the bin raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete req... |
def get_parent_bins(self, bin_id): """Gets the parents of the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query return: (osid.resource.BinList) - the parents of the bin raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise: P... |
def is_ancestor_of_bin(self, id_, bin_id): """Tests if an ``Id`` is an ancestor of a bin. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if this ``id`` is an ancestor of ``bin_id,`` ``false`` otherwise raise: NotFound - ``bin_id`` is not found raise: NullArgum... |
def has_child_bins(self, bin_id): """Tests if a bin has any children. arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the ``bin_id`` has children, ``false`` otherwise raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to comp... |
def is_child_of_bin(self, id_, bin_id): """Tests if a bin is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the ``id`` is a child of ``bin_id,`` ``false`` otherwise raise: NotFound - ``bin_id`` is not found raise: NullArgument - `... |
def get_child_bin_ids(self, bin_id): """Gets the child ``Ids`` of the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the bin raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise:... |
def get_child_bins(self, bin_id): """Gets the children of the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query return: (osid.resource.BinList) - the children of the bin raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise: ... |
def is_descendant_of_bin(self, id_, bin_id): """Tests if an ``Id`` is a descendant of a bin. arg: id (osid.id.Id): an ``Id`` arg: bin_id (osid.id.Id): the ``Id`` of a bin return: (boolean) - ``true`` if the ``id`` is a descendant of the ``bin_id,`` ``false`` otherwise raise: NotFound - ``bin_id`` is not found raise: Nu... |
def get_bin_nodes(self, bin_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given bin. arg: bin_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. arg: ... |
return objects.BinNode(self.get_bin_node_ids( bin_id=bin_id, ancestor_levels=ancestor_levels, descendant_levels=descendant_levels, include_siblings=include_siblings)._my_map, runtime=self._runtime, proxy=self._proxy) |
def add_root_bin(self, bin_id): """Adds a root bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin raise: AlreadyExists - ``bin_id`` is already in hierarchy raise: NotFound - ``bin_id`` not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - au... |
def remove_root_bin(self, bin_id): """Removes a root bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin raise: NotFound - ``bin_id`` not a root raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This ... |
def add_child_bin(self, bin_id, child_id): """Adds a child to a bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``bin_id`` is already a parent of ``child_id`` raise: NotFound - ``bin_id`` or ``child_id`` not found raise: NullArgument - ``... |
def remove_child_bin(self, bin_id, child_id): """Removes a child from a bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``bin_id`` not a parent of ``child_id`` raise: NullArgument - ``bin_id`` or ``child_id`` is ``null`` raise: OperationFailed... |
def remove_child_bins(self, bin_id): """Removes all children from a bin. arg: bin_id (osid.id.Id): the ``Id`` of a bin raise: NotFound - ``bin_id`` not in hierarchy raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *complianc... |
def connect(self): """Create connection to CasparCG Server""" try: self.connection = telnetlib.Telnet(self.host, self.port, timeout=self.timeout) except Exception: log_traceback() return False return True |
def query(self, query, **kwargs): """Send AMCP command""" if not self.connection: if not self.connect(): return CasparResponse(500, "Unable to connect CasparCG server") query = query.strip() if kwargs.get("verbose", True): if not query.startswith("INFO"): logging.debug("Executing AMCP: {}".format(query)) query += "\r\n... |
def forwards(self, orm): "Write your forwards methods here." orm['avocado.DataConcept'].objects.filter(name='Sample')\ .update(queryable=False) |
def backwards(self, orm): "Write your backwards methods here." orm['avocado.DataConcept'].objects.filter(name='Sample')\ .update(queryable=True) |
def get_type_data(self, name): """Return dictionary representation of type.""" try: return { 'authority': 'DLKIT.MIT.EDU', 'namespace': 'NoneType', 'identifier': name, 'domain': 'Generic Types', 'display_name': self.none_types[name] + ' Type', 'display_label': self.none_types[name], 'description': ('The ' + self.none_t... |
def get_type_data(self, name): """Return dictionary representation of type.""" try: return { 'authority': 'DLKIT.MIT.EDU', 'namespace': 'GenusType', 'identifier': name, 'domain': 'Generic Types', 'display_name': self.generic_types[name] + ' Generic Type', 'display_label': self.generic_types[name], 'description': ('The ... |
def get_type_data(self, name): """Return dictionary representation of type.""" try: return { 'authority': 'DLKIT', 'namespace': 'relationship.Relationship', 'identifier': name.lower(), 'domain': 'Generic Types', 'display_name': name.title() + ' Type', 'display_label': name.title(), 'description': ('The ' + name.title()... |
def average(arr): """average of the values, must have more than 0 entries. :param arr: list of numbers :type arr: number[] a number array :return: average :rtype: float """ if len(arr) == 0: sys.stderr.write("ERROR: no content in array to take average\n") sys.exit() if len(arr) == 1: return arr[0] return float(sum(arr)... |
def median(arr): """median of the values, must have more than 0 entries. :param arr: list of numbers :type arr: number[] a number array :return: median :rtype: float """ if len(arr) == 0: sys.stderr.write("ERROR: no content in array to take average\n") sys.exit() if len(arr) == 1: return arr[0] quot = len(arr)/2 rem = ... |
def variance(arr): """variance of the values, must have 2 or more entries. :param arr: list of numbers :type arr: number[] a number array :return: variance :rtype: float """ avg = average(arr) return sum([(float(x)-avg)**2 for x in arr])/float(len(arr)-1) |
def N50(arr): """N50 often used in assessing denovo assembly. :param arr: list of numbers :type arr: number[] a number array :return: N50 :rtype: float """ if len(arr) == 0: sys.stderr.write("ERROR: no content in array to take N50\n") sys.exit() tot = sum(arr) half = float(tot)/float(2) cummulative = 0 for l in sorted(... |
def is_uuid4(instr): """A validator to confirm a string is indeed a UUID4 :param instr: input string that may be uuid4 :type instr: String :return: true if it is in UUID4 format :rtype: bool """ v = instr.strip().replace('-','').lower() if len(v) != 32: return False if not re.match('^[0-9a-f]+$',v): return False if v[1... |
def _set_objective_bank_view(self, session): """Sets the underlying objective_bank view to match current view""" if self._objective_bank_view == COMPARATIVE: try: session.use_comparative_objective_bank_view() except AttributeError: pass else: try: session.use_plenary_objective_bank_view() except AttributeError: pass |
def use_comparative_objective_bank_view(self): """Pass through to provider ObjectiveObjectiveBankSession.use_comparative_objective_bank_view""" self._objective_bank_view = COMPARATIVE # self._get_provider_session('objective_objective_bank_session') # To make sure the session is tracked for session in self._get_provider... |
def use_plenary_objective_bank_view(self): """Pass through to provider ObjectiveObjectiveBankSession.use_plenary_objective_bank_view""" self._objective_bank_view = PLENARY # self._get_provider_session('objective_objective_bank_session') # To make sure the session is tracked for session in self._get_provider_sessions():... |
def get_objective_banks_by_activity(self, *args, **kwargs): """Pass through to provider ActivityObjectiveBankSession.get_objective_banks_by_activity""" # Implemented from kitosid template for - # osid.resource.ResourceBinSession.get_bins_by_resource catalogs = self._get_provider_session('activity_objective_bank_session... |
def get_objective_banks(self): """Pass through to provider ObjectiveBankLookupSession.get_objective_banks""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_template catalogs = self._get_provider_session('objective_bank_lookup_session').get_objective_banks() cat_list = [] for cat in ... |
def create_objective_bank(self, *args, **kwargs): """Pass through to provider ObjectiveBankAdminSession.create_objective_bank""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.create_bin return ObjectiveBank( self._provider_manager, self._get_provider_session('objective_bank_admin_session').c... |
def get_objective_bank_form(self, *args, **kwargs): """Pass through to provider ObjectiveBankAdminSession.get_objective_bank_form_for_update""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.get_bin_form_for_update_template # This method might be a bit sketchy. Time will tell. if isinstance(a... |
def save_objective_bank(self, objective_bank_form, *args, **kwargs): """Pass through to provider ObjectiveBankAdminSession.update_objective_bank""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin if objective_bank_form.is_for_update(): return self.update_objective_bank(objective_ban... |
def _set_objective_bank_view(self, session): """Sets the underlying objective_bank view to match current view""" if self._objective_bank_view == FEDERATED: try: session.use_federated_objective_bank_view() except AttributeError: pass else: try: session.use_isolated_objective_bank_view() except AttributeError: pass |
def use_comparative_objective_view(self): """Pass through to provider ObjectiveLookupSession.use_comparative_objective_view""" self._object_views['objective'] = COMPARATIVE # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: s... |
def use_plenary_objective_view(self): """Pass through to provider ObjectiveLookupSession.use_plenary_objective_view""" self._object_views['objective'] = PLENARY # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_p... |
def use_federated_objective_bank_view(self): """Pass through to provider ObjectiveLookupSession.use_federated_objective_bank_view""" self._objective_bank_view = FEDERATED # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: ses... |
def use_isolated_objective_bank_view(self): """Pass through to provider ObjectiveLookupSession.use_isolated_objective_bank_view""" self._objective_bank_view = ISOLATED # self._get_provider_session('objective_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: sessio... |
def get_objective_form(self, *args, **kwargs): """Pass through to provider ObjectiveAdminSession.get_objective_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time will tell. if isinstance(args[-1], list... |
def save_objective(self, objective_form, *args, **kwargs): """Pass through to provider ObjectiveAdminSession.update_objective""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if objective_form.is_for_update(): return self.update_objective(objective_form, *args, **kwargs)... |
def use_comparative_activity_view(self): """Pass through to provider ActivityLookupSession.use_comparative_activity_view""" self._object_views['activity'] = COMPARATIVE # self._get_provider_session('activity_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: sessio... |
def use_plenary_activity_view(self): """Pass through to provider ActivityLookupSession.use_plenary_activity_view""" self._object_views['activity'] = PLENARY # self._get_provider_session('activity_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_plenar... |
def get_activity_form(self, *args, **kwargs): """Pass through to provider ActivityAdminSession.get_activity_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time will tell. if isinstance(args[-1], list) o... |
def save_activity(self, activity_form, *args, **kwargs): """Pass through to provider ActivityAdminSession.update_activity""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if activity_form.is_for_update(): return self.update_activity(activity_form, *args, **kwargs) else: ... |
def use_comparative_proficiency_view(self): """Pass through to provider ProficiencyLookupSession.use_comparative_proficiency_view""" self._object_views['proficiency'] = COMPARATIVE # self._get_provider_session('proficiency_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions... |
def use_plenary_proficiency_view(self): """Pass through to provider ProficiencyLookupSession.use_plenary_proficiency_view""" self._object_views['proficiency'] = PLENARY # self._get_provider_session('proficiency_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: ses... |
def get_proficiency_form(self, *args, **kwargs): """Pass through to provider ProficiencyAdminSession.get_proficiency_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time will tell. if isinstance(args[-1]... |
def save_proficiency(self, proficiency_form, *args, **kwargs): """Pass through to provider ProficiencyAdminSession.update_proficiency""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if proficiency_form.is_for_update(): return self.update_proficiency(proficiency_form, *a... |
def get_assets(self): """Gets the asset list resulting from a search. return: (osid.repository.AssetList) - the asset list raise: IllegalState - the list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been retriev... |
def get_compositions(self): """Gets the composition list resulting from a search. return: (osid.repository.CompositionList) - the composition list raise: IllegalState - the list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List ... |
def get_repositories(self): """Gets the repository list resulting from the search. return: (osid.repository.RepositoryList) - the repository list raise: IllegalState - the list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List h... |
def _init_object(self, catalog_id, proxy, runtime, cat_name, cat_class): """Initialize this object as an OsidObject....do we need this?? From the Mongo learning impl, but seems unnecessary for Handcar""" self._catalog_identifier = None self._init_proxy_and_runtime(proxy, runtime) self._catalog = cat_class(self._my_cata... |
def is_authenticated(self): """Tests if an agent is authenticated to this session. return: (boolean) - true if valid authentication credentials exist, false otherwise compliance: mandatory - This method must be implemented. """ if self._proxy is None: return False elif self._proxy.has_authentication(): return self._pro... |
def get_effective_agent_id(self): """Gets the Id of the effective agent in use by this session. If is_authenticated() is true, then the effective agent may be the same as the agent returned by get_authenticated_agent(). If is_authenticated() is false, then the effective agent may be a default agent used for authorizati... |
def get_effective_agent(self): """Gets the effective agent in use by this session. If is_authenticated() is true, then the effective agent may be the same as the agent returned by get_authenticated_agent(). If is_authenticated() is false, then the effective agent may be a default agent used for authorization by an unkn... |
def can_lookup_assets(self): """Tests if this user can perform ``Asset`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to... |
def get_asset(self, asset_id=None): """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 c... |
def get_assets_by_ids(self, asset_ids=None): """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 i... |
is None: raise NullArgument() assets = [] for i in asset_ids: asset = None url_path = construct_url('assets', bank_id=self._catalog_idstr, asset_id=i) try: asset = self._get_request(url_path) except (NotFound, OperationFailed): if self._objective_view == PLENARY: raise else: pass if asset: if not (self._asset_view == C... |
def get_assets_by_genus_type(self, asset_genus_type=None): """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 m... |
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: a list of ``Assets`` :rtype: ``osid.repository.AssetList`` :raise: ``OperationFail... |
def can_create_assets(self): """Tests if this user can create ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer create ... |
def get_asset_form_for_create(self, asset_record_types=None): """Gets the asset form for creating new assets. A new form should be requested for each create transaction. :param asset_record_types: array of asset record types :type asset_record_types: ``osid.type.Type[]`` :return: the asset form :rtype: ``osid.repositor... |
def can_update_assets(self): """Tests if this user can update ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer update ... |
def get_asset_form_for_update(self, asset_id=None): """Gets the asset form for updating an existing asset. A new asset form should be requested for each update transaction. :param asset_id: the ``Id`` of the ``Asset`` :type asset_id: ``osid.id.Id`` :return: the asset form :rtype: ``osid.repository.AssetForm`` :raise: `... |
def update_asset(self, asset_form=None): """Updates an existing asset. :param asset_form: the form containing the elements to be updated :type asset_form: ``osid.repository.AssetForm`` :raise: ``IllegalState`` -- ``asset_form`` already used in anupdate transaction :raise: ``InvalidArgument`` -- the form contains an inv... |
raise InvalidArgument('one or more of the form elements is invalid') url_path = construct_url('assets', bank_id=self._catalog_idstr) try: result = self._put_request(url_path, asset_form._my_map) except Exception: raise # OperationFailed() self._forms[asset_form.get_id().get_identifier()] = UPDATED return objects.Asset(... |
def can_delete_assets(self): """Tests if this user can delete ``Assets``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an ``Asset`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer delete ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.