code
stringlengths
1
18.2k
def get_osid_temporal_mdata(): """Return default mdata map for OsidTemporal""" return { 'start_date': { 'element_label': { 'text': 'Start Date', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'enter a valid d...
def get_osid_containable_mdata(): """Return default mdata map for OsidContainable""" return { 'sequestered': { 'element_label': { 'text': 'sequestered', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'enter e...
def get_osid_sourceable_mdata(): """Return default mdata map for OsidSourceable""" return { 'provider': { 'element_label': { 'text': 'provider', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'accepts an osid...
'text': '', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }], 'syntax': 'STRING', 'minimum_string_length': 0, 'maximum_string_length': None, 'string_set': [] } }
def get_resources(self): """Gets the resource list resulting from a search. return: (osid.resource.ResourceList) - the resource list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been retrieved....
def get_bins(self): """Gets the bin list resulting from the search. return: (osid.resource.BinList) - the bin list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been retrieved.') self.retrieved ...
def _backward_delete_char(text, pos): """Delete the character behind pos.""" if pos == 0: return text, pos return text[:pos - 1] + text[pos:], pos - 1
def _backward_kill_word(text, pos): """" Kill the word behind pos. Word boundaries are the same as those used by _backward_word. """ text, new_pos = _backward_word(text, pos) return text[:new_pos] + text[pos:], new_pos
def _backward_word(text, pos): """ Move pos back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and digits). """ while pos > 0 and not text[pos - 1].isalnum(): pos -= 1 while pos > 0 and text[pos - 1].isalnum(): pos -= 1 return text, pos
def _capitalize_word(text, pos): """Capitalize the current (or following) word.""" while pos < len(text) and not text[pos].isalnum(): pos += 1 if pos < len(text): text = text[:pos] + text[pos].upper() + text[pos + 1:] while pos < len(text) and text[pos].isalnum(): pos += 1 return text, pos
def _delete_horizontal_space(text, pos): """Delete all spaces and tabs around pos.""" while pos > 0 and text[pos - 1].isspace(): pos -= 1 end_pos = pos while end_pos < len(text) and text[end_pos].isspace(): end_pos += 1 return text[:pos] + text[end_pos:], pos
def _downcase_word(text, pos): """Lowercase the current (or following) word.""" text, new_pos = _forward_word(text, pos) return text[:pos] + text[pos:new_pos].lower() + text[new_pos:], new_pos
def _forward_word(text, pos): """ Move pos forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits). """ while pos < len(text) and not text[pos].isalnum(): pos += 1 while pos < len(text) and text[pos].isalnum(): pos += 1 return text, pos
def _kill_word(text, pos): """ Kill from pos to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as those used by _forward_word. """ text, end_pos = _forward_word(text, pos) return text[:pos] + text[end_pos:], pos
def _transpose_chars(text, pos): """ Drag the character before pos forward over the character at pos, moving pos forward as well. If pos is at the end of text, then this transposes the two characters before pos. """ if len(text) < 2 or pos == 0: return text, pos if pos == len(text): return text[:pos - 2] + text[pos - 1...
def _transpose_words(text, pos): """ Drag the word before pos past the word after pos, moving pos over that word as well. If pos is at the end of text, this transposes the last two words in text. """ text, end2 = _forward_word(text, pos) text, start2 = _backward_word(text, end2) text, start1 = _backward_word(text, star...
def _unix_word_rubout(text, pos): """ Kill the word behind pos, using white space as a word boundary. """ words = text[:pos].rsplit(None, 1) if len(words) < 2: return text[pos:], 0 else: index = text.rfind(words[1], 0, pos) return text[:index] + text[pos:], index
def _upcase_word(text, pos): """Uppercase the current (or following) word.""" text, new_pos = _forward_word(text, pos) return text[:pos] + text[pos:new_pos].upper() + text[new_pos:], new_pos
def edit(text, pos, key): """ Process a key input in the context of a line, and return the resulting text and cursor position. `text' and `key' must be of type str or unicode, and `pos' must be an int in the range [0, len(text)]. If `key' is in keys(), the corresponding command is executed on the line. Otherwise, if `k...
def login_honeypot(request): """ A login honypot. """ status_code = None if request.method == 'POST': form = HoneypotForm(request.POST) if form.is_valid(): username = form.cleaned_data["username"] password = form.cleaned_data["password"] # Don't store password from existing users: if request.user.is_authenticated(): # ...
def get_log_entries_by_search(self, log_entry_query, log_entry_search): """Pass through to provider LogEntrySearchSession.get_log_entries_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self._can('search'): raise PermissionDenied() retu...
def get_family(self): """Gets the ``Family`` associated with this session. return: (osid.relationship.Family) - the family raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.* """ return FamilyLookupSession(proxy=...
def get_relationship(self, relationship_id=None): """Gets the ``Relationship`` specified by its ``Id``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to retrieve return: (osid.relationship.Relationship) - the returned ``Relationship`` raise: NotFound - no ``Relationship`` found with the given ``...
def get_relationships_by_ids(self, relationship_ids=None): """Gets a ``RelationshipList`` corresponding to the given ``IdList``. arg: relationship_ids (osid.id.IdList): the list of ``Ids`` to retrieve return: (osid.relationship.RelationshipList) - the returned ``Relationship list`` raise: NotFound - an ``Id`` was not f...
def get_relationships_by_genus_type(self, relationship_genus_type=None): """Gets a ``RelationshipList`` corresponding to the given relationship genus ``Type`` which does not include relationships of types derived from the specified ``Type``. arg: relationship_genus_type (osid.type.Type): a relationship genus type retur...
def get_relationships_for_source(self, source_id=None): """Gets a ``RelationshipList`` corresponding to the given peer ``Id``. arg: source_id (osid.id.Id): a peer ``Id`` return: (osid.relationship.RelationshipList) - the relationships raise: NullArgument - ``source_id`` is ``null`` raise: OperationFailed - unable to co...
def get_relationships_by_genus_type_for_source(self, source_id=None, relationship_genus_type=None): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and relationship genus ``Type. Relationships`` of any genus derived from the given genus are returned. In plenary mode, the returned list contains all...
unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.* """ if source_id is None or relationship_genus_type is None: raise NullArgument() url_path = ('/handcar/services/relationship/families/' + self._catalog_idstr + '/relationships?genustyp...
def get_relationships_for_destination(self, destination_id=None): """Gets a ``RelationshipList`` corresponding to the given peer ``Id``. arg: destination_id (osid.id.Id): a peer ``Id`` return: (osid.relationship.RelationshipList) - the relationships raise: NullArgument - ``destination_id`` is ``null`` raise: OperationF...
def get_relationships_by_genus_type_for_destination(self, destination_id=None, relationship_genus_type=None): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and relationship genus ``Type. Relationships`` of any genus derived from the given genus are returned. In plenary mode, the returned list co...
unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.* """ if destination_id is None or relationship_genus_type is None: raise NullArgument() url_path = ('/handcar/services/relationship/families/' + self._catalog_idstr + '/relationships?gen...
def get_relationships(self): """Gets all ``Relationships``. return: (osid.relationship.RelationshipList) - a list of ``Relationships`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.* """ url_path = ('/handcar...
def get_family(self): """Gets the ``Family`` associated with this session. return: (osid.relationship.Family) - the family raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for o...
def get_relationship_form_for_create(self, source_id=None, destination_id=None, relationship_record_types=None): """Gets the relationship form for creating new relationships. A new form should be requested for each create transaction. arg: source_id (osid.id.Id): ``Id`` of a peer arg: destination_id (osid.id.Id): ``Id`...
source_id=source_id, destination_id=destination_id) self._forms[relationship_form.get_id().get_identifier()] = not CREATED return relationship_form
def create_relationship(self, relationship_form=None): """Creates a new ``Relationship``. arg: relationship_form (osid.relationship.RelationshipForm): the form for this ``Relationship`` return: (osid.relationship.Relationship) - the new ``Relationship`` raise: IllegalState - ``relationship_form`` already used in a crea...
session') if not relationship_form.is_valid(): raise InvalidArgument('one or more of the form elements is invalid') url_path = ('/handcar/services/relationship/families/' + self._catalog_idstr + '/relationships') try: result = self._post_request(url_path, relationship_form._my_map) except Exception: raise # OperationFa...
def get_relationship_form_for_update(self, relationship_id=None): """Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` return: (osid.relationship.RelationshipFor...
def update_relationship(self, relationship_id=None, relationship_form=None): """Updates an existing relationship. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` arg: relationship_form (osid.relationship.RelationshipForm): the form containing the elements to be updated raise: IllegalState - ``rela...
KeyError: raise Unsupported('form did not originate from this session') if not relationship_form.is_valid(): raise InvalidArgument('one or more of the form elements is invalid') url_path = ('/handcar/services/relationship/families/' + self._catalog_idstr + '/relationships') try: result = self._put_request(url_path, rel...
def delete_relationship(self, relationship_id=None): """Deletes a ``Relationship``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to remove raise: NotFound - ``relationship_id`` not found raise: NullArgument - ``relationship_id`` is ``null`` raise: OperationFailed - unable to complete request ra...
def get_family(self, family_id=None): """Gets the ``Family`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Family`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to a ``Family`` and retained f...
def get_families_by_ids(self, family_ids=None): """Gets a ``FamilyList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the families 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...
raise NullArgument() families = [] for i in family_ids: family = None url_path = '/handcar/services/relationship/families/' + str(i) try: family = self._get_request(url_path) except (NotFound, OperationFailed): if self._family_view == PLENARY: raise else: pass if family: if not (self._family_view == COMPARATIVE and fam...
def get_families_by_genus_type(self, family_genus_type=None): """Gets a ``FamilyList`` corresponding to the given family genus ``Type`` which does not include families of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known families or an error results. Otherwise, the r...
if family['genusTypeId'] == str(family_genus_type): families_of_type.append(family) return objects.FamilyList(families_of_type)
def a_temp_file(): """Yield the name of a temporary file and ensure it's removed after use""" filename = None try: tmpfile = tempfile.NamedTemporaryFile(delete=False) filename = tmpfile.name yield tmpfile finally: if filename and os.path.exists(filename): os.remove(filename)
def until(timeout=10, step=0.5, action=None, silent=False): """Yield until timeout""" yield started = time.time() while True: if action and not silent: log.info(action) if time.time() - started > timeout: if action and not silent: log.error("Timedout %s", action) return else: time.sleep(step) yield
def write_to(output, txt): """Write some text to some output""" if (isinstance(txt, six.binary_type) or six.PY3 and isinstance(output, StringIO)) or isinstance(output, TextIOWrapper): output.write(txt) else: output.write(txt.encode("utf-8", "replace"))
def set_agnocomplete(self, klass_or_instance, user): """ Handling the assignation of the agnocomplete object inside the field. A developer may want to use a class or an instance of an :class:`AgnocompleteBase` class to configure her field. Ex:: from agnocomplete import Fields class SearchForm(forms.Form): search_class ...
instance, instanciate this if not isinstance(klass_or_instance, AgnocompleteBase): klass_or_instance = klass_or_instance(user=user) # Pass the field when we have an AgnocompleteBase instance if isinstance(klass_or_instance, AgnocompleteBase): klass_or_instance.set_agnocomplete_field(self) # Store it in the instance sel...
def transmit_agnocomplete_context(self): """ Assign the user context to the agnocomplete class, if any. """ # Only if the field has this attribute set. if hasattr(self, AGNOCOMPLETE_USER_ATTRIBUTE): user = self.get_agnocomplete_context() if user: self.agnocomplete.user = user return user
def clean(self, *args, **kwargs): """ Potentially, these fields should validate against context-based queries. If a context variable has been transmitted to the field, it's being used to 'reset' the queryset and make sure the chosen item fits to the user context. """ self.transmit_agnocomplete_context() return super(Ag...
def transmit_agnocomplete_context(self): """ We'll reset the current queryset only if the user is set. """ user = super(AgnocompleteContextQuerysetMixin, self) \ .transmit_agnocomplete_context() if user: self.queryset = self.agnocomplete.get_queryset() return user
def clear_list_value(self, value): """ Clean the argument value to eliminate None or Falsy values if needed. """ # Don't go any further: this value is empty. if not value: return self.empty_value # Clean empty items if wanted if self.clean_empty: value = [v for v in value if v] return value or self.empty_value
def create_item(self, **kwargs): """ Return a model instance created from kwargs. """ item, created = self.queryset.model.objects.get_or_create(**kwargs) return item
def create_new_values(self): """ Create values created by the user input. Return the model instances QS. """ model = self.queryset.model pks = [] extra_create_kwargs = self.extra_create_kwargs() for value in self._new_values: create_kwargs = {self.create_field: value} create_kwargs.update(extra_create_kwargs) new_item ...
def clean(self, value): """ Clean the field values. """ if not self.create: # No new value can be created, use the regular clean field return super(AgnocompleteModelMultipleField, self).clean(value) # We have to do this here before the call to "super". # It'll be called again, but we can't find a way to "pre_clean" the...
def sort_ranges(inranges): """from an array of ranges, make a sorted array of ranges :param inranges: List of GenomicRange data :type inranges: GenomicRange[] :returns: a new sorted GenomicRange list :rtype: GenomicRange[] """ return sorted(inranges,key=lambda x: (x.chr,x.start,x.end,x.direction))
def merge_ranges(inranges,already_sorted=False): """from a list of genomic range or bed entries, whether or not they are already sorted, make a flattend range list of ranges where if they overlapped, they are now joined (not yet) The new range payloads will be the previous ranges :param inranges: :param already_sorted:...
def pad_ranges(inranges,padding,chr_ranges=None): """Add the specfied amount onto the edges the transcripts :param inranges: List of genomic ranges in Bed o GenomicRange format. :param padding: how much to add on :param chr_ranges: looks like the list of ranges within which to pad :type inranges: GenomicRange[] :type p...
def subtract_ranges(r1s,r2s,already_sorted=False): """Subtract multiple ranges from a list of ranges :param r1s: range list 1 :param r2s: range list 2 :param already_sorted: default (False) :type r1s: GenomicRange[] :type r2s: GenomicRange[] :return: new range r1s minus r2s :rtype: GenomicRange[] """ from seqtools.stre...
i in range(0,len(beds1)): for j in range(beds2min,beds2max): cmpval = beds1[i].cmp(beds2[j]) if cmpval == -1: beds2min = j+1 elif cmpval == 0: mapping[i].append(j) else: break for i in range(0,len(beds1)): if len(mapping[i])==0: outputs += beds1 else: outputs += subtract_range_array(beds1[i],[beds2[j] for j in mapping[...
def intersect_range_array(bed1,beds2,payload=None,is_sorted=False): """ Does not do a merge if the payload has been set :param bed1: :param bed2: :param payload: payload=1 return the payload of bed1 on each of the intersect set, payload=2 return the payload of bed2 on each of the union set, payload=3 return the payload...
def subtract_range_array(bed1,beds2,is_sorted=False): """subtract several ranges from a range, returns array1 - (all of array2) :param bed1: :param beds2: subtract all these beds from bed1 :param is_sorted: has it been sorted already? Default (False) :type bed1: Bed or GenomicRange :type beds2: Bed[] or GenomicRange[] ...
def string_to_genomic_range(rstring): """ Convert a string to a genomic range :param rstring: string representing a genomic range chr1:801-900 :type rstring: :returns: object representing the string :rtype: GenomicRange """ m = re.match('([^:]+):(\d+)-(\d+)',rstring) if not m: sys.stderr.write("ERROR: problem with rang...
def sort_genomic_ranges(rngs): """sort multiple ranges""" return sorted(rngs, key=lambda x: (x.chr, x.start, x.end))
def ranges_to_coverage(rngs,threads=1): """take a list of ranges as an input output a list of ranges and the coverage at each range :param rngs: bed ranges on a single chromosome. not certain about that single chromosome requirement :type rngs: GenomicRange[] or Bed[] :param threads: Not currently being used :type thre...
in indexed_events: indexed_events[e] = {'starts':0,'ends':0} indexed_events[e]['ends']+=1 cdepth = 0 pstart = None pend = None outputs = [] ordered_events = sorted(indexed_events.keys()) for loc in ordered_events: prev_depth = cdepth # where we were # see where we are before the change cdepth += indexed_events[loc]['st...
= [] for b in srngs: if b.chr != chr: rs = do_chr(buffer[:]) for r in rs: results.append(GenomicRange(r[0],r[1],r[2])) results[-1].set_payload(r[3]) buffer = [] buffer.append(b) chr = b.chr if len(buffer) > 0: rs = do_chr(buffer[:]) for r in rs: results.append(GenomicRange(r[0],r[1],r[2])) results[-1].set_payload(r[3])...
def read_entry(self): """get the next value from the array, and set internal iterator so next call will be next entry :return: The next GenomicRange entry :rtype: GenomicRange """ if len(self.bedarray) <= self.curr_ind: return None val = self.bedarray[self.curr_ind] self.curr_ind += 1 return val
def read_entry(self): """read the next bed entry from the stream""" line = self.fh.readline() if not line: return None m = re.match('([^\t]+)\t(\d+)\t(\d+)\t*(.*)',line.rstrip()) if not m: sys.stderr.write("ERROR: unknown line in bed format file\n"+line+"\n") sys.exit() g = GenomicRange(m.group(1),int(m.group(2))+1,int...
def set_http_request(self, http_request): """Support the HTTPRequest ProxyConditionRecordType and checks for special effective agent ids""" self._http_request = http_request if 'HTTP_LTI_USER_ID' in http_request.META: try: authority = http_request.META['HTTP_LTI_TOOL_CONSUMER_INSTANCE_GUID'] except (AttributeError, Key...
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'gnu.org', 'namespace': 'Basic Numeric Formats', 'identifier': name, 'domain': 'Numeric Format Types', 'display_name': GNU_BASIC_NUMERIC_FORM...
def paint(str,color='r'): '''Utility func, for printing colorful logs in console... @args: -- str : String to be modified. color : color code to which the string will be formed. default is 'r'=RED @returns: -- str : final modified string with foreground color as per parameters. ''' if color in switcher: str = switcher[...
def log(self, content, content_type): """Logs an item. This method is a shortcut to ``createLogEntry()``. arg: content (object): the entry to log arg: content_type (osid.type.Type): the type of this entry which must be one of the types returned by ``LoggingManager.getContentTypes()`` raise: InvalidArgument - ``content`...
def get_log_entry(self, log_entry_id): """Gets the ``LogEntry`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``LogEntry`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to a ``LogEntry`` and ret...
'logging').get_identifier())}, **self._view_filter())) return objects.LogEntry(osid_object_map=result, runtime=self._runtime, proxy=self._proxy)
def get_log_entries_by_ids(self, log_entry_ids): """Gets a ``LogEntryList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the entries 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 fou...
for # osid.resource.ResourceLookupSession.get_resources_by_ids # NOTE: This implementation currently ignores plenary view collection = JSONClientValidated('logging', collection='LogEntry', runtime=self._runtime) object_id_list = [] for i in log_entry_ids: object_id_list.append(ObjectId(self._get_id(i, 'logging').get_id...
def get_log_entries_by_genus_type(self, log_entry_genus_type): """Gets a ``LogEntryList`` corresponding to the given log entry genus ``Type`` which doe snot include entries of genus types derived form the specified ``Type``. In plenary mode, the returned list contains all known entries or an error results. Otherwise, t...
proxy=self._proxy)
def get_log_entries(self): """Gets all log entries. In plenary mode, the returned list contains all known entries or an error results. Otherwise, the returned list may contain only those entries that are accessible through this session. return: (osid.logging.LogEntryList) - a list of log entries raise: OperationFailed ...
def get_log_entries_by_query(self, log_entry_query): """Gets a list of log entries matching the given log entry query. arg: log_entry_query (osid.logging.LogEntryQuery): the log entry query return: (osid.logging.LogEntryList) - the returned ``LogEntryList`` raise: NullArgument - ``log_entry_query`` is ``null`` raise: O...
= collection.find(query_terms).sort('_id', DESCENDING) else: result = [] return objects.LogEntryList(result, runtime=self._runtime, proxy=self._proxy)
def can_create_log_entry_with_record_types(self, log_entry_record_types): """Tests if this user can create a single ``LogEntry`` using the desired record types. While ``LoggingManager.getLogEntryRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creati...
not None: return self._catalog_session.can_create_catalog_with_record_types(catalog_record_types=log_entry_record_types) return True
def get_log_entry_form_for_create(self, log_entry_record_types): """Gets the log entry form for creating new log entries. A new form should be requested for each create transaction. arg: log_entry_record_types (osid.type.Type[]): array of log entry record types return: (osid.logging.LogEntryForm) - the log entry form r...
CREATED return obj_form
def create_log_entry(self, log_entry_form): """Creates a new ``LogEntry``. arg: log_entry_form (osid.logging.LogEntryForm): the form for this ``LogEntry`` return: (osid.logging.LogEntry) - the new ``LogEntry`` raise: IllegalState - ``log_entry_form`` already used in a create transaction raise: InvalidArgument - one or ...
session') if not log_entry_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') if 'timestamp' not in log_entry_form._my_map or log_entry_form._my_map['timestamp'] is None: log_entry_form._my_map['timestamp'] = DateTime.utcnow() log_entry_form._my_map['agentId'] = str(self.get_ef...
def update_log_entry(self, log_entry_form): """Updates an existing log entry. arg: log_entry_form (osid.logging.LogEntryForm): the form containing the elements to be updated raise: IllegalState - ``log_entry_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value raise: ...
originate from this session') if not log_entry_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(log_entry_form._my_map) self._forms[log_entry_form.get_id().get_identifier()] = UPDATED # Note: this is out of spec. The OSIDs don't require an object to be returne...
def delete_log_entry(self, log_entry_id): """Deletes a ``LogEntry``. arg: log_entry_id (osid.id.Id): the ``Id`` of the ``log_entry_id`` to remove raise: NotFound - ``log_entry_id`` not found raise: NullArgument - ``log_entry_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - ...
def alias_log_entry(self, log_entry_id, alias_id): """Adds an ``Id`` to a ``LogEntry`` for the purpose of creating compatibility. The primary ``Id`` of the ``LogEntry`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another log entry, it is reassig...
def get_log_entry_ids_by_log(self, log_id): """Gets the list of ``LogEntry`` ``Ids`` associated with a ``Log``. arg: log_id (osid.id.Id): ``Id`` of a ``Log`` return: (osid.id.IdList) - list of related logEntry ``Ids`` raise: NotFound - ``log_id`` is not found raise: NullArgument - ``log_id`` is ``null`` raise: Operatio...
def get_log_entries_by_log(self, log_id): """Gets the list of log entries associated with a ``Log``. arg: log_id (osid.id.Id): ``Id`` of a ``Log`` return: (osid.logging.LogEntryList) - list of related logEntry raise: NotFound - ``log_id`` is not found raise: NullArgument - ``log_id`` is ``null`` raise: OperationFailed ...
def get_log_entrie_by_log(self, log_ids): """Gets the list of log entries corresponding to a list of ``Log``. arg: log_ids (osid.id.IdList): list of log ``Ids`` return: (osid.logging.LogEntryList) - list of log entries raise: NullArgument - ``log_ids`` is ``null`` raise: OperationFailed - unable to complete request rai...
def get_log_ids_by_log_entry(self, log_entry_id): """Gets the list of ``Log`` ``Ids`` mapped to a ``LogEntry``. arg: log_entry_id (osid.id.Id): ``Id`` of a ``LogEntry`` return: (osid.id.IdList) - list of log ``Ids`` raise: NotFound - ``log_entry_id`` is not found raise: NullArgument - ``log_entry_id`` is ``null`` raise...
def get_assignable_log_ids(self, log_id): """Gets a list of log including and under the given log node in which any log entry can be assigned. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` return: (osid.id.IdList) - list of assignable log ``Ids`` raise: NullArgument - ``log_id`` is ``null`` raise: OperationFailed...