_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q47800
SAM._get_alignment_ranges
train
def _get_alignment_ranges(self): """A key method to extract the alignment data from the line""" if not self.is_aligned(): return None alignment_ranges = [] cig = [x[:] for x in self.cigar_array] target_pos = self.entries.pos query_pos = 1 while len(cig) > 0: c = cig.pop(0) if re....
python
{ "resource": "" }
q47801
SAM.target_range
train
def target_range(self): """Get the range on the target strand :return: target range :rtype: GenomicRange """ if not self.is_aligned(): return None if self._target_range: return self._target_range # check cache global _sam_cigar_target_add tlen = sum([x[0] for x in self.cigar_array if _s...
python
{ "resource": "" }
q47802
SAM.cigar_array
train
def cigar_array(self): """cache this one to speed things up a bit""" if self._cigar: return self._cigar self._cigar = [CIGARDatum(int(m[0]),m[1]) for m in re.findall('([0-9]+)([MIDNSHP=X]+)',self.entries.cigar)] return self._cigar
python
{ "resource": "" }
q47803
SAM.tags
train
def tags(self): """Access the auxillary data here""" if self._tags: return self._tags tags = {} if not tags: return {} for m in [[y.group(1),y.group(2),y.group(3)] for y in [re.match('([^:]{2,2}):([^:]):(.+)$',x) for x in self.entries.optional_fields.split("\t")]]: if m[1] == 'i': m[2] ...
python
{ "resource": "" }
q47804
eq_central_moments
train
def eq_central_moments(n_counter, k_counter, dmu_over_dt, species, propensities, stoichiometry_matrix, max_order): r""" Function used to calculate the terms required for use in equations giving the time dependence of central moments. The function returns the list Containing the sum of the following terms i...
python
{ "resource": "" }
q47805
BitMEX.authenticate
train
def authenticate(self): """Set BitMEX authentication information.""" if self.apiKey: return loginResponse = self._curl_bitmex( api="user/login", postdict={'email': self.login, 'password': self.password, 'token': self.otpToken}) self.token = loginRespon...
python
{ "resource": "" }
q47806
BitMEX.authentication_required
train
def authentication_required(function): """Annotation for methods that require auth.""" def wrapped(self, *args, **kwargs): if not (self.token or self.apiKey): msg = "You must be authenticated to use this method" raise AuthenticationError(msg) else:...
python
{ "resource": "" }
q47807
BitMEX.open_orders
train
def open_orders(self, symbol=None): """Get open orders via HTTP. Used on close to ensure we catch them all.""" api = "order" query = {'ordStatus.isTerminated': False } if symbol != None: query['symbol'] =symbol orders = self._curl_bitmex( api=api, ...
python
{ "resource": "" }
q47808
BitMEX.cancel
train
def cancel(self, orderID): """Cancel an existing order.""" api = "order" postdict = { 'orderID': orderID, } return self._curl_bitmex(api=api, postdict=postdict, verb="DELETE")
python
{ "resource": "" }
q47809
Module.add_handler
train
def add_handler(self, event, handler): """Adds a handler function for an event. Note: Only one handler function is allowed per event on the module level (different modules can provide handlers for the same event). This is because ordering of handler functions is not guaranteed to ...
python
{ "resource": "" }
q47810
Module.handle
train
def handle(event): """Decorator for indicating that a given method handles an event. Note: while multiple instances of this decorator may be applied to a single method, it is not recommended. """ def dec(func): if not hasattr(func, '_handle_events'): ...
python
{ "resource": "" }
q47811
Module.start
train
def start(self, reloading=False): """Called when the module is loaded. If the load is due to a reload of the module, then the 'reloading' argument will be set to True. By default, this method calls the controller's listen() for each event in the self.event_handlers dict. """ ...
python
{ "resource": "" }
q47812
Module.handle_event
train
def handle_event(self, event, client, args): """Dispatch an event to its handler. Note: the handler does not receive the event which triggered its call. If you want to handle more than one event, it's recommended to put the shared handling in a separate function, and create wrapper hand...
python
{ "resource": "" }
q47813
Module.trigger_event
train
def trigger_event(self, event, client, args, force_dispatch=False): """Trigger a new event that will be dispatched to all modules.""" self.controller.process_event(event, client, args, force_dispatch=force_dispatch)
python
{ "resource": "" }
q47814
Controller.listen
train
def listen(self, event): """Request that the Controller listen for and dispatch an event. Note: Even if the module that requested the listening is later unloaded, the Controller will continue to dispatch the event, there just might not be anything that cares about it. That's okay. ...
python
{ "resource": "" }
q47815
Controller.start
train
def start(self): """Begin listening for events from the Client and acting upon them. Note: If configuration has not already been loaded, it will be loaded immediately before starting to listen for events. Calling this method without having specified and/or loaded a configuration will re...
python
{ "resource": "" }
q47816
Controller.process_event
train
def process_event(self, event, client, args, force_dispatch=False): """Process an incoming event. Offers it to each module according to self.module_ordering, continuing to the next unless the module inhibits propagation. Returns True if a module inhibited propagation, otherwise False. ...
python
{ "resource": "" }
q47817
Controller.load_config
train
def load_config(self, config_path=None): """Load configuration from the specified path, or self.config_path""" if config_path is None: config_path = self.config_path else: self.config_path = config_path config = ConfigParser.SafeConfigParser(self.DEFAULT_SUBSTITU...
python
{ "resource": "" }
q47818
Controller.save_config
train
def save_config(self, config_path=None): """Save configuration to the specified path, or self.config_path""" if config_path is None: config_path = self.config_path else: self.config_path = config_path with open(config_path, 'w') as f: self.config.writ...
python
{ "resource": "" }
q47819
Controller.reload_module
train
def reload_module(self, module_name): """Reloads the specified module without changing its ordering. 1. Calls stop(reloading=True) on the module 2. Reloads the Module object into .loaded_modules 3. Calls start(reloading=True) on the new object If called with a module na...
python
{ "resource": "" }
q47820
Controller.load_module
train
def load_module(self, module_name): """Attempts to load the specified module. If successful, .loaded_modules[module_name] will be populated, and module_name will be added to the end of .module_ordering as well if it is not already present. Note that this function does NOT call s...
python
{ "resource": "" }
q47821
Controller.unload_module
train
def unload_module(self, module_name): """Unload the specified module, if it is loaded.""" module = self.loaded_modules.get(module_name) if not module: _log.warning("Ignoring request to unload non-existant module '%s'", module_name) return False ...
python
{ "resource": "" }
q47822
_parse_url
train
def _parse_url(url, fully_qualified=False): """Parse the given charm or bundle URL, provided as a string. Return a tuple containing the entity reference fragments: schema, user, series, name and revision. Each fragment is a string except revision (int). Raise a ValueError with a descriptive messag...
python
{ "resource": "" }
q47823
HarpoonSpec.tasks_spec
train
def tasks_spec(self, available_actions, default_action="run"): """Tasks for a particular image""" return dictof( self.task_name_spec , create_spec(task_objs.Task, validators.deprecated_key("spec", "Use ``action`` and ``options`` instead (note that ``action`` defaults to run)") ...
python
{ "resource": "" }
q47824
HarpoonSpec.authentications_spec
train
def authentications_spec(self): """Spec for a group of authentication options""" return container_spec(authentication_objs.Authentication , dictof(string_spec(), set_options( reading = optional_spec(authentication_spec()) , writing = optional_spec(authenti...
python
{ "resource": "" }
q47825
HarpoonSpec.wait_condition_spec
train
def wait_condition_spec(self): """Spec for a wait_condition block""" from harpoon.option_spec import image_objs formatted_string = formatted(string_spec(), formatter=MergedOptionStringFormatter) return create_spec(image_objs.WaitCondition , harpoon = formatted(overridden("{ha...
python
{ "resource": "" }
q47826
HarpoonSpec.context_spec
train
def context_spec(self): """Spec for specifying context options""" from harpoon.option_spec import image_objs return dict_from_bool_spec(lambda meta, val: {"enabled": val} , create_spec(image_objs.Context , validators.deprecated_key("use_git_timestamps", "Since docker ...
python
{ "resource": "" }
q47827
HarpoonSpec.harpoon_spec
train
def harpoon_spec(self): """Spec for harpoon options""" formatted_string = formatted(string_spec(), MergedOptionStringFormatter, expected_type=six.string_types) formatted_boolean = formatted(boolean(), MergedOptionStringFormatter, expected_type=bool) return create_spec(Harpoon ...
python
{ "resource": "" }
q47828
Node.namespace_uri
train
def namespace_uri(self): """ Finds and returns first applied URI of this node that has a namespace. :return str: uri """ try: return next( iter(filter(lambda uri: URI(uri).namespace, self._uri)) ) except StopIteration: ...
python
{ "resource": "" }
q47829
SignedAuthBase.pre_dispatch
train
def pre_dispatch(self, request, path_args): """ Pre dispatch hook """ secret_key = self.get_secret_key(request, path_args) if not secret_key: raise PermissionDenied('Signature not valid.') try: signing.verify_url_path(request.path, request.GET, se...
python
{ "resource": "" }
q47830
CatalogSearchResults.get_catalogs
train
def get_catalogs(self): """Gets the catalog list resulting from the search. return: (osid.cataloging.CatalogList) - the catalogs list raise: IllegalState - list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved...
python
{ "resource": "" }
q47831
AuthorizationManager.get_authorization_session
train
def get_authorization_session(self): """Gets an ``AuthorizationSession`` which is responsible for performing authorization checks. return: (osid.authorization.AuthorizationSession) - an authorization session for this service raise: OperationFailed - unable to complete request ...
python
{ "resource": "" }
q47832
AuthorizationManager.get_authorization_session_for_vault
train
def get_authorization_session_for_vault(self, vault_id): """Gets an ``AuthorizationSession`` which is responsible for performing authorization checks for the given vault. arg: vault_id (osid.id.Id): the ``Id`` of the vault return: (osid.authorization.AuthorizationSession) - ``an ...
python
{ "resource": "" }
q47833
AuthorizationManager.get_authorization_lookup_session
train
def get_authorization_lookup_session(self): """Gets the ``OsidSession`` associated with the authorization lookup service. return: (osid.authorization.AuthorizationLookupSession) - an ``AuthorizationLookupSession`` raise: OperationFailed - unable to complete request rais...
python
{ "resource": "" }
q47834
AuthorizationManager.get_authorization_query_session
train
def get_authorization_query_session(self): """Gets the ``OsidSession`` associated with the authorization query service. return: (osid.authorization.AuthorizationQuerySession) - an ``AuthorizationQuerySession`` raise: OperationFailed - unable to complete request raise: ...
python
{ "resource": "" }
q47835
AuthorizationManager.get_authorization_query_session_for_vault
train
def get_authorization_query_session_for_vault(self, vault_id): """Gets the ``OsidSession`` associated with the authorization query service for the given vault. arg: vault_id (osid.id.Id): the ``Id`` of the vault return: (osid.authorization.AuthorizationQuerySession) - ``an _a...
python
{ "resource": "" }
q47836
AuthorizationManager.get_authorization_admin_session
train
def get_authorization_admin_session(self): """Gets the ``OsidSession`` associated with the authorization administration service. return: (osid.authorization.AuthorizationAdminSession) - an ``AuthorizationAdminSession`` raise: OperationFailed - unable to complete request ...
python
{ "resource": "" }
q47837
AuthorizationManager.get_authorization_admin_session_for_vault
train
def get_authorization_admin_session_for_vault(self, vault_id): """Gets the ``OsidSession`` associated with the authorization admin service for the given vault. arg: vault_id (osid.id.Id): the ``Id`` of the vault return: (osid.authorization.AuthorizationAdminSession) - ``an _a...
python
{ "resource": "" }
q47838
AuthorizationManager.get_authorization_vault_session
train
def get_authorization_vault_session(self): """Gets the session for retrieving authorization to vault mappings. return: (osid.authorization.AuthorizationVaultSession) - an ``AuthorizationVaultSession`` raise: OperationFailed - unable to complete request raise: Unimpleme...
python
{ "resource": "" }
q47839
AuthorizationManager.get_authorization_vault_assignment_session
train
def get_authorization_vault_assignment_session(self): """Gets the session for assigning authorizations to vault mappings. return: (osid.authorization.AuthorizationVaultAssignmentSession) - a ``AuthorizationVaultAssignmentSession`` raise: OperationFailed - unable to complete req...
python
{ "resource": "" }
q47840
AuthorizationManager.get_vault_lookup_session
train
def get_vault_lookup_session(self): """Gets the OsidSession associated with the vault lookup service. return: (osid.authorization.VaultLookupSession) - a ``VaultLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_vault_...
python
{ "resource": "" }
q47841
AuthorizationManager.get_vault_admin_session
train
def get_vault_admin_session(self): """Gets the OsidSession associated with the vault administration service. return: (osid.authorization.VaultAdminSession) - a ``VaultAdminSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_v...
python
{ "resource": "" }
q47842
AuthorizationManager.get_vault_hierarchy_session
train
def get_vault_hierarchy_session(self): """Gets the session traversing vault hierarchies. return: (osid.authorization.VaultHierarchySession) - a ``VaultHierarchySession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_vault_hierarc...
python
{ "resource": "" }
q47843
AuthorizationManager.get_vault_hierarchy_design_session
train
def get_vault_hierarchy_design_session(self): """Gets the session designing vault hierarchies. return: (osid.authorization.VaultHierarchyDesignSession) - a ``VaultHierarchyDesignSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supp...
python
{ "resource": "" }
q47844
AuthorizationProxyManager.get_authorization_lookup_session_for_vault
train
def get_authorization_lookup_session_for_vault(self, vault_id, proxy): """Gets the ``OsidSession`` associated with the authorization lookup service for the given vault. arg: vault_id (osid.id.Id): the ``Id`` of the vault arg: proxy (osid.proxy.Proxy): a proxy return: (osid.authori...
python
{ "resource": "" }
q47845
AuthorizationProxyManager.get_vault_query_session
train
def get_vault_query_session(self, proxy): """Gets the OsidSession associated with the vault query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.authorization.VaultQuerySession) - a ``VaultQuerySession`` raise: NullArgument - ``proxy`` is ``null`` ...
python
{ "resource": "" }
q47846
TOTPDeviceAdmin2.qr_code
train
def qr_code(self, instance): """ Display picture of QR-code from used secret """ try: return self._qr_code(instance) except Exception as err: if settings.DEBUG: import traceback return "<pre>%s</pre>" % traceback.format_exc(...
python
{ "resource": "" }
q47847
TOTPDeviceAdmin2.tokens
train
def tokens(self, instance): """ Just display current acceptable TOTP tokens """ if not instance.pk: # e.g.: Use will create a new TOTP entry return "-" totp = TOTP(instance.bin_key, instance.step, instance.t0, instance.digits) tokens = [] ...
python
{ "resource": "" }
q47848
parse
train
def parse(text, showToc=True): """Returns HTML from MediaWiki markup""" p = Parser(show_toc=showToc) return p.parse(text)
python
{ "resource": "" }
q47849
to_unicode
train
def to_unicode(text, charset=None): """Convert a `str` object to an `unicode` object. If `charset` is given, we simply assume that encoding for the text, but we'll use the "replace" mode so that the decoding will always succeed. If `charset` is ''not'' specified, we'll make some guesses, first trying the UTF-8 e...
python
{ "resource": "" }
q47850
str2url
train
def str2url(str): """ Takes a UTF-8 string and replaces all characters with the equivalent in 7-bit ASCII. It returns a plain ASCII string usable in URLs. """ try: str = str.encode('utf-8') except: pass mfrom = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîï" to = "AAAAAAECEEEEIIIIDNOOOOOOUUUUYSaaaaaaaceee...
python
{ "resource": "" }
q47851
BaseParser.removeHtmlTags
train
def removeHtmlTags(self, text): """convert bad tags into HTML identities""" sb = [] text = self.removeHtmlComments(text) bits = text.split(u'<') sb.append(bits.pop(0)) tagstack = [] tablestack = tagstack for x in bits: m = _tagPattern.match(x) if not m: continue slash, t, params, brace, res...
python
{ "resource": "" }
q47852
BaseParser.decodeTagAttributes
train
def decodeTagAttributes(self, text): """docstring for decodeTagAttributes""" attribs = {} if text.strip() == u'': return attribs scanner = _attributePat.scanner(text) match = scanner.search() while match: key, val1, val2, val3, val4 = match.groups() value = val1 or val2 or val3 or val4 if value:...
python
{ "resource": "" }
q47853
BaseParser.validateTagAttributes
train
def validateTagAttributes(self, attribs, element): """docstring for validateTagAttributes""" out = {} if element not in _whitelist: return out whitelist = _whitelist[element] for attribute in attribs: value = attribs[attribute] if attribute not in whitelist: continue # Strip javascript "expres...
python
{ "resource": "" }
q47854
BaseParser.safeEncodeAttribute
train
def safeEncodeAttribute(self, encValue): """docstring for safeEncodeAttribute""" encValue = encValue.replace(u'&', u'&amp;') encValue = encValue.replace(u'<', u'&lt;') encValue = encValue.replace(u'>', u'&gt;') encValue = encValue.replace(u'"', u'&quot;') encValue = encValue.replace(u'{', u'&#123;') encVa...
python
{ "resource": "" }
q47855
BaseParser.checkCss
train
def checkCss(self, value): """docstring for checkCss""" stripped = self.decodeCharReferences(value) stripped = _cssCommentPat.sub(u'', stripped) value = stripped stripped = _toUTFPat.sub(self._convertToUtf8, stripped) stripped.replace(u'\\', u'') if _hackPat.search(stripped): # someone is haxx0ring ...
python
{ "resource": "" }
q47856
BaseParser.fixtags
train
def fixtags(self, text): """Clean up special characters, only run once, next-to-last before doBlockLevels""" # french spaces, last one Guillemet-left # only if there is something before the space text = _guillemetLeftPat.sub(ur'\1&nbsp;\2', text) # french spaces, Guillemet-right text = _guillemetRightPat.su...
python
{ "resource": "" }
q47857
BaseParser.openList
train
def openList(self, char, mLastSection): """ These next three functions open, continue, and close the list element appropriate to the prefix character passed into them. """ result = self.closeParagraph(mLastSection) mDTopen = False if char == u'*': result += u'<ul><li>' elif char == u'#': result +...
python
{ "resource": "" }
q47858
is_valid_package_module_name
train
def is_valid_package_module_name(name): """ Test whether it's a valid package or module name. - a-z, 0-9, and underline - starts with underline or alpha letter valid: - ``a`` - ``a.b.c`` - ``_a`` - ``_a._b._c`` invalid: - ``A`` - ``0`` - ``.a`` - ``a#b`` ...
python
{ "resource": "" }
q47859
Program._set_scalers
train
def _set_scalers(self): """ Set the variables self._scalers as given by self.scalers, if self.scalers is None, then a default value is used. """ # Set default value for rep_scalers if None if self.rep_scalers is None: # Draw self-repellent numbers from domain...
python
{ "resource": "" }
q47860
Program._set_jinja2_enviroment
train
def _set_jinja2_enviroment(self): """ Set up the jinja2 environment. """ template_loader = FileSystemLoader(searchpath=self.TEMPLATE_DIR) env = Environment(loader=template_loader, trim_blocks=True, lstrip_blocks=True) env.globals.update(chunker...
python
{ "resource": "" }
q47861
Program.to_html
train
def to_html(self, table_width=5): """Write the program information to HTML code, which can be saved, printed and brought to the gym. Parameters ---------- table_width The table with of the HTML code. Returns ------- string HTML co...
python
{ "resource": "" }
q47862
Program.to_txt
train
def to_txt(self, verbose=False): """Write the program information to text, which can be printed in a terminal. Parameters ---------- verbose If True, more information is shown. Returns ------- string Program as text. """ ...
python
{ "resource": "" }
q47863
Program.to_tex
train
def to_tex(self, text_size='large', table_width=5, clear_pages = False): """ Write the program information to a .tex file, which can be rendered to .pdf running pdflatex. The program can then be printed and brought to the gym. Parameters ---------- text_size ...
python
{ "resource": "" }
q47864
Program._autoset_min_reps_consistency
train
def _autoset_min_reps_consistency(self): """ Sets the program mode to 'weekly', 'daily' or 'exercise' by automatically iterating over all exercises. """ # ------------------------------------------- # Set automatically by investigating program # -----------------...
python
{ "resource": "" }
q47865
OsidExtensibleQuery._load_records
train
def _load_records(self, record_type_idstrs): """Loads query records""" for record_type_idstr in record_type_idstrs: try: self._init_record(record_type_idstr) except (ImportError, KeyError): pass
python
{ "resource": "" }
q47866
OsidExtensibleQuery._init_record
train
def _init_record(self, record_type_idstr): """Initializes a query record""" record_type_data = self._all_supported_record_type_data_sets[Id(record_type_idstr).get_identifier()] module = importlib.import_module(record_type_data['module_path']) record = getattr(module, record_type_data['qu...
python
{ "resource": "" }
q47867
CommentingManager.use_comparative_book_view
train
def use_comparative_book_view(self): """Pass through to provider CommentBookSession.use_comparative_book_view""" self._book_view = COMPARATIVE # self._get_provider_session('comment_book_session') # To make sure the session is tracked for session in self._get_provider_sessions(): ...
python
{ "resource": "" }
q47868
CommentingManager.use_plenary_book_view
train
def use_plenary_book_view(self): """Pass through to provider CommentBookSession.use_plenary_book_view""" self._book_view = PLENARY # self._get_provider_session('comment_book_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: ...
python
{ "resource": "" }
q47869
CommentingManager.get_books_by_comment
train
def get_books_by_comment(self, *args, **kwargs): """Pass through to provider CommentBookSession.get_books_by_comment""" # Implemented from kitosid template for - # osid.resource.ResourceBinSession.get_bins_by_resource catalogs = self._get_provider_session('comment_book_session').get_book...
python
{ "resource": "" }
q47870
CommentingManager.get_books
train
def get_books(self): """Pass through to provider BookLookupSession.get_books""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_template catalogs = self._get_provider_session('book_lookup_session').get_books() cat_list = [] for cat in c...
python
{ "resource": "" }
q47871
CommentingManager.create_book
train
def create_book(self, *args, **kwargs): """Pass through to provider BookAdminSession.create_book""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.create_bin return Book( self._provider_manager, self._get_provider_session('book_admin_ses...
python
{ "resource": "" }
q47872
CommentingManager.get_book_form
train
def get_book_form(self, *args, **kwargs): """Pass through to provider BookAdminSession.get_book_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 i...
python
{ "resource": "" }
q47873
CommentingManager.save_book
train
def save_book(self, book_form, *args, **kwargs): """Pass through to provider BookAdminSession.update_book""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin if book_form.is_for_update(): return self.update_book(book_form, *args, **kwargs) ...
python
{ "resource": "" }
q47874
Book.use_comparative_comment_view
train
def use_comparative_comment_view(self): """Pass through to provider CommentLookupSession.use_comparative_comment_view""" self._object_views['comment'] = COMPARATIVE # self._get_provider_session('comment_lookup_session') # To make sure the session is tracked for session in self._get_provi...
python
{ "resource": "" }
q47875
Book.use_plenary_comment_view
train
def use_plenary_comment_view(self): """Pass through to provider CommentLookupSession.use_plenary_comment_view""" self._object_views['comment'] = PLENARY # self._get_provider_session('comment_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions...
python
{ "resource": "" }
q47876
Book.use_federated_book_view
train
def use_federated_book_view(self): """Pass through to provider CommentLookupSession.use_federated_book_view""" self._book_view = FEDERATED # self._get_provider_session('comment_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): ...
python
{ "resource": "" }
q47877
Book.use_isolated_book_view
train
def use_isolated_book_view(self): """Pass through to provider CommentLookupSession.use_isolated_book_view""" self._book_view = ISOLATED # self._get_provider_session('comment_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): t...
python
{ "resource": "" }
q47878
Book.get_comment_form
train
def get_comment_form(self, *args, **kwargs): """Pass through to provider CommentAdminSession.get_comment_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. ...
python
{ "resource": "" }
q47879
Book.save_comment
train
def save_comment(self, comment_form, *args, **kwargs): """Pass through to provider CommentAdminSession.update_comment""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if comment_form.is_for_update(): return self.update_comment(...
python
{ "resource": "" }
q47880
ObjectiveLookupSession.get_objective
train
def get_objective(self, objective_id): """Gets the ``Objective`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Objective`` may have a different ``Id`` than requested, such as the case where a duplicate ``...
python
{ "resource": "" }
q47881
ObjectiveLookupSession.get_objectives_by_ids
train
def get_objectives_by_ids(self, objective_ids): """Gets an ``ObjectiveList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the objectives specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an `...
python
{ "resource": "" }
q47882
ObjectiveLookupSession.get_objectives_by_genus_type
train
def get_objectives_by_genus_type(self, objective_genus_type): """Gets an ``ObjectiveList`` corresponding to the given objective genus ``Type`` which does not include objectives of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known objectives o...
python
{ "resource": "" }
q47883
ObjectiveLookupSession.get_objectives
train
def get_objectives(self): """Gets all ``Objectives``. In plenary mode, the returned list contains all known objectives or an error results. Otherwise, the returned list may contain only those objectives that are accessible through this session. return: (osid.learning.ObjectiveL...
python
{ "resource": "" }
q47884
ObjectiveAdminSession.get_objective_form_for_create
train
def get_objective_form_for_create(self, objective_record_types): """Gets the objective form for creating new objectives. A new form should be requested for each create transaction. arg: objective_record_types (osid.type.Type[]): array of objective record types return...
python
{ "resource": "" }
q47885
ObjectiveAdminSession.get_objective_form_for_update
train
def get_objective_form_for_update(self, objective_id): """Gets the objective form for updating an existing objective. A new objective form should be requested for each update transaction. arg: objective_id (osid.id.Id): the ``Id`` of the ``Objective`` return:...
python
{ "resource": "" }
q47886
ObjectiveAdminSession.update_objective
train
def update_objective(self, objective_form): """Updates an existing objective. arg: objective_form (osid.learning.ObjectiveForm): the form containing the elements to be updated raise: IllegalState - ``objective_form`` already used in an update transaction ...
python
{ "resource": "" }
q47887
ObjectiveAdminSession.alias_objective
train
def alias_objective(self, objective_id, alias_id): """Adds an ``Id`` to an ``Objective`` for the purpose of creating compatibility. The primary ``Id`` of the ``Objective`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer...
python
{ "resource": "" }
q47888
ObjectiveHierarchyDesignSession.remove_child_objective
train
def remove_child_objective(self, objective_id, child_id): """Removes a child from an objective. arg: objective_id (osid.id.Id): the ``Id`` of an objective arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``objective_id`` not a parent of ``child_id`` ...
python
{ "resource": "" }
q47889
ObjectiveObjectiveBankSession.get_objective_ids_by_objective_bank
train
def get_objective_ids_by_objective_bank(self, objective_bank_id): """Gets the list of ``Objective`` ``Ids`` associated with an ``ObjectiveBank``. arg: objective_bank_id (osid.id.Id): ``Id`` of the ``ObjectiveBank`` return: (osid.id.IdList) - list of related objectives ...
python
{ "resource": "" }
q47890
ObjectiveObjectiveBankSession.get_objectives_by_objective_bank
train
def get_objectives_by_objective_bank(self, objective_bank_id): """Gets the list of ``Objectives`` associated with an ``ObjectiveBank``. arg: objective_bank_id (osid.id.Id): ``Id`` of the ``ObjectiveBank`` return: (osid.learning.ObjectiveList) - list of related ...
python
{ "resource": "" }
q47891
ObjectiveObjectiveBankSession.get_objective_ids_by_objective_banks
train
def get_objective_ids_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Objective Ids`` corresponding to a list of ``ObjectiveBanks``. arg: objective_bank_ids (osid.id.IdList): list of objective bank ``Ids`` return: (osid.id.IdList) - list of objective ``Ids...
python
{ "resource": "" }
q47892
ObjectiveObjectiveBankSession.get_objectives_by_objective_banks
train
def get_objectives_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Objectives`` corresponding to a list of ``ObjectiveBanks``. arg: objective_bank_ids (osid.id.IdList): list of objective bank ``Ids`` return: (osid.learning.ObjectiveList) - list of objectiv...
python
{ "resource": "" }
q47893
ObjectiveObjectiveBankSession.get_objective_bank_ids_by_objective
train
def get_objective_bank_ids_by_objective(self, objective_id): """Gets the list of ``ObjectiveBank`` ``Ids`` mapped to an ``Objective``. arg: objective_id (osid.id.Id): ``Id`` of an ``Objective`` return: (osid.id.IdList) - list of objective bank ``Ids`` raise: NotFound - ``objective_...
python
{ "resource": "" }
q47894
ObjectiveObjectiveBankSession.get_objective_banks_by_objective
train
def get_objective_banks_by_objective(self, objective_id): """Gets the list of ``ObjectiveBanks`` mapped to an ``Objective``. arg: objective_id (osid.id.Id): ``Id`` of an ``Objective`` return: (osid.learning.ObjectiveBankList) - list of objective banks raise: NotFound...
python
{ "resource": "" }
q47895
ObjectiveObjectiveBankAssignmentSession.get_assignable_objective_bank_ids
train
def get_assignable_objective_bank_ids(self, objective_bank_id): """Gets a list of objective banks including and under the given objective bank node in which any objective can be assigned. arg: objective_bank_id (osid.id.Id): the ``Id`` of the ``ObjectiveBank`` return: (osid.i...
python
{ "resource": "" }
q47896
ObjectiveObjectiveBankAssignmentSession.assign_objective_to_objective_bank
train
def assign_objective_to_objective_bank(self, objective_id, objective_bank_id): """Adds an existing ``Objective`` to an ``ObjectiveBank``. arg: objective_id (osid.id.Id): the ``Id`` of the ``Objective`` arg: objective_bank_id (osid.id.Id): the ``Id`` of the ...
python
{ "resource": "" }
q47897
ObjectiveObjectiveBankAssignmentSession.unassign_objective_from_objective_bank
train
def unassign_objective_from_objective_bank(self, objective_id, objective_bank_id): """Removes an ``Objective`` from an ``ObjectiveBank``. arg: objective_id (osid.id.Id): the ``Id`` of the ``Objective`` arg: objective_bank_id (osid.id.Id): the ``Id`` of the ...
python
{ "resource": "" }
q47898
ObjectiveObjectiveBankAssignmentSession.reassign_proficiency_to_objective_bank
train
def reassign_proficiency_to_objective_bank(self, objective_id, from_objective_bank_id, to_objective_bank_id): """Moves an ``Objective`` from one ``ObjectiveBank`` to another. Mappings to other ``ObjectiveBanks`` are unaffected. arg: objective_id (osid.id.Id): the ``Id`` of the ...
python
{ "resource": "" }
q47899
ObjectiveRequisiteSession.get_requisite_objectives
train
def get_requisite_objectives(self, objective_id): """Gets a list of ``Objectives`` that are the immediate requisites for the given ``Objective``. In plenary mode, the returned list contains all of the immediate requisites, or an error results if an ``Objective`` is not found or inaccess...
python
{ "resource": "" }