code stringlengths 1 18.2k |
|---|
def _update_object_map(self, obj_map): """stub""" creation_time = obj_map['creationTime'] obj_map['creationTime'] = dict() obj_map['creationTime']['year'] = creation_time.year obj_map['creationTime']['month'] = creation_time.month obj_map['creationTime']['day'] = creation_time.day obj_map['creationTime']['hour'] = crea... |
def _init_map(self): """stub""" self.my_osid_object_form._my_map['provenanceId'] = \ self._provenance_metadata['default_object_values'][0] if not self.my_osid_object_form.is_for_update(): if 'effectiveAgentId' in self.my_osid_object_form._kwargs: self.my_osid_object_form._my_map['creatorId'] = \ str(self.my_osid_object... |
def _init_metadata(self): """stub""" self._provenance_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'provenanceId'), 'element_label': 'provenanceId', 'instructions': 'The item that "gave birth" to this item.', 'required': False, 'read_only': False, 'linked': Fal... |
def set_provenance(self, provenance_id): """stub""" if not self.my_osid_object_form._is_valid_string( provenance_id, self.get_provenance_metadata()): raise InvalidArgument('provenanceId') self.my_osid_object_form._my_map['provenanceId'] = provenance_id |
def _init_metadata(self): """stub""" self._resource_id_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'resource_id'), 'element_label': 'Resource Id', 'instructions': 'accepts a valid OSID Id', 'required': False, 'read_only': False, 'linked': False, 'array': False... |
def set_resource_id(self, resource_id=None): """stub""" if resource_id is None: raise NullArgument() if self.get_resource_id_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_id( resource_id): raise InvalidArgument() self.my_osid_object_form._my_map['resourceId'] = resource_id |
def clear_resource_id(self): """stub""" if (self.get_resource_id_metadata().is_read_only() or self.get_resource_id_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['resourceId'] = \ self.get_resource_id_metadata().get_default_id_values()[0] |
def set_text(self, text=None): """stub""" if text is None: raise NullArgument() if self.get_text_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_string( text, self.get_text_metadata()): raise InvalidArgument() self.my_osid_object_form._my_map['text']['text'] = text |
def clear_text(self): """stub""" if (self.get_text_metadata().is_read_only() or self.get_text_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['text'] = \ dict(self.get_text_metadata().get_default_string_values()[0]) |
def _init_metadata(self): """stub""" self._min_integer_value = None self._max_integer_value = None self._integer_value_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'integer_value'), 'element_label': 'Integer Value', 'instructions': 'enter an integer value', 're... |
def set_integer_value(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_integer_value_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_integer( value, self.get_integer_value_metadata()): raise InvalidArgument() self.my_osid_object_form._my_map['integer... |
def clear_integer_value(self): """stub""" if (self.get_integer_value_metadata().is_read_only() or self.get_integer_value_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['integerValue'] = \ self.get_integer_value_metadata().get_default_integer_values()[0] |
def set_decimal_value(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_decimal_value_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_decimal( value, self.get_decimal_value_metadata()): raise InvalidArgument() self.my_osid_object_form._my_map['decimal... |
def clear_decimal_value(self): """stub""" if (self.get_decimal_value_metadata().is_read_only() or self.get_decimal_value_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['decimalValue'] = \ self.get_decimal_value_metadata().get_default_decimal_values()[0] |
def get_text(self, label): """stub""" if self.has_text(label): # Should this return a DisplayText? return DisplayText(self.my_osid_object._my_map['texts'][label]) raise IllegalState() |
def _init_metadata(self): """stub""" self._min_string_length = None self._max_string_length = None self._texts_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'texts'), 'element_label': 'Texts', 'instructions': 'enter text with optional label', 'required': False, ... |
def add_text(self, text, label=None): """stub""" if label is None: label = self._label_metadata['default_string_values'][0] else: if not self.my_osid_object_form._is_valid_string( label, self.get_label_metadata()) or '.' in label: raise InvalidArgument('label') if text is None: raise NullArgument('text cannot be none')... |
def clear_text(self, label): """stub""" if label not in self.my_osid_object_form._my_map['texts']: raise NotFound() del self.my_osid_object_form._my_map['texts'][label] |
def clear_texts(self): """stub""" if self._texts_metadata['required'] or self._texts_metadata['read_only']: raise NoAccess() self.my_osid_object_form._my_map['texts'] = \ dict(self._texts_metadata['default_object_values'][0]) |
def get_integer_value(self, label): """stub""" if self.has_integer_value(label): return int(self.my_osid_object._my_map['integerValues'][label]) raise IllegalState() |
def _init_metadata(self): """stub""" self._min_integer_value = None self._max_integer_value = None self._integer_values_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'integer_values'), 'element_label': 'Integer Values', 'instructions': 'enter integer values with... |
def add_integer_value(self, value, label=None): """stub""" if value is None: raise NullArgument('value cannot be None') if label is None: label = self._label_metadata['default_string_values'][0] else: if not self.my_osid_object_form._is_valid_string( label, self.get_label_metadata()) or '.' in label: raise InvalidArgum... |
def clear_integer_value(self, label): """stub""" if label not in self.my_osid_object_form._my_map['integerValues']: raise NotFound() del self.my_osid_object_form._my_map['integerValues'][label] |
def clear_integer_values(self): """stub""" if self._integer_values_metadata['required'] or \ self._integer_values_metadata['read_only']: raise NoAccess() self.my_osid_object_form._my_map['integerValues'] = \ dict(self._integer_values_metadata['default_object_values'][0]) |
def get_decimal_value(self, label): """stub""" if self.has_decimal_value(label): return float(self.my_osid_object._my_map['decimalValues'][label]) raise IllegalState() |
def _init_metadata(self): """stub""" self._min_decimal_value = None self._max_decimal_value = None self._decimal_values_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'decimal_values'), 'element_label': 'Decimal Values', 'instructions': 'enter decimal values with... |
def add_decimal_value(self, value, label=None): """stub""" if label is None: label = self._label_metadata['default_string_values'][0] else: if not self.my_osid_object_form._is_valid_string( label, self.get_label_metadata()) or '.' in label: raise InvalidArgument('label') if value is None: raise NullArgument('value cann... |
def clear_decimal_value(self, label): """stub""" if label not in self.my_osid_object_form._my_map['decimalValues']: raise NotFound() del self.my_osid_object_form._my_map['decimalValues'][label] |
def clear_decimal_values(self): """stub""" if self._decimal_values_metadata['required'] or \ self._decimal_values_metadata['read_only']: raise NoAccess() self.my_osid_object_form._my_map['decimalValues'] = \ dict(self._decimal_values_metadata['default_object_values'][0]) |
def _init_map(self): """stub""" self.my_osid_object_form._my_map['attempts'] = \ int(self._attempts_metadata['default_object_values'][0]) self.my_osid_object_form._my_map['weight'] = \ float(self._weight_metadata['default_object_values'][0]) # self.my_osid_object_form._my_map['rerandomize'] = \ # self._rerandomize_meta... |
def _init_metadata(self): """stub""" self._attempts_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'attempts'), 'element_label': 'Attempts', 'instructions': 'Max number of student attempts', 'required': False, 'read_only': False, 'linked': False, 'array': False, ... |
} self._showanswer_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'showanswer'), 'element_label': 'Show answer', 'instructions': 'When to show the answer to the student', 'required': False, 'read_only': False, 'linked': False, 'array': False, 'default_object_valu... |
def add_attempts(self, attempts): """stub""" if attempts is None: raise NullArgument('attempts cannot be None') if not self.my_osid_object_form._is_valid_integer( attempts, self.get_attempts_metadata()): raise InvalidArgument('attempts') self.my_osid_object_form._my_map['attempts'] = attempts |
def add_weight(self, weight): """stub""" if weight is None: raise NullArgument('weight cannot be None') if not self.my_osid_object_form._is_valid_decimal( weight, self.get_weight_metadata()): raise InvalidArgument('weight') self.my_osid_object_form._my_map['weight'] = weight |
def add_showanswer(self, showanswer): """stub""" if showanswer is None: raise NullArgument('showanswer cannot be None') if not self.my_osid_object_form._is_valid_string( showanswer, self.get_showanswer_metadata()): raise InvalidArgument('showanswer') self.my_osid_object_form._my_map['showanswer'] = showanswer |
def add_markdown(self, markdown): """stub""" if markdown is None: raise NullArgument('markdown cannot be None') if not self.my_osid_object_form._is_valid_string( markdown, self.get_markdown_metadata()): raise InvalidArgument('markdown') self.my_osid_object_form._my_map['markdown'] = markdown |
def get_time_as_string(self): """stub""" if self.has_time(): return (str(self.time['hours']).zfill(2) + ':' + str(self.time['minutes']).zfill(2) + ':' + str(self.time['seconds']).zfill(2)) raise IllegalState() |
def _init_metadata(self): """stub""" self._min_time_value = None self._max_time_value = None self._time_value_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'time_value'), 'element_label': 'Time Value', 'instructions': 'enter a time duration string / duration', '... |
def _convert_duration_to_hhmmss(self, duration): """stub""" time_secs = duration.seconds min_, sec = divmod(time_secs, 60) hour, min_ = divmod(min_, 60) results = { 'hours': hour, 'minutes': min_, 'seconds': sec } return results |
def _convert_string_to_hhmmss(self, string): """stub""" # assume input string is 'hh:mm:ss' components = string.split(':') if len(components) != 3: raise InvalidArgument('time input string must be hh:mm:ss format') return { 'hours': int(components[0]), 'minutes': int(components[1]), 'seconds': int(components[2]) } |
def set_time_value(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_time_value_metadata().is_read_only(): raise NoAccess() if self.my_osid_object_form._is_valid_duration( value, self.get_time_value_metadata()): # http://stackoverflow.com/questions/775049/python-time-seconds-to-hms time =... |
def clear_time_value(self): """stub""" if (self.get_time_value_metadata().is_read_only() or self.get_time_value_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['timeValue'] = \ dict(self.get_time_value_metadata().get_default_duration_values()[0]) |
def has_files(self): """stub""" # I had to add the following check because file record types # don't seem to be implemented # correctly for raw edx Question objects if 'fileIds' not in self.my_osid_object._my_map: return False return bool(self.my_osid_object._my_map['fileIds']) |
def get_files_map(self): """stub""" files_map = {} if self.has_files(): for label in self.my_osid_object._my_map['fileIds']: asset_content = self._get_asset_content( Id(self.my_osid_object._my_map['fileIds'][label]['assetId']), Type(self.my_osid_object._my_map['fileIds'][label]['assetContentTypeId'])) try: files_map[la... |
def get_file_urls_map(self): """stub""" file_urls_map = {} if self.has_files(): for label in self.my_osid_object._my_map['fileIds']: label_map = self.my_osid_object._my_map['fileIds'][label] if 'assetContentId' in label_map and bool(label_map['assetContentId']): asset_content = self._get_asset_content( Id(label_map['as... |
def get_asset_ids(self): """stub""" asset_ids = [] for f in self.my_osid_object._my_map['fileIds']: asset_ids.append(Id(self.my_osid_object._my_map['fileIds'][f]['assetId'])) return IdList(asset_ids) |
def get_asset_ids_map(self): """stub""" asset_ids_map = {} for label, asset_obj in self.my_osid_object._my_map['fileIds'].items(): asset_ids_map[label] = asset_obj return asset_ids_map |
def get_asset_id_by_label(self, label): """stub""" if self.has_file(label): return Id(self.my_osid_object._my_map['fileIds'][label]['assetId']) raise IllegalState() |
def get_file_by_label(self, label, asset_content_type=None): """stub""" return self._get_asset_content(self.get_asset_id_by_label(label), asset_content_type).get_data() |
def get_url_by_label(self, label, asset_content_type=None): """stub""" return self._get_asset_content(self.get_asset_id_by_label(label)).get_url() |
def _update_object_map(self, obj_map): """loop through all the keys in self.my_osid_object._my_map, and see if any of them contain text like "AssetContent:<label>" If so, assume it is markup (?), replace the string with asset_content.get_url()""" # TODO: Look for <img> tags to add in alt-text and description # TODO: Lo... |
'xml') media_file_elements = soup.find_all(src=media_regex) media_file_elements += soup.find_all(data=media_regex) for media_file_element in media_file_elements: if 'src' in media_file_element.attrs: media_key = 'src' else: media_key = 'data' if ':' not in media_file_element[media_key]: continue media_label = media_fil... |
after the top p tag # so that we don't create invalid HTML by nesting # <div> and <aside> inside of a <p> tag p_parent.insert_after(new_template_tag) break p_parent = parent media_file_element.extract() else: media_file_element[media_key] = ac.get_url() # check for alt-tags if 'alt' in media_file_element.attrs: alt_tag... |
updated_list.append(check_list_children(child, list_files_map)) else: updated_list.append(child) return updated_list if bypass_asset_content_authorization: # One assumption is that the object's catalogId can be used # as the repositoryId manager = self.my_osid_object._get_provider_manager('REPOSITORY') try: if self.my_... |
def _init_metadata(self): """stub""" self._files_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'files'), 'element_label': 'Files', 'instructions': 'enter a file id with optional label', 'required': False, 'read_only': False, 'linked': False, 'array': False, 'def... |
def add_asset(self, asset_id, asset_content_id=None, label=None, asset_content_type=None): """stub""" if asset_id is None: raise NullArgument('asset_id cannot be None') if not isinstance(asset_id, Id): raise InvalidArgument('asset_id must be an Id instance') if asset_content_id is not None and not isinstance(asset_cont... |
def add_file(self, asset_data, label=None, asset_type=None, asset_content_type=None, asset_content_record_types=None, asset_name='', asset_description=''): """stub""" if asset_data is None: raise NullArgument('asset_data cannot be None') if not isinstance(asset_data, DataInputStream): raise InvalidArgument('asset_data ... |
asset_content_id, label, asset_content_type) |
def clear_file(self, label): """stub""" rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') catalog_id_str = '' if 'assignedBankIds' in self.my_osid_object_form._my_map: catalog_id_str = self.my_osid_object_form._my_map['assignedBankIds'][0] elif 'assignedRepositoryIds' in self.my_osid_object_form._my_map... |
def clear_files(self): """stub""" # This could also be implemented by iterating over self.clear_file() if self._files_metadata['required'] or self._files_metadata['read_only']: raise NoAccess() rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') catalog_id_str = '' if 'assignedBankIds' in self.my_osid_obj... |
def has_file_url(self): """stub""" return bool(self._get_asset_content( Id(self.my_osid_object._my_map['fileId']['assetId']), self.my_osid_object._my_map['fileId']['assetContentTypeId']).has_url()) |
def get_file_url(self): """stub""" if self.has_file_url(): return self._get_asset_content( Id(self.my_osid_object._my_map['fileId']['assetId']), self.my_osid_object._my_map['fileId']['assetContentTypeId']).get_url() raise IllegalState() |
def get_file(self): """stub""" if self.has_file_asset(): return self._get_asset_content( Id(self.my_osid_object._my_map['fileId']['assetId']), self.my_osid_object._my_map['fileId']['assetContentTypeId']).get_data() raise IllegalState() |
def _init_metadata(self): """stub""" self._file_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'file'), 'element_label': 'File', 'instructions': 'accepts an asset id and optional asset_content type', 'required': False, 'read_only': False, 'linked': False, 'array'... |
def set_file(self, asset_data=None, asset_type=None, asset_content_type=None, asset_name='', asset_description=''): """stub""" if asset_data is None: raise NullArgument() if not isinstance(asset_data, DataInputStream): raise InvalidArgument('asset_data must be instance of DataInputStream') if asset_type is not None and... |
def set_asset(self, asset_id, asset_content_type=None): """stub""" if asset_id is None: raise NullArgument('asset_id cannot be None') if not isinstance(asset_id, Id): raise InvalidArgument('asset_id must be an instance of Id') if asset_content_type is not None and not isinstance(asset_content_type, Type): raise Invalid... |
def clear_file(self): """stub""" if (self.get_file_metadata().is_read_only() or self.get_file_metadata().is_required()): raise NoAccess() if 'assetId' in self.my_osid_object_form._my_map['fileId']: rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') catalog_id_str = '' if 'assignedBankIds' in self.my_osid... |
def get_color_coordinate(self): """stub""" if self.has_color_coordinate(): color_dict = self.my_osid_object._my_map['colorCoordinate'] return RGBColorCoordinate(values=color_dict['values'], uncertainty_minus=color_dict['uncertaintyMinus'], uncertainty_plus=color_dict['uncertaintyPlus']) raise IllegalState('No color coo... |
def _update_object_map(self, obj_map): """stub""" if self.has_color_coordinate() and \ self.get_color_coordinate().get_coordinate_type() == RGB_COLOR_COORDINATE: obj_map['colorCoordinate']['hexValue'] = str(self.get_color_coordinate()) try: super(ColorCoordinateRecord, self)._update_object_map(obj_map) except Attribute... |
def _init_metadata(self): """stub""" self._min_decimal_value = None self._max_decimal_value = None self._color_coordinate_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'color_coordinate'), 'element_label': 'Color Coordinate', 'instructions': 'enter a color coord... |
def set_color_coordinate(self, coordinate=None): """stub""" if coordinate is None: raise NullArgument() if self.get_color_coordinate_metadata().is_read_only(): raise NoAccess() if not isinstance(coordinate, RGBColorCoordinate): raise InvalidArgument('coordinate must be instance of RGBColorCoordinate') self.my_osid_obje... |
def clear_color_coordinate(self): """stub""" if (self.get_color_coordinate_metadata().is_read_only() or self.get_color_coordinate_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['colorCoordinate'] = \ dict(self.get_color_coordinate_metadata().get_default_coordinate_values()[0]) |
def get_start_date_metadata(self): """Gets the metadata for a start date. return: (osid.Metadata) - metadata for the date *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._start_date_metadata) metadata.update({'existing_date_time_values': self.my_osid_object_form._my_map['startDate']... |
def set_start_date(self, date): """Sets the start date. arg: date (osid.calendaring.DateTime): the new date raise: InvalidArgument - ``date`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``date`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ if d... |
def clear_start_date(self): """Clears the start date. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if (self.get_start_date_metadata().is_read_only() or self.get_start_date_metadata().is_required()): raise NoAccess() ... |
def get_end_date_metadata(self): """Gets the metadata for an end date. return: (osid.Metadata) - metadata for the date *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._end_date_metadata) metadata.update({'existing_date_time_values': self.my_osid_object_form._my_map['endDate']}) retu... |
def set_end_date(self, date): """Sets the end date. arg: date (osid.calendaring.DateTime): the new date raise: InvalidArgument - ``date`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``date`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ if date ... |
def clear_end_date(self): """Clears the end date. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if (self.get_end_date_metadata().is_read_only() or self.get_end_date_metadata().is_required()): raise NoAccess() self.my_... |
def get_end_date(self): """Gets the end date. return: (osid.calendaring.DateTime) - the end date *compliance: mandatory -- This method must be implemented.* """ edate = self.my_osid_object._my_map['endDate'] return DateTime( edate.year, edate.month, edate.day, edate.hour, edate.minute, edate.second, edate.microsecond) |
def get_provider_metadata(self): """Gets the metadata for a provider. return: (osid.Metadata) - metadata for the provider *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._provider_metadata) metadata.update({'existing_id_values': self.my_osid_object_form._my_map['providerId']}) retur... |
def set_provider(self, provider_id): """Sets a provider. arg: provider_id (osid.id.Id): the new provider raise: InvalidArgument - ``provider_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``provider_id`` is ``null`` *compliance: mandatory -- This method must be implemented... |
def get_branding_metadata(self): """Gets the metadata for the asset branding. return: (osid.Metadata) - metadata for the asset branding. *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._branding_metadata) metadata.update({'existing_id_values': self.my_osid_object_form._my_map['brand... |
def set_branding(self, asset_ids): """Sets the branding. arg: asset_ids (osid.id.Id[]): the new assets raise: InvalidArgument - ``asset_ids`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``asset_ids`` is ``null`` *compliance: mandatory -- This method must be implemented.* """... |
def clear_branding(self): """Removes the branding. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if (self.get_branding_metadata().is_read_only() or self.get_branding_metadata().is_required()): raise NoAcce... |
def get_license_metadata(self): """Gets the metadata for the license. return: (osid.Metadata) - metadata for the license *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._license_metadata) metadata.update({'existing_string_values': self.my_osid_object_form._my_map['license']}) return... |
def set_license(self, license_): """Sets the license. arg: license (string): the new license raise: InvalidArgument - ``license`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``license`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ if license_ i... |
def get_provider_id(self): """Gets the ``Id`` of the provider. return: (osid.id.Id) - the provider ``Id`` *compliance: mandatory -- This method must be implemented.* """ if ('providerId' not in self.my_osid_object._my_map or not self.my_osid_object._my_map['providerId']): raise IllegalState('this sourceable object has ... |
def get_branding_ids(self): """Gets the branding asset ``Ids``. return: (osid.id.IdList) - a list of asset ``Ids`` *compliance: mandatory -- This method must be implemented.* """ if 'brandingIds' not in self.my_osid_object._my_map: return IdList([]) id_list = [] for idstr in self.my_osid_object._my_map['brandingIds']: ... |
def get_branding(self): """Gets a branding, such as an image or logo, expressed using the ``Asset`` interface. return: (osid.repository.AssetList) - a list of assets raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* """ mgr = self.my_osid_object._get_provide... |
def get_license(self): """Gets the terms of usage. An empty license means the terms are unknown. return: (osid.locale.DisplayText) - the license *compliance: mandatory -- This method must be implemented.* """ if 'license' in self.my_osid_object._my_map: license_text = self.my_osid_object._my_map['license'] return Displ... |
def get_display_names_metadata(self): """Gets the metadata for all display_names. return: (osid.Metadata) - metadata for the display_names *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._display_names_metadata) metadata.update({'existing_string_values': [t['text'] for t in self.my_... |
def get_descriptions_metadata(self): """Gets the metadata for all descriptions. return: (osid.Metadata) - metadata for the descriptions *compliance: mandatory -- This method must be implemented.* """ metadata = dict(self._descriptions_metadata) metadata.update({'existing_string_values': [t['text'] for t in self.my_osid... |
def add_display_name(self, display_name): """Adds a display_name. arg: display_name (displayText): the new display name raise: InvalidArgument - ``display_name`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``display_name`` is ``null`` *compliance: mandatory -- This method mu... |
def remove_display_name_by_language(self, language_type): """Removes the specified display_name. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.get_display_names_metadata().is_read_only(): raise NoA... |
def add_description(self, description): """Adds a description. arg: description (displayText): the new description raise: InvalidArgument - ``description`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``description`` is ``null`` *compliance: mandatory -- This method must be i... |
def remove_description_by_language(self, language_type): """Removes the specified description. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if self.get_descriptions_metadata().is_read_only(): raise NoAcce... |
def match_display_names(self, value, match): """stub""" if value is None: raise NullArgument('value must not be None') if not utilities.is_string(value): raise InvalidArgument('value must be a string') if match is None: raise NullArgument('match must not be None') if not isinstance(match, bool): raise InvalidArgument('... |
def add_member(self,grange): """Add a genomic range to the locus :param grange: :type grange: GenomicRange """ if self.use_direction and not grange.direction: sys.stderr.write("ERROR if using direction then direction of input members must be set\n") sys.exit() # Get range set properly if not self.range: self.range = Ge... |
def add_locus(self,inlocus): """ Adds a locus to our loci, but does not go through an update our locus sets yet""" if self.use_direction == True and inlocus.use_direction == False: sys.stderr.write("ERROR if using the direction in Loci, then every locus added needs use_direction to be True\n") sys.exit() self.loci.appe... |
def update_loci(self): """Goes through and combines loci until we have one set meeting our overlap definition""" # Create sub-loci for each chromosome lbc = {} chroms = sorted([x.range.chr for x in self.loci]) for chrom in chroms: lbc[chrom] = Loci() for x in self.loci: lbc[x.range.chr].add_locus(x) for chrom in sorted... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.