code stringlengths 1 18.2k |
|---|
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 encoding... |
""" if not isinstance(text, str): if isinstance(text, Exception): # two possibilities for storing unicode strings in exception data: try: # custom __str__ method on the exception (e.g. PermissionError) return unicode(text) except UnicodeError: # unicode arguments given to the exception (e.g. parse_date) return ' '.join... |
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 = "AAAAAAECEEEEIIIIDNOOOOOOUUUUYSaaaaaaaceeeeiiii" mfrom ... |
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, rest = m.groups() t = t.lower() ... |
break optstack.append(ot) if t != ot: # No match. Push the optinal elements back again badtag = True tagstack += reversed(optstack) else: tagstack.append(ot) # <li> can be nested in <ul> or <ol>, skip those cases: if ot not in _htmllist and t in _listtags: badtag = True elif t == u'table': if len(tablestack) == 0: bagt... |
= u'/>' elif t in _htmlsingle: # Hack to not close $htmlsingle tags brace = None else: if t == u'table': tablestack.append(tagstack) tagstack = [] tagstack.append(t) newparams = self.fixTagAttributes(params, t) if not badtag: rest = rest.replace(u'>', u'>') if brace == u'/>': close = u' /' else: close = u'' sb.appen... |
def removeHtmlComments(self, text): """remove <!-- text --> comments from given text""" sb = [] start = text.find(u'<!--') last = 0 while start != -1: end = text.find(u'-->', start) if end == -1: break end += 3 spaceStart = max(0, start-1) spaceEnd = end while text[spaceStart] == u' ' and spaceStart > 0: spaceStart -= ... |
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: value = _space.sub(u' '... |
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 "expression" from stylesheets. # ... |
def safeEncodeAttribute(self, encValue): """docstring for safeEncodeAttribute""" encValue = encValue.replace(u'&', u'&') encValue = encValue.replace(u'<', u'<') encValue = encValue.replace(u'>', u'>') encValue = encValue.replace(u'"', u'"') encValue = encValue.replace(u'{', u'{') encValue = encValue... |
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 return False return ... |
def extractTagsAndParams(self, elements, text, matches): """ Replaces all occurrences of HTML-style comments and the given tags in the text with a random marker and returns teh next text. The output parameter $matches will be an associative array filled with data in the form: 'UNIQ-xxxxx' => array( 'element', 'tag cont... |
marker = self.uniq_prefix + u'-' + element + u'-' + (u"%08X" % _extractTagsAndParams_n) + u'-QINU' _extractTagsAndParams_n += 1 stripped += marker if close == u'/>': # empty element tag, <tag /> content = None text = inside tail = None else: if element == u'!--': end = _endCommentPat else: if element not in _endRegexHa... |
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 \2', text) # french spaces, Guillemet-right text = _guillemetRightPat.sub(ur'\1 ... |
def closeParagraph(self, mLastSection): """Used by doBlockLevels()""" result = u'' if mLastSection != u'': result = u'</' + mLastSection + u'>\n' return result |
def getCommon(self, st1, st2): """ getCommon() returns the length of the longest common substring of both arguments, starting at the beginning of both. """ fl = len(st1) shorter = len(st2) if fl < shorter: shorter = fl i = 0 while i < shorter: if st1[i] != st2[i]: break i += 1 return i |
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 += u'<ol><li>' elif char... |
def formatHeadings(self, text, isMain): """ This function accomplishes several tasks: 1) Auto-number headings if that option is enabled 2) Add an [edit] link to sections for logged in users who have enabled the option 3) Add a Table of contents on the top for users who have enabled the option 4) Auto-anchor headings It... |
= len(matches) # if there are fewer than 4 headlines in the article, do not show TOC # unless it's been explicitly enabled. enoughToc = self.show_toc and (numMatches >= 4 or text.find(u"<!--MWTOC-->") != -1) # Allow user to stipulate that a page should have a "new section" # link added via __NEWSECTIONLINK__ showNewSec... |
excluding template sections # Ugh .. the TOC should have neat indentation levels which can be # passed to the skin functions. These are determined here toc = [] head = {} sublevelCount = {} levelCount = {} toclevel = 0 level = 0 prevlevel = 0 toclevel = 0 prevtoclevel = 0 refers = {} refcount = {} wgMaxTocLevel = 5 for... |
< wgMaxTocLevel: toc.append(u'\n<ul>') elif level < prevlevel and toclevel > 1: # Decrease TOC level, find level to jump to if toclevel == 2 and level < levelCount[1]: toclevel = 1 else: for i in range(toclevel, 0, -1): if levelCount[i] == level: # Found last matching level toclevel = i break elif levelCount[i] < level... |
sections canonized_headline = self.unstrip(headline) canonized_headline = self.unstripNoWiki(canonized_headline) # -- don't know what to do with this yet. # Remove link placeholders by the link text. # <!--LINK number--> # turns into # link text with suffix # $canonized_headline = preg_replace( '/<!--LINK ([0-9]*)-->/e... |
the only one (looks silly) if doNumberHeadings and numMatches > 1: # the two are different if the line contains a link headline = numbering + u' ' + headline # Create the anchor for linking from the TOC to the section anchor = canonized_headline; if refcount[headlineCount] > 1: anchor += u'_' + unicode(refcount[headlin... |
h.append('">') h.append(matches[headlineCount][1].strip()) h.append(headline.strip()) h.append(u'</h') h.append(to_unicode(level)) h.append(u'>') headlineCount += 1 if not istemplate: sectionCount += 1 if enoughToc: if toclevel < wgMaxTocLevel: toc.append(u"</li>\n") toc.append(u"</ul>\n</li>\n" * max(0, toclevel - 1))... |
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`` """ if "." in name: for part in name.split("."): if not is_valid_... |
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 domain = [0.8, 1, 1.2] gen = RepellentGenerator(domain) self... |
def _validate(self): """ The purpose of this method is to verify that the user has set sensible values for the training program before rendering. The user will still be able to render, but error messages will be printed. This method: * Validates that the average intensity is in the range [65, 85]. * Validates that the ... |
* self.intensity for s in self._intensity_scalers]) < 65: warnings.warn('\nWARNING: Average intensity is < 65.') # Validate the repetitions if max([s * self.reps_per_exercise for s in self._rep_scalers]) > 45: warnings.warn('\nWARNING: Number of repetitions > 45.') if min([s * self.reps_per_exercise for s in self._rep_... |
/ self.duration) percentage_growth = dynamic_ex.weekly_growth(self.duration) if percentage_growth > 4: msg = '\n"{}" grows with {}% each week.'.format( dynamic_ex.name, percentage_growth) warnings.warn(msg) |
def add_days(self, *days): """Add one or several days to the program. Parameters ---------- *days Unpacked tuple containing :py:class:`streprogen.Day` instances. Examples ------- >>> program = Program('My training program') >>> day1, day2 = Day(), Day() >>> program.add_days(day1, day2) """ for day in list(days): self.d... |
def repstring_penalty(reps, intensities, desired_reps, desired_intensity, minimum_rep): """Penalty function which calculates how "bad" a set of reps and intensities is, compared to the desired repetitions, the desired intensity level and the minimum repetitions. Advanced users may substitute this function for their own... |
desired_intensity, ... minimum_rep) >>> low = Program().repstring_penalty([8, 6, 5, 4, 2], [64, 72, 75, 80, 88], ... desired_reps, desired_intensity, ... minimum_rep) >>> high > low True """ # Punish when the mean intensity is far from the desired one desired = desired_intensity error1 = abs(statistics.mean(intensities... |
def _render_dynamic(self, dynamic_exercise, min_rep, desired_reps, desired_intensity, validate): """ Render a single dynamic exercise. This is done for each exercise every week. """ # -------------------------------- # Generate possible repstring and calculate penalties # -------------------------------- repstrings = [... |
if desired_intensity > self.reps_to_intensity_func(min_rep) and validate: msg = """ WARNING: The exercise '{}' is restricted to repetitions in the range [{}, {}], but the desired average intensity for this week is {}. Reaching this intensity is not attainable since it corresponds to repetitions lower than {}. SOLUTION:... |
Reaching this intensity is not attainable since it corresponds to repetitions higher than {}. SOLUTION: Either (1) allow higher repetitions, (2) change the desired intensity or (3) ignore this message. The software will do it's best to remedy this. """.format(dynamic_exercise.name, dynamic_exercise.max_reps, min_rep, d... |
def _initialize_render_dictionary(self): """Initialize a dictionary for rendered values. Examples ------- >>> program = Program('My training program') >>> program._initialize_render_dictionary() >>> program._rendered is False False """ self._rendered = dict() # Iterate over all weeks for week in range(1, self.duration ... |
def _set_min_reps(self): """Populate the _rendered dictionary with entries corresponding to the minimum number of reps to go to for each exercise and for the entire duration. Examples ------- >>> program = Program('My training program', duration = 2) >>> bench_press = DynamicExercise('Bench', 100, 120) >>> day = Day(ex... |
RepellentGenerator(list(range(low, high + 1))) # Use generator to populate the dictionary with minimum values for week in range(1, self.duration + 1): min_rep_week = generator.generate_one() for day in self.days: for d_ex in day.dynamic_exercises: self._rendered[week][day][d_ex]['minimum'] = min_rep_week # ------------... |
If the mode is by exercise, set minimum reps on an exercise basis # -------------------------------- if self._min_reps_consistency == 'exercise': # Set up generators. One is needed for each exercise generators = dict() for day in self.days: for d_ex in day.dynamic_exercises: margs = d_ex.min_reps, d_ex.max_reps, min_pe... |
def _yield_week_day_dynamic(self): """A helper function to reduce the number of nested loops. Yields ------- tuple A tuple with (week, day, dynamic_ex). """ # Iterate over all weeks for week in range(1, self.duration + 1): # Iterate over all days for day in self.days: # Iterate over all main exercises for dynamic_ex in... |
def _yield_week_day(self, enumeration=False): """A helper function to reduce the number of nested loops. Parameters ---------- enumeration Whether or not to wrap the days in enumerate(). Yields ------- tuple A tuple with (week, day_index, day) or (week, day), depending on 'enumeration' parameter. """ if enumeration: # ... |
def _yield_exercises(self): """A helper function to reduce the number of nested loops. Yields ------- (dynamic_ex) or (static_ex) Yields the exercises in the program. """ for day in self.days: for dynamic_ex in day.dynamic_exercises: yield dynamic_ex for static_ex in day.static_exercises: yield static_ex |
def render(self, validate=True): """Render the training program to perform the calculations. The program can be rendered several times to produce new information given the same input parameters. Parameters ---------- validate Boolean that indicates whether or not to run a validation heurestic on the program before rend... |
Validate the program if the user wishes to validate if validate: self._validate() # -------------------------------- # Render the dynamic exercises # -------------------------------- for (week, day, dyn_ex) in self._yield_week_day_dynamic(): # The minimum repeition to work up to min_rep = self._rendered[week][day][dyn_... |
dyn_ex.start_weight, dyn_ex.final_weight args = (week, start_w, final_w, 1, self.duration) weight = self.progression_func(*args) # Define a function to prettify the weights def pretty_weight(weight, i, round_function): weight = round_function(weight * i / 100) if weight % 1 == 0: return int(weight) return weight # Use ... |
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=chunker, enumerate=enumerate, str = str) # Add filters to the environment r... |
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 code. """ env = self.jinja2_environment template = env.get_template(self.TEMPLATE_NAMES['htm... |
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. """ # Get information related to formatting exercises = list(self._yield_exercises()) max_ex_name = 0 i... |
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 The tex text size, e.g. '\small', 'normalsize', 'large', 'Lar... |
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 # ------------------------------------------- # Check whether the mode is WE... |
# never more broad than what is allowed by inputs if (self._min_reps_consistency == 'exercise' and self.min_reps_consistency != 'exercise'): raise ProgramError("Error with 'min_reps_consistency'.") if (self._min_reps_consistency == 'daily' and self.min_reps_consistency == 'weekly'): raise ProgramError("Error with 'min_... |
def _add_match(self, match_key, match_value): """Adds a match key/value""" if match_key is None: raise errors.NullArgument() self._query_terms[match_key] = str(match_key) + '=' + str(match_value) |
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 |
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['query_record_class_name']) self._r... |
def match_display_name(self, display_name=None, string_match_type=None, match=None): """Adds a display name to match. Multiple display name matches can be added to perform a boolean ``OR`` among them. arg: display_name (string): display name to match arg: string_match_type (osid.type.Type): the string match type arg: m... |
def match_description(self, description=None, string_match_type=None, match=None): """Adds a description name to match. Multiple description matches can be added to perform a boolean ``OR`` among them. arg: description (string): description to match arg: string_match_type (osid.type.Type): the string match type arg: ma... |
def _set_book_view(self, session): """Sets the underlying book view to match current view""" if self._book_view == COMPARATIVE: try: session.use_comparative_book_view() except AttributeError: pass else: try: session.use_plenary_book_view() except AttributeError: pass |
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(): try: session.use_comparative_book_view()... |
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: session.use_plenary_book_view() except Attribut... |
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_books_by_comment(*args, **kwargs) ca... |
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 catalogs: cat_list.append(Book(self._provider_man... |
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_session').create_book(*args, **kwargs), self._runtime, self... |
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 isinstance(args[-1], list) or 'book_recor... |
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) else: return self.create_book(book_form, *ar... |
def _set_book_view(self, session): """Sets the underlying book view to match current view""" if self._book_view == FEDERATED: try: session.use_federated_book_view() except AttributeError: pass else: try: session.use_isolated_book_view() except AttributeError: pass |
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_provider_sessions(): try: session.use... |
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(): try: session.use_plenary_com... |
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(): try: session.use_federated_book_view() exc... |
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(): try: session.use_isolated_book_view() except ... |
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. if isinstance(args[-1], list) or '... |
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(comment_form, *args, **kwargs) else: return ... |
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 ``Id`` was assigned to an ``Objective`` and... |
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 ``Id`` in the supplied list is not... |
for # osid.resource.ResourceLookupSession.get_resources_by_ids # NOTE: This implementation currently ignores plenary view collection = JSONClientValidated('learning', collection='Objective', runtime=self._runtime) object_id_list = [] for i in objective_ids: object_id_list.append(ObjectId(self._get_id(i, 'learning').get... |
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 or an error results. Other... |
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.ObjectiveList) - an ``ObjectiveList`` raise: Operati... |
def get_objectives_by_query(self, objective_query): """Gets a list of ``Objectives`` matching the given objective query. arg: objective_query (osid.learning.ObjectiveQuery): the objective query return: (osid.learning.ObjectiveList) - the returned ``ObjectiveList`` raise: NullArgument - ``objective_query`` is ``null`` r... |
else: result = [] return objects.ObjectiveList(result, runtime=self._runtime, proxy=self._proxy) |
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: (osid.learning.ObjectiveForm) - the objective form ... |
def create_objective(self, objective_form): """Creates a new ``Objective``. arg: objective_form (osid.learning.ObjectiveForm): the form for this ``Objective`` return: (osid.learning.Objective) - the new ``Objective`` raise: IllegalState - ``objective_form`` already used in a create transaction raise: InvalidArgument - ... |
raise errors.Unsupported('objective_form did not originate from this session') if not objective_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') insert_result = collection.insert_one(objective_form._my_map) self._forms[objective_form.get_id().get_identifier()] = CREATED resul... |
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: (osid.learning.ObjectiveForm) - the objective form raise: No... |
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 raise: InvalidArgument - the form contains an invalid value raise... |
from this session') if not objective_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(objective_form._my_map) self._forms[objective_form.get_id().get_identifier()] = UPDATED # Note: this is out of spec. The OSIDs don't require an object to be returned: return ... |
def delete_objective(self, objective_id): """Deletes the ``Objective`` identified by the given ``Id``. arg: objective_id (osid.id.Id): the ``Id`` of the ``Objective`` to delete raise: NotFound - an ``Objective`` was not found identified by the given ``Id`` raise: NullArgument - ``objective_id`` is ``null`` raise: Opera... |
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 to another objective, it is reas... |
def get_root_objectives(self): """Gets the root objective in this objective hierarchy. return: (osid.learning.ObjectiveList) - the root objective raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method is must be implemented.* """ # Imple... |
def get_child_objectives(self, objective_id): """Gets the children of the given objective. arg: objective_id (osid.id.Id): the ``Id`` to query return: (osid.learning.ObjectiveList) - the children of the objective raise: NotFound - ``objective_id`` is not found raise: NullArgument - ``objective_id`` is ``null`` raise: O... |
def add_child_objective(self, objective_id, child_id): """Adds a child to 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: AlreadyExists - ``objective_id`` is already a parent of ``child_id`` raise: NotFound - ``objective_id`` or ``c... |
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`` raise: NullArgument - ``objective_id`` or ``c... |
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 raise: NotFound - ``objective_bank_id`` is not foun... |
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 objective ``Ids`` raise: NotFound - ``objective_bank_id`` i... |
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`` raise: NullArgument - ``objective_bank_id... |
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 objectives raise: NullArgument - ``objective_bank_id... |
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_id`` is not found raise: NullArgument ... |
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 - ``objective_id`` is not found raise: NullArgument ... |
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.id.IdList) - list of assignable objective ban... |
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 ``ObjectiveBank`` raise: AlreadyExists - ``objective_id`` alrea... |
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 ``ObjectiveBank`` raise: NotFound - ``objective_id`` or ``objec... |
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 ``Objective`` arg: from_objective_bank_id ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.