code
stringlengths
1
18.2k
def get_banks_by_query(self, bank_query): """Gets a list of ``Bank`` objects matching the given bank query. arg: bank_query (osid.assessment.BankQuery): the bank query return: (osid.assessment.BankList) - the returned ``BankList`` raise: NullArgument - ``bank_query`` is ``null`` raise: OperationFailed - unable to compl...
def can_create_bank_with_record_types(self, bank_record_types): """Tests if this user can create a single ``Bank`` using the desired record types. While ``AssessmentManager.getBankRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific `...
return self._catalog_session.can_create_catalog_with_record_types(catalog_record_types=bank_record_types) return True
def update_bank(self, bank_form): """Updates an existing bank. arg: bank_form (osid.assessment.BankForm): the form containing the elements to be updated raise: IllegalState - ``bank_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value raise: NullArgument - ``bank_form...
transaction') except KeyError: raise errors.Unsupported('bank_form did not originate from this session') if not bank_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(bank_form._my_map) # save is deprecated - change to replace_one self._forms[bank_form.get_id()...
def alias_bank(self, bank_id, alias_id): """Adds an ``Id`` to a ``Bank`` for the purpose of creating compatibility. The primary ``Id`` of the ``Bank`` is determined by the provider. The new ``Id`` is an alias to the primary ``Id``. If the alias is a pointer to another bank, it is reassigned to the given bank ``Id``. ar...
self._catalog_session.alias_catalog(catalog_id=bank_id, alias_id=alias_id) self._alias_id(primary_id=bank_id, equivalent_id=alias_id)
def get_root_banks(self): """Gets the root banks in this bank hierarchy. return: (osid.assessment.BankList) - the root banks raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure occurred *compliance: mandatory -- This method is must be implemented.* """ # Implemented from ...
def has_parent_banks(self, bank_id): """Tests if the ``Bank`` has any parents. arg: bank_id (osid.id.Id): a bank ``Id`` return: (boolean) - ``true`` if the bank has parents, ``false`` otherwise raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to co...
def is_parent_of_bank(self, id_, bank_id): """Tests if an ``Id`` is a direct parent of a bank. arg: id (osid.id.Id): an ``Id`` arg: bank_id (osid.id.Id): the ``Id`` of a bank return: (boolean) - ``true`` if this ``id`` is a parent of ``bank_id,`` ``false`` otherwise raise: NotFound - ``bank_id`` is not found raise: Nul...
def get_parent_bank_ids(self, bank_id): """Gets the parent ``Ids`` of the given bank. arg: bank_id (osid.id.Id): a bank ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete re...
def get_parent_banks(self, bank_id): """Gets the parents of the given bank. arg: bank_id (osid.id.Id): a bank ``Id`` return: (osid.assessment.BankList) - the parents of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete request r...
def is_ancestor_of_bank(self, id_, bank_id): """Tests if an ``Id`` is an ancestor of a bank. arg: id (osid.id.Id): an ``Id`` arg: bank_id (osid.id.Id): the ``Id`` of a bank return: (boolean) - ``true`` if this ``id`` is an ancestor of ``bank_id,`` ``false`` otherwise raise: NotFound - ``bank_id`` is not found raise: Nu...
def has_child_banks(self, bank_id): """Tests if a bank has any children. arg: bank_id (osid.id.Id): a ``bank_id`` return: (boolean) - ``true`` if the ``bank_id`` has children, ``false`` otherwise raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to ...
def is_child_of_bank(self, id_, bank_id): """Tests if a bank is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: bank_id (osid.id.Id): the ``Id`` of a bank return: (boolean) - ``true`` if the ``id`` is a child of ``bank_id,`` ``false`` otherwise raise: NotFound - ``bank_id`` not found raise: NullArgument...
def get_child_bank_ids(self, bank_id): """Gets the child ``Ids`` of the given bank. arg: bank_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete requ...
def get_child_banks(self, bank_id): """Gets the children of the given bank. arg: bank_id (osid.id.Id): the ``Id`` to query return: (osid.assessment.BankList) - the children of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete re...
def is_descendant_of_bank(self, id_, bank_id): """Tests if an ``Id`` is a descendant of a bank. arg: id (osid.id.Id): an ``Id`` arg: bank_id (osid.id.Id): the ``Id`` of a bank return: (boolean) - ``true`` if the ``id`` is a descendant of the ``bank_id,`` ``false`` otherwise raise: NotFound - ``bank_id`` not found raise...
def get_bank_nodes(self, bank_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given bank. arg: bank_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. a...
osid.resource.BinHierarchySession.get_bin_nodes return objects.BankNode(self.get_bank_node_ids( bank_id=bank_id, ancestor_levels=ancestor_levels, descendant_levels=descendant_levels, include_siblings=include_siblings)._my_map, runtime=self._runtime, proxy=self._proxy)
def add_root_bank(self, bank_id): """Adds a root bank. arg: bank_id (osid.id.Id): the ``Id`` of a bank raise: AlreadyExists - ``bank_id`` is already in hierarchy raise: NotFound - ``bank_id`` not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDen...
def remove_root_bank(self, bank_id): """Removes a root bank from this hierarchy. arg: bank_id (osid.id.Id): the ``Id`` of a bank raise: NotFound - ``bank_id`` not a parent of ``child_id`` raise: NullArgument - ``bank_id`` or ``child_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionD...
def add_child_bank(self, bank_id, child_id): """Adds a child to a bank. arg: bank_id (osid.id.Id): the ``Id`` of a bank arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``bank_id`` is already a parent of ``child_id`` raise: NotFound - ``bank_id`` or ``child_id`` not found raise: NullArgume...
def remove_child_bank(self, bank_id, child_id): """Removes a child from a bank. arg: bank_id (osid.id.Id): the ``Id`` of a bank arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``bank_id`` not parent of ``child_id`` raise: NullArgument - ``bank_id`` or ``child_id`` is ``null`` raise: OperationF...
def remove_child_banks(self, bank_id): """Removes all children from a bank. arg: bank_id (osid.id.Id): the ``Id`` of a bank raise: NotFound - ``bank_id`` is not in hierarchy raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure ...
def layered(self): """Yield list of [[(name, image), ...], [(name, image), ...], ...]""" result = [] for layer in self._layered: nxt = [] for name in layer: nxt.append((name, self.all_images[name])) result.append(nxt) return result
def unaccent(string, encoding="utf-8"): """not just unaccent, but full to-ascii transliteration""" string = to_unicode(string) if has_unidecode: return unidecode.unidecode(string) if PYTHON_VERSION < 3: if type(string) == str: string = unicode(string, encoding) nfkd_form = unicodedata.normalize('NFKD', string) return u...
def main(args): """Read any reference transcriptome we can""" txome = Transcriptome() #read the reference gpd if one is gven if args.reference: rinf = None if re.search('\.gz$',args.reference): rinf = gzip.open(args.reference) else: rinf = open(args.reference) sys.stderr.write("Reading in reference\n") z = 0 # populate...
partially annotated by overlapping locus.\n") annotated_reads(txome,gzip.open(args.tempdir+'/initial/partial_annotated_multiexon.sorted.gpd.gz'),'repartial',args) txs = {} for transcript in txome.transcripts: txs[transcript.name] = transcript detected = {} tinf = gzip.open(args.tempdir+'/initial/annotated.txt.gz') for ...
gzip.open(args.tempdir+'/final.gpd.gz','w') tinf = gzip.open(args.tempdir+'/candidate.sorted.gpd.gz') for line in tinf: tof.write(line) tinf.close() tinf = gzip.open(args.tempdir+'/unannotated/unannotated_multiexon.sorted.gpd.gz') for line in tinf: tof.write(line) tinf.close() tinf = gzip.open(args.tempdir+'/unannotate...
def annotated_reads(txome,sorted_read_stream,output,args): if not os.path.exists(args.tempdir+'/'+output): os.makedirs(args.tempdir+'/'+output) ts = OrderedStream(iter(txome.transcript_stream())) rs = OrderedStream(GPDStream(sorted_read_stream)) mls = MultiLocusStream([ts,rs]) aof = gzip.open(args.tempdir+'/'+output+'/...
ovs[0][3] aof.write(seread.name+"\t"+best_ref.name+"\tSE"+"\n") """May want an optional check for any better matches among exons""" #now we can look for best matches among multi-exon transcripts reads = [x for x in reads if x.get_exon_count() > 1] multiexon_refs = [x for x in refs if x.get_exon_count() > 1] unannotated...
reverse = True ) if len(subset) > 0: aof.write(read.name+"\t"+subset[0][0].name+"\tpartial"+"\n") continue #check for supersets superset = sorted([x for x in ovs if x[1].is_subset()==3], key = lambda y: (y[1].match_exon_count(), y[1].min_overlap_fraction()), reverse = True ) if len(superset) > 0: partial_annotated_mult...
in partial_annotated_multi_exon_reads: v[0].set_strand(v[1].direction) ### set the gene name of the transcript for v in partial_annotated_multi_exon_reads: v[0].set_gene_name(v[1].gene_name) d = Deconvolution(downsample([x[0] for x in partial_annotated_multi_exon_reads],args.downsample_locus)) groups = d.parse(toleranc...
x in se])) tx = Transcript([rng],Transcript.Options(direction='+')) of3.write(tx.get_gpd_line()+"\n") of1.close() of2.close() of3.close() sys.stderr.write("\n") """Sort our progress""" sys.stderr.write("sort transcriptome\n") sort_gpd(args.tempdir+'/'+output+'/partial_annotated_multiexon.gpd.gz',args.tempdir+'/'+output...
def weekly_growth(self, weeks): """Calculate the weekly growth in percentage, and rounds to one digit. Parameters ---------- weeks Number of weeks to calculate growth over. Returns ------- growth_factor A real number such that start * growth_factor** weeks = end. Examples ------- >>> bench = DynamicExercise('Bench pres...
def _set_family_view(self, session): """Sets the underlying family view to match current view""" if self._family_view == COMPARATIVE: try: session.use_comparative_family_view() except AttributeError: pass else: try: session.use_plenary_family_view() except AttributeError: pass
def use_comparative_family_view(self): """Pass through to provider FamilyLookupSession.use_comparative_family_view""" self._family_view = COMPARATIVE # self._get_provider_session('family_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_comparative_fam...
def use_plenary_family_view(self): """Pass through to provider FamilyLookupSession.use_plenary_family_view""" self._family_view = PLENARY # self._get_provider_session('family_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_plenary_family_view() excep...
def get_families_by_ids(self, *args, **kwargs): """Pass through to provider FamilyLookupSession.get_families_by_ids""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_by_ids catalogs = self._get_provider_session('family_lookup_session').get_families_by_ids(*args, **kwargs) cat_list =...
def get_families(self): """Pass through to provider FamilyLookupSession.get_families""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_template catalogs = self._get_provider_session('family_lookup_session').get_families() cat_list = [] for cat in catalogs: cat_list.append(Family(sel...
def get_family_form(self, *args, **kwargs): """Pass through to provider FamilyAdminSession.get_family_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(args[-1], list) or 'fami...
def update_family(self, *args, **kwargs): """Pass through to provider FamilyAdminSession.update_family""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin # OSID spec does not require returning updated catalog return Family( self._provider_manager, self._get_provider_session('family_...
def save_family(self, family_form, *args, **kwargs): """Pass through to provider FamilyAdminSession.update_family""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin if family_form.is_for_update(): return self.update_family(family_form, *args, **kwargs) else: return self.create_famil...
def _set_family_view(self, session): """Sets the underlying family view to match current view""" if self._family_view == FEDERATED: try: session.use_federated_family_view() except AttributeError: pass else: try: session.use_isolated_family_view() except AttributeError: pass
def _get_provider_session(self, session_name): """Returns the requested provider session. Instantiates a new one if the named session is not already known. """ agent_key = self._get_agent_key() if session_name in self._provider_sessions[agent_key]: return self._provider_sessions[agent_key][session_name] else: session_c...
def use_comparative_relationship_view(self): """Pass through to provider RelationshipLookupSession.use_comparative_relationship_view""" self._object_views['relationship'] = COMPARATIVE # self._get_provider_session('relationship_lookup_session') # To make sure the session is tracked for session in self._get_provider_ses...
def use_plenary_relationship_view(self): """Pass through to provider RelationshipLookupSession.use_plenary_relationship_view""" self._object_views['relationship'] = PLENARY # self._get_provider_session('relationship_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try...
def use_federated_family_view(self): """Pass through to provider RelationshipLookupSession.use_federated_family_view""" self._family_view = FEDERATED # self._get_provider_session('relationship_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_federated...
def use_isolated_family_view(self): """Pass through to provider RelationshipLookupSession.use_isolated_family_view""" self._family_view = ISOLATED # self._get_provider_session('relationship_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_isolated_fam...
def get_relationship_form(self, *args, **kwargs): """Pass through to provider RelationshipAdminSession.get_relationship_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[...
def save_relationship(self, relationship_form, *args, **kwargs): """Pass through to provider RelationshipAdminSession.update_relationship""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if relationship_form.is_for_update(): return self.update_relationship(relationship_f...
def get_error(exc): """ Return the appropriate HTTP status code according to the Exception/Error. """ if isinstance(exc, HTTPError): # Returning the HTTP Error code coming from requests module return exc.response.status_code, text(exc.response.content) if isinstance(exc, Timeout): # A timeout is a 408, and it's not a H...
def get_form_kwargs(self): """ Return the form kwargs. This method injects the context variable, defined in :meth:`get_agnocomplete_context`. Override this method to adjust it to your needs. """ data = super(UserContextFormViewMixin, self).get_form_kwargs() data.update({ 'user': self.get_agnocomplete_context(), }) retu...
def get_klass(self): """ Return the agnocomplete class to be used with the eventual query. """ # Extract the klass name from the URL arguments klass_name = self.kwargs.get('klass', None) klass = self.registry.get(klass_name, None) if not klass: raise Http404("Unknown autocomplete class `{}`".format(klass_name)) return ...
def parse_v3_unit_placement(placement_str): """Return a UnitPlacement for bundles version 3, given a placement string. See https://github.com/juju/charmstore/blob/v4/docs/bundles.md Raise a ValueError if the placement is not valid. """ placement = placement_str container = machine = service = unit = '' if ':' in placem...
on machines ' b'other than 0') return UnitPlacement(container, machine, service, unit)
def parse_v4_unit_placement(placement_str): """Return a UnitPlacement for bundles version 4, given a placement string. See https://github.com/juju/charmstore/blob/v4/docs/bundles.md Raise a ValueError if the placement is not valid. """ placement = placement_str container = machine = service = unit = '' if ':' in placem...
def _parse_unit(unit, placement_str): """Parse a unit as part of the unit placement. Return the unit as an integer or None. Raise a ValueError if the unit is specified but it is not a digit. """ if not unit: return None try: return int(unit) except (TypeError, ValueError): msg = 'unit in placement {} must be digit'.for...
def get(self, endpoint): """ Todo """ r = self.http.request('GET', self._api_base.format(endpoint), headers={'Authorization': 'Bot '+self.token}) if r.status == 200: return json.loads(r.data.decode('utf-8')) else: return {}
def post(self, endpoint, message): """ Todo """ r = self.http.request('POST', self._api_base.format(endpoint), headers={'Content-Type': 'application/json', 'Authorization': 'Bot '+self.token}, body=message.encode('utf-8'))
def connect(self): """ Todo """ r = self.get('gateway') self.ws = websocket.WebSocketApp(r["url"]+"/?encoding=json&v=6", on_message=self.on_message, on_error=self.on_error, on_close=self.on_close) self.ws.on_open = self.on_connect
def on_message(self, ws, message): """ Todo """ m = json.loads(message) self.logger.debug(m) if m.get("s", 0): self.sequence = m["s"] if m["op"] == self.DISPATCH: if m["t"] == "READY": for channel in m["d"]["private_channels"]: if len(channel["recipients"]) == 1: self.channels[channel["id"]] = User(channel["recipients"...
def on_error(self, ws, error): """ Todo """ if type(error).__name__ == "KeyboardInterrupt": sys.exit() self.logger.debug("error")
def on_connect(self, ws): """ Todo """ self.logger.info("onconnect") msg = {'op': self.IDENTIFY, 'd': {'token': self.token, 'properties': {'$os': 'lnx', '$browser': 'discord_simple', '$device': 'discord_simple', '$refferer': '', '$reffering_domain': ''}, 'compress': False, 'large_threshold': 250, 'v' : 3}} ws.send(json...
def send_message(self, user=None, message=None, channel=None): """ Todo """ self.logger.info("sending message to %s: %s", user, message) cid=channel if not cid: for cid in self.channels: if str(self.channels[cid]) == str(user): channel=cid self.logger.debug(cid) if (channel): self.post('channels/'+cid+'/messages', json...
def run(self): """ Todo """ self.logger.debug("heartbeat started") while True: time.sleep(self.interval) self.send_heartbeat()
def send_heartbeat(self): """ Todo """ self.logger.debug("heartbeat "+str(self.t.sequence)) self.t.ws.send(json.dumps({'op': self.t.HEARTBEAT, 'd': self.t.sequence}))
def multiprocessing_apply_infer(object_id): """ Used in the InferenceWithRestarts class. Needs to be in global scope for multiprocessing module to pick it up """ global inference_objects, inference_args, inference_kwargs return inference_objects[object_id]._infer_raw(*inference_args, **inference_kwargs)
def reps_to_intensity(reps, slope=-4.8, constant=97.5, quadratic=True): """A function mapping from repetitions in the range 1 to 12 to intensities in the range 0 to 100. Parameters ---------- reps The number of repetitions to map to the intensity range. slope Slope for the linear function. constant Constant for the lin...
** 2 else: return intensity
def progression_linear(week, start_weight, final_weight, start_week, end_week): """A linear progression function going through the points ('start_week', 'start_weight') and ('end_week', 'final_weight'), evaluated in 'week'. Parameters ---------- week The week to evaluate the linear function at. start_weight The weight ...
(week - start_week) + start_weight
def progression_sinusoidal(week, start_weight, final_weight, start_week, end_week, periods=2, scale=0.025, offset=0): """A sinusoidal progression function going through the points ('start_week', 'start_weight') and ('end_week', 'final_weight'), evaluated in 'week'. This function calls a linear progression function and ...
1, 8) 106.44931454758678 """ # Get the linear model linear = progression_linear(week, start_weight, final_weight, start_week, end_week) # Calculate the time period and the argument to the sine function time_period = end_week - start_week sine_argument = ((week - offset - start_week) * (math.pi * 2) / (time_period / per...
def generate_one(self): """Generate a single element. Returns ------- element An element from the domain. Examples ------- >>> generator = RepellentGenerator(['a', 'b']) >>> gen_item = generator.generate_one() >>> gen_item in ['a', 'b'] True """ # Get the weights for all items in the domain weights = [self.probability_...
def get_comments(self): """Gets the comment list resulting from a search. return: (osid.commenting.CommentList) - the comment list raise: IllegalState - list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been ret...
def get_books(self): """Gets the book list resulting from a search. return: (osid.commenting.BookList) - the book list raise: IllegalState - list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.IllegalState('List has already been retrieved.') se...
def get_assessment_part_mdata(): """Return default mdata map for AssessmentPart""" return { 'assessment_part': { 'element_label': { 'text': 'assessment part', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'a...
'array': False, 'default_cardinal_values': [None], 'syntax': 'CARDINAL', 'minimum_cardinal': None, 'maximum_cardinal': None, 'cardinal_set': [] }, 'allocated_time': { 'element_label': { 'text': 'allocated time', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(...
def get_sequence_rule_mdata(): """Return default mdata map for SequenceRule""" return { 'next_assessment_part': { 'element_label': { 'text': 'next assessment part', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'tex...
False, 'array': False, 'default_id_values': [''], 'syntax': 'ID', 'id_set': [], }, 'minimum_score': { 'element_label': { 'text': 'minimum score', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'enter a cardin...
def get_authorization_mdata(): """Return default mdata map for Authorization""" return { 'function': { 'element_label': { 'text': 'function', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'formatTypeId': str(DEFAULT_FORMAT_TYPE), }, 'instructions': { 'text': 'accepts an osid.id...
def match_timestamp(self, start_time, end_time, match): """Matches the time of this log entry. arg: start_time (osid.calendaring.DateTime): start time arg: end_time (osid.calendaring.DateTime): end time arg: match (boolean): ``true`` if for a positive match, ``false`` for a negative match raise: InvalidArgument - ``sta...
def _set_repository_view(self, session): """Sets the underlying repository view to match current view""" if self._repository_view == COMPARATIVE: try: session.use_comparative_repository_view() except AttributeError: pass else: try: session.use_plenary_repository_view() except AttributeError: pass
def use_plenary_repository_view(self): """Pass through to provider AssetRepositorySession.use_plenary_repository_view""" self._repository_view = PLENARY # self._get_provider_session('asset_repository_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_plenary_r...
def use_comparative_composition_repository_view(self): """Pass through to provider CompositionRepositorySession.use_comparative_composition_repository_view""" self._repository_view = COMPARATIVE # self._get_provider_session('composition_repository_session') # To make sure the session is tracked for session in self._get...
def get_repositories_by_composition(self, *args, **kwargs): """Pass through to provider CompositionRepositorySession.get_repositories_by_composition""" # Implemented from kitosid template for - # osid.resource.ResourceBinSession.get_bins_by_resource catalogs = self._get_provider_session('composition_repository_session'...
def get_repositories(self): """Pass through to provider RepositoryLookupSession.get_repositories""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_template catalogs = self._get_provider_session('repository_lookup_session').get_repositories() cat_list = [] for cat in catalogs: cat_li...
def create_repository(self, *args, **kwargs): """Pass through to provider RepositoryAdminSession.create_repository""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.create_bin return Repository( self._provider_manager, self._get_provider_session('repository_admin_session').create_repository(*...
def get_repository_form(self, *args, **kwargs): """Pass through to provider RepositoryAdminSession.get_repository_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(args[-1], li...
def save_repository(self, repository_form, *args, **kwargs): """Pass through to provider RepositoryAdminSession.update_repository""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin if repository_form.is_for_update(): return self.update_repository(repository_form, *args, **kwargs) el...
def _set_repository_view(self, session): """Sets the underlying repository view to match current view""" if self._repository_view == FEDERATED: try: session.use_federated_repository_view() except AttributeError: pass else: try: session.use_isolated_repository_view() except AttributeError: pass
def use_comparative_asset_view(self): """Pass through to provider AssetLookupSession.use_comparative_asset_view""" self._object_views['asset'] = COMPARATIVE # self._get_provider_session('asset_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_comparati...
def use_plenary_asset_view(self): """Pass through to provider AssetLookupSession.use_plenary_asset_view""" self._object_views['asset'] = PLENARY # self._get_provider_session('asset_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_plenary_asset_view() ...
def use_federated_repository_view(self): """Pass through to provider AssetLookupSession.use_federated_repository_view""" self._repository_view = FEDERATED # self._get_provider_session('asset_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_federated_r...
def use_isolated_repository_view(self): """Pass through to provider AssetLookupSession.use_isolated_repository_view""" self._repository_view = ISOLATED # self._get_provider_session('asset_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_isolated_repos...
def get_asset_form(self, *args, **kwargs): """Pass through to provider AssetAdminSession.get_asset_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) or 'asset_...
def save_asset(self, asset_form, *args, **kwargs): """Pass through to provider AssetAdminSession.update_asset""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if asset_form.is_for_update(): return self.update_asset(asset_form, *args, **kwargs) else: return self.create_as...
def use_comparative_asset_composition_view(self): """Pass through to provider AssetCompositionSession.use_comparative_asset_composition_view""" self._object_views['asset_composition'] = COMPARATIVE # self._get_provider_session('asset_composition_session') # To make sure the session is tracked for session in self._get_p...