_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q47900 | ObjectiveRequisiteSession.get_dependent_objectives | train | def get_dependent_objectives(self, objective_id):
"""Gets a list of ``Objectives`` that require 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
inaccessible. Otherwise, inaccessible... | python | {
"resource": ""
} |
q47901 | ObjectiveRequisiteAssignmentSession.unassign_objective_requisite | train | def unassign_objective_requisite(self, objective_id, requisite_objective_id):
"""Removes an ``Objective`` requisite from an ``Objective``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the
... | python | {
"resource": ""
} |
q47902 | ActivityLookupSession.get_activity | train | def get_activity(self, activity_id):
"""Gets the ``Activity`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Activity`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``Id``... | python | {
"resource": ""
} |
q47903 | ActivityLookupSession.get_activities_by_ids | train | def get_activities_by_ids(self, activity_ids):
"""Gets an ``ActivityList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
activities specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an ``I... | python | {
"resource": ""
} |
q47904 | ActivityLookupSession.get_activities_by_genus_type | train | def get_activities_by_genus_type(self, activity_genus_type):
"""Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` which does not include activities of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known activities
or a... | python | {
"resource": ""
} |
q47905 | ActivityLookupSession.get_activities_for_objective | train | def get_activities_for_objective(self, objective_id):
"""Gets the activities for the given objective.
In plenary mode, the returned list contains all of the
activities mapped to the objective ``Id`` or an error results if
an Id in the supplied list is not found or inaccessible.
... | python | {
"resource": ""
} |
q47906 | ActivityLookupSession.get_activities | train | def get_activities(self):
"""Gets all ``Activities``.
In plenary mode, the returned list contains all known activites
or an error results. Otherwise, the returned list may contain
only those activities that are accessible through this session.
return: (osid.learning.ActivityLis... | python | {
"resource": ""
} |
q47907 | ActivityAdminSession.get_activity_form_for_create | train | def get_activity_form_for_create(self, objective_id, activity_record_types):
"""Gets the activity form for creating new activities.
A new form should be requested for each create transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: act... | python | {
"resource": ""
} |
q47908 | ActivityAdminSession.create_activity | train | def create_activity(self, activity_form):
"""Creates a new ``Activity``.
arg: activity_form (osid.learning.ActivityForm): the form for
this ``Activity``
return: (osid.learning.Activity) - the new ``Activity``
raise: IllegalState - ``activity_form`` already used in a
... | python | {
"resource": ""
} |
q47909 | ActivityAdminSession.alias_activity | train | def alias_activity(self, activity_id, alias_id):
"""Adds an ``Id`` to an ``Activity`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Activity`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to ... | python | {
"resource": ""
} |
q47910 | ActivityObjectiveBankSession.get_activity_ids_by_objective_bank | train | def get_activity_ids_by_objective_bank(self, objective_bank_id):
"""Gets the list of ``Activity`` ``Ids`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.id.IdList) - list of related activity ``Ids``
... | python | {
"resource": ""
} |
q47911 | ActivityObjectiveBankSession.get_activities_by_objective_bank | train | def get_activities_by_objective_bank(self, objective_bank_id):
"""Gets the list of ``Activities`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.learning.ActivityList) - list of related
... | python | {
"resource": ""
} |
q47912 | ActivityObjectiveBankSession.get_activity_ids_by_objective_banks | train | def get_activity_ids_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Activity 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 activity ``Ids``
... | python | {
"resource": ""
} |
q47913 | ActivityObjectiveBankSession.get_activities_by_objective_banks | train | def get_activities_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Activities`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.learning.ActivityList) - list of activitie... | python | {
"resource": ""
} |
q47914 | ActivityObjectiveBankSession.get_objective_bank_ids_by_activity | train | def get_objective_bank_ids_by_activity(self, activity_id):
"""Gets the list of ``ObjectiveBank Ids`` mapped to a ``Activity``.
arg: activity_id (osid.id.Id): ``Id`` of a ``Activity``
return: (osid.id.IdList) - list of objective bank ``Ids``
raise: NotFound - ``activity_id`` is not f... | python | {
"resource": ""
} |
q47915 | ActivityObjectiveBankSession.get_objective_banks_by_activity | train | def get_objective_banks_by_activity(self, activity_id):
"""Gets the list of ``ObjectiveBanks`` mapped to a ``Activity``.
arg: activity_id (osid.id.Id): ``Id`` of a ``Activity``
return: (osid.learning.ObjectiveBankList) - list of objective
bank ``Ids``
raise: NotFound... | python | {
"resource": ""
} |
q47916 | ActivityObjectiveBankAssignmentSession.assign_activity_to_objective_bank | train | def assign_activity_to_objective_bank(self, activity_id, objective_bank_id):
"""Adds an existing ``Activity`` to a ``ObjectiveBank``.
arg: activity_id (osid.id.Id): the ``Id`` of the ``Activity``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
... | python | {
"resource": ""
} |
q47917 | ActivityObjectiveBankAssignmentSession.unassign_activity_from_objective_bank | train | def unassign_activity_from_objective_bank(self, activity_id, objective_bank_id):
"""Removes a ``Activity`` from a ``ObjectiveBank``.
arg: activity_id (osid.id.Id): the ``Id`` of the ``Activity``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
... | python | {
"resource": ""
} |
q47918 | ActivityObjectiveBankAssignmentSession.reassign_activity_to_objective_bank | train | def reassign_activity_to_objective_bank(self, activity_id, from_objective_bank_id, to_objective_bank_id):
"""Moves an ``Activity`` from one ``ObjectiveBank`` to another.
Mappings to other ``ObjectiveBanks`` are unaffected.
arg: activity_id (osid.id.Id): the ``Id`` of the ``Activity``
... | python | {
"resource": ""
} |
q47919 | ProficiencyLookupSession.get_proficiency | train | def get_proficiency(self, proficiency_id):
"""Gets the ``Proficiency`` specified by its ``Id``.
arg: proficiency_id (osid.id.Id): the ``Id`` of the
``Proficiency`` to retrieve
return: (osid.learning.Proficiency) - the returned
``Proficiency``
raise: N... | python | {
"resource": ""
} |
q47920 | ProficiencyLookupSession.get_proficiencies_by_ids | train | def get_proficiencies_by_ids(self, proficiency_ids):
"""Gets a ``ProficiencyList`` corresponding to the given ``IdList``.
arg: proficiency_ids (osid.id.IdList): the list of ``Ids`` to
retrieve
return: (osid.learning.ProficiencyList) - the returned
``Proficienc... | python | {
"resource": ""
} |
q47921 | ProficiencyLookupSession.get_proficiencies_by_genus_type | train | def get_proficiencies_by_genus_type(self, proficiency_genus_type):
"""Gets a ``ProficiencyList`` corresponding to the given proficiency genus ``Type`` which does not include proficiencies of types derived from the specified ``Type``.
arg: proficiency_genus_type (osid.type.Type): a proficiency
... | python | {
"resource": ""
} |
q47922 | ProficiencyLookupSession.get_proficiencies_on_date | train | def get_proficiencies_on_date(self, from_, to):
"""Gets a ``ProficiencyList`` effecyive during the entire given date range inclusive but not confined to the date range.
arg: from (osid.calendaring.DateTime): starting date
arg: to (osid.calendaring.DateTime): ending date
return: (o... | python | {
"resource": ""
} |
q47923 | ProficiencyLookupSession.get_proficiencies_for_objective_on_date | train | def get_proficiencies_for_objective_on_date(self, objective_id, from_, to):
"""Gets a ``ProficiencyList`` relating to the given objective effective during the entire given date range inclusive but not confined to the date range.
arg: objective_id (osid.id.Id): an objective ``Id``
arg: fro... | python | {
"resource": ""
} |
q47924 | ProficiencyLookupSession.get_proficiencies_for_objectives | train | def get_proficiencies_for_objectives(self, objective_ids):
"""Gets a ``ProficiencyList`` relating to the given objectives.
arg: objective_ids (osid.id.IdList): the objective ``Ids``
return: (osid.learning.ProficiencyList) - the returned
``Proficiency`` list
raise: Nu... | python | {
"resource": ""
} |
q47925 | ProficiencyLookupSession.get_proficiencies_for_resource_on_date | train | def get_proficiencies_for_resource_on_date(self, resource_id, from_, to):
"""Gets a ``ProficiencyList`` relating to the given resource effective during the entire given date range inclusive but not confined to the date range.
arg: resource_id (osid.id.Id): a resource ``Id``
arg: from (osi... | python | {
"resource": ""
} |
q47926 | ProficiencyLookupSession.get_proficiencies_by_genus_type_for_resource_on_date | train | def get_proficiencies_by_genus_type_for_resource_on_date(self, resource_id, proficiency_genus_type, from_, to):
"""Gets a ``ProficiencyList`` of the given proficiency genus type relating to the given resource effective during the entire given date range inclusive but not confined to the date range.
arg... | python | {
"resource": ""
} |
q47927 | ProficiencyLookupSession.get_proficiencies_for_resources | train | def get_proficiencies_for_resources(self, resource_ids):
"""Gets a ``ProficiencyList`` relating to the given resources.
arg: resource_ids (osid.id.IdList): the resource ``Ids``
return: (osid.learning.ProficiencyList) - the returned
``Proficiency`` list
raise: NullArg... | python | {
"resource": ""
} |
q47928 | ProficiencyLookupSession.get_proficiencies_for_objective_and_resource | train | def get_proficiencies_for_objective_and_resource(self, objective_id, resource_id):
"""Gets a ``ProficiencyList`` relating to the given objective and resource ````.
arg: objective_id (osid.id.Id): an objective ``Id``
arg: resource_id (osid.id.Id): a resource ``Id``
return: (osid.le... | python | {
"resource": ""
} |
q47929 | ProficiencyLookupSession.get_proficiencies | train | def get_proficiencies(self):
"""Gets all ``Proficiencies``.
return: (osid.learning.ProficiencyList) - a list of
``Proficiencies``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This ... | python | {
"resource": ""
} |
q47930 | ProficiencyQuerySession.get_proficiencies_by_query | train | def get_proficiencies_by_query(self, proficiency_query):
"""Gets a list of ``Proficiencies`` matching the given proficiency query.
arg: proficiency_query (osid.learning.ProficiencyQuery): the
proficiency query
return: (osid.learning.ProficiencyList) - the returned
... | python | {
"resource": ""
} |
q47931 | ProficiencyAdminSession.get_proficiency_form_for_create | train | def get_proficiency_form_for_create(self, objective_id, resource_id, proficiency_record_types):
"""Gets the proficiency form for creating new proficiencies.
A new form should be requested for each create transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Object... | python | {
"resource": ""
} |
q47932 | ProficiencyAdminSession.create_proficiency | train | def create_proficiency(self, proficiency_form):
"""Creates a new ``Proficiency``.
A new form should be requested for each create transaction.
arg: proficiency_form (osid.learning.ProficiencyForm): the
form for this ``Proficiency``
return: (osid.learning.Proficiency) ... | python | {
"resource": ""
} |
q47933 | ProficiencyAdminSession.update_proficiency | train | def update_proficiency(self, proficiency_form):
"""Updates an existing proficiency.
arg: proficiency_form (osid.learning.ProficiencyForm): the
form containing the elements to be updated
raise: IllegalState - ``proficiency_form`` already used in an
update tran... | python | {
"resource": ""
} |
q47934 | ProficiencyAdminSession.delete_proficiency | train | def delete_proficiency(self, proficiency_id):
"""Deletes a ``Proficiency``.
arg: proficiency_id (osid.id.Id): the ``Id`` of the
``Proficiency`` to remove
raise: NotFound - ``proficiency_id`` not found
raise: NullArgument - ``proficiency_id`` is ``null``
rais... | python | {
"resource": ""
} |
q47935 | ProficiencyAdminSession.alias_proficiency | train | def alias_proficiency(self, proficiency_id, alias_id):
"""Adds an ``Id`` to a ``Proficiency`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Proficiency`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a ... | python | {
"resource": ""
} |
q47936 | ProficiencyObjectiveBankAssignmentSession.assign_proficiency_to_objective_bank | train | def assign_proficiency_to_objective_bank(self, proficiency_id, objective_bank_id):
"""Adds an existing ``Proficiency`` to a ``ObjectiveBank``.
arg: proficiency_id (osid.id.Id): the ``Id`` of the
``Proficiency``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
... | python | {
"resource": ""
} |
q47937 | ProficiencyObjectiveBankAssignmentSession.unassign_proficiency_from_objective_bank | train | def unassign_proficiency_from_objective_bank(self, proficiency_id, objective_bank_id):
"""Removes a ``Proficiency`` from a ``ObjectiveBank``.
arg: proficiency_id (osid.id.Id): the ``Id`` of the
``Proficiency``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
... | python | {
"resource": ""
} |
q47938 | ProficiencyObjectiveBankAssignmentSession.reassign_proficiency_to_objective_bank | train | def reassign_proficiency_to_objective_bank(self, proficiency_id, from_objective_bank_id, to_objective_bank_id):
"""Moves a ``Proficiency`` from one ``ObjectiveBank`` to another.
Mappings to other ``ObjectiveBanks`` are unaffected.
arg: proficiency_id (osid.id.Id): the ``Id`` of the
... | python | {
"resource": ""
} |
q47939 | ObjectiveBankLookupSession.get_objective_banks | train | def get_objective_banks(self):
"""Gets all ``ObjectiveBanks``.
In plenary mode, the returned list contains all known objective
banks or an error results. Otherwise, the returned list may
contain only those objective banks that are accessible through
this session.
return... | python | {
"resource": ""
} |
q47940 | ObjectiveBankAdminSession.can_create_objective_bank_with_record_types | train | def can_create_objective_bank_with_record_types(self, objective_bank_record_types):
"""Tests if this user can create a single ``ObjectiveBank`` using the desired record types.
While ``LearningManager.getObjectiveBankRecordTypes()`` can be
used to examine which records are supported, this method... | python | {
"resource": ""
} |
q47941 | ObjectiveBankAdminSession.alias_objective_bank | train | def alias_objective_bank(self, objective_bank_id, alias_id):
"""Adds an ``Id`` to an ``ObjectiveBank`` for the purpose of creating compatibility.
The primary ``Id`` of the ``ObjectiveBank`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the ... | python | {
"resource": ""
} |
q47942 | ObjectiveBankHierarchySession.get_root_objective_banks | train | def get_root_objective_banks(self):
"""Gets the root objective banks in this objective bank hierarchy.
return: (osid.learning.ObjectiveBankList) - the root objective
banks
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failu... | python | {
"resource": ""
} |
q47943 | ObjectiveBankHierarchySession.has_parent_objective_banks | train | def has_parent_objective_banks(self, objective_bank_id):
"""Tests if the ``ObjectiveBank`` has any parents.
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (boolean) - ``true`` if the objective bank has parents,
``false`` otherwise... | python | {
"resource": ""
} |
q47944 | ObjectiveBankHierarchySession.is_parent_of_objective_bank | train | def is_parent_of_objective_bank(self, id_, objective_bank_id):
"""Tests if an ``Id`` is a direct parent of an objective bank.
arg: id (osid.id.Id): an ``Id``
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (boolean) - ``true`` if this `... | python | {
"resource": ""
} |
q47945 | ObjectiveBankHierarchySession.get_parent_objective_bank_ids | train | def get_parent_objective_bank_ids(self, objective_bank_id):
"""Gets the parent ``Ids`` of the given objective bank.
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (osid.id.IdList) - the parent ``Ids`` of the objective
bank
... | python | {
"resource": ""
} |
q47946 | ObjectiveBankHierarchySession.get_parent_objective_banks | train | def get_parent_objective_banks(self, objective_bank_id):
"""Gets the parents of the given objective bank.
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (osid.learning.ObjectiveBankList) - the parents of the
objective bank
... | python | {
"resource": ""
} |
q47947 | ObjectiveBankHierarchySession.is_ancestor_of_objective_bank | train | def is_ancestor_of_objective_bank(self, id_, objective_bank_id):
"""Tests if an ``Id`` is an ancestor of an objective bank.
arg: id (osid.id.Id): an ``Id``
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (boolean) - ``true`` if this ``i... | python | {
"resource": ""
} |
q47948 | ObjectiveBankHierarchySession.has_child_objective_banks | train | def has_child_objective_banks(self, objective_bank_id):
"""Tests if an objective bank has any children.
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (boolean) - ``true`` if the ``objective_bank_id`` has
children, ``false`` other... | python | {
"resource": ""
} |
q47949 | ObjectiveBankHierarchySession.is_child_of_objective_bank | train | def is_child_of_objective_bank(self, id_, objective_bank_id):
"""Tests if an objective bank is a direct child of another.
arg: id (osid.id.Id): an ``Id``
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (boolean) - ``true`` if the ``id``... | python | {
"resource": ""
} |
q47950 | ObjectiveBankHierarchySession.get_child_objective_bank_ids | train | def get_child_objective_bank_ids(self, objective_bank_id):
"""Gets the child ``Ids`` of the given objective bank.
arg: objective_bank_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the objective bank
raise: NotFound - ``objective_bank_id`` is not fou... | python | {
"resource": ""
} |
q47951 | ObjectiveBankHierarchySession.get_child_objective_banks | train | def get_child_objective_banks(self, objective_bank_id):
"""Gets the children of the given objective bank.
arg: objective_bank_id (osid.id.Id): the ``Id`` to query
return: (osid.learning.ObjectiveBankList) - the children of the
objective bank
raise: NotFound - ``objec... | python | {
"resource": ""
} |
q47952 | ObjectiveBankHierarchySession.is_descendant_of_objective_bank | train | def is_descendant_of_objective_bank(self, id_, objective_bank_id):
"""Tests if an ``Id`` is a descendant of an objective bank.
arg: id (osid.id.Id): an ``Id``
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
return: (boolean) - ``true`` if the `... | python | {
"resource": ""
} |
q47953 | ObjectiveBankHierarchyDesignSession.remove_child_objective_bank | train | def remove_child_objective_bank(self, objective_bank_id, child_id):
"""Removes a child from an objective bank.
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
arg: child_id (osid.id.Id): the ``Id`` of the child
raise: NotFound - ``objective_ba... | python | {
"resource": ""
} |
q47954 | ObjectiveBankHierarchyDesignSession.remove_child_objective_banks | train | def remove_child_objective_banks(self, objective_bank_id):
"""Removes all children from an objective bank.
arg: objective_bank_id (osid.id.Id): the ``Id`` of an
objective bank
raise: NotFound - ``objective_bank_id`` not in hierarchy
raise: NullArgument - ``objective... | python | {
"resource": ""
} |
q47955 | ApiReferenceDoc.fly | train | def fly(self):
"""
Generate doc tree.
"""
dst_dir = Path(self.conf_file).parent.abspath
package_dir = Path(dst_dir, self.package.shortname)
# delete existing api document
try:
if package_dir.exists():
shutil.rmtree(package_dir.abspath... | python | {
"resource": ""
} |
q47956 | ApiReferenceDoc.generate_package_content | train | def generate_package_content(self, package):
"""Generate package.rst text content.
::
{{ package_name }}
==================
.. automodule:: {{ package_name }}
:members:
sub packages and modules
------------------------
... | python | {
"resource": ""
} |
q47957 | ApiReferenceDoc.generate_module_content | train | def generate_module_content(self, module):
"""Generate module.rst text content.
::
{{ module_name }}
=================
.. automodule:: {{ module_fullname }}
:members:
"""
if isinstance(module, Module):
return module.rende... | python | {
"resource": ""
} |
q47958 | AndroidBackup.parse | train | def parse(self):
"""
Parses a backup file header. Will be done automatically if
used together with the 'with' statement
"""
self.fp.seek(0)
magic = self.fp.readline()
assert magic == b'ANDROID BACKUP\n'
self.version = int(self.fp.readline().strip())
... | python | {
"resource": ""
} |
q47959 | AndroidBackup._encrypt | train | def _encrypt(self, dec, password=None):
"""
Internal encryption function
Uses either the password argument for the encryption,
or, if not supplied, the password field of the object
:param dec: a byte string representing the to be encrypted data
:rtype: bytes
"""... | python | {
"resource": ""
} |
q47960 | AndroidBackup._decompress | train | def _decompress(self, fp):
"""
Internal function for decompressing a backup file with the DEFLATE algorithm
:rtype: Proxy
"""
decompressor = zlib.decompressobj()
if self.stream:
return Proxy(decompressor.decompress, fp)
else:
out = io.Byte... | python | {
"resource": ""
} |
q47961 | AndroidBackup.read_data | train | def read_data(self, password=None):
"""
Helper function which decrypts and decompresses the data if necessary
and returns a tarfile.TarFile to interact with
"""
fp = self.fp
fp.seek(self.__data_start)
if self.is_encrypted():
fp = self._decrypt(fp, pas... | python | {
"resource": ""
} |
q47962 | TypeForm.set_display_label | train | def set_display_label(self, display_label):
"""Seta a display label.
arg: display_label (string): the new display label
raise: InvalidArgument - ``display_label`` is invalid
raise: NoAccess - ``display_label`` cannot be modified
raise: NullArgument - ``display_label`` is `... | python | {
"resource": ""
} |
q47963 | TypeForm.clear_display_label | train | def clear_display_label(self):
"""Clears the display label.
raise: NoAccess - ``display_label`` cannot be modified
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_display_label_metadata().is_read_only() or
self.get_display_label_met... | python | {
"resource": ""
} |
q47964 | TypeForm.set_domain | train | def set_domain(self, domain):
"""Sets a domain.
arg: domain (string): the new domain
raise: InvalidArgument - ``domain`` is invalid
raise: NoAccess - ``domain`` cannot be modified
raise: NullArgument - ``domain`` is ``null``
*compliance: mandatory -- This method mu... | python | {
"resource": ""
} |
q47965 | RelationshipList.get_next_relationship | train | def get_next_relationship(self):
"""Gets the next ``Relationship`` in this list.
return: (osid.relationship.Relationship) - the next
``Relationship`` in this list. The ``has_next()`` method
should be used to test that a next ``Relationship`` is
available ... | python | {
"resource": ""
} |
q47966 | RelationshipList.get_next_relationships | train | def get_next_relationships(self, n=None):
"""Gets the next set of ``Relationships`` elements in this list.
The specified amount must be less than or equal to the return
from ``available()``.
arg: n (cardinal): the number of ``Relationship`` elements
requested which m... | python | {
"resource": ""
} |
q47967 | FamilyList.get_next_family | train | def get_next_family(self):
"""Gets the next ``Family`` in this list.
return: (osid.relationship.Family) - the next ``Family`` in this
list. The ``has_next()`` method should be used to test
that a next ``Family`` is available before calling this
method.
... | python | {
"resource": ""
} |
q47968 | read_laminaprop | train | def read_laminaprop(laminaprop=None, rho=None):
"""Returns a ``MatLamina`` object based on an input ``laminaprop`` tuple
Parameters
----------
laminaprop : list or tuple
Tuple containing the folliwing entries:
(e1, e2, nu12, g12, g13, g23, e3, nu13, nu23)
for othotropic ma... | python | {
"resource": ""
} |
q47969 | myanimelist | train | def myanimelist(username):
"""
Retrieve a users' animelist scores from MAL.
Only anime scored > 0 will be returned, and all
PTW entries are ignored, even if they are scored.
:param str username: MAL username
:return: `id`, `score` pairs
:rtype: list
"""
params = {
"u": user... | python | {
"resource": ""
} |
q47970 | _generate_signature | train | def _generate_signature(url_path, secret_key, query_args, digest=None, encoder=None):
# type: (str, bytes, Dict[str, str], Callable, Callable) -> str
"""
Generate signature from pre-parsed URL.
"""
digest = digest or DEFAULT_DIGEST
encoder = encoder or DEFAULT_ENCODER
msg = "%s?%s" % (url_pa... | python | {
"resource": ""
} |
q47971 | verify_url_path | train | def verify_url_path(url_path, query_args, secret_key, salt_arg='_', max_expiry=None, digest=None):
# type: (str, Dict[str, str], bytes, str, int, Callable) -> bool
"""
Verify a URL path is correctly signed.
:param url_path: URL path
:param secret_key: Signing key
:param query_args: Arguments th... | python | {
"resource": ""
} |
q47972 | DisplayText._unfold_map | train | def _unfold_map(self, display_text_map):
"""Parses a display text dictionary map."""
from ..type.primitives import Type
lt_identifier = Id(display_text_map['languageTypeId']).get_identifier()
st_identifier = Id(display_text_map['scriptTypeId']).get_identifier()
ft_identifier = Id... | python | {
"resource": ""
} |
q47973 | RandomSource.choice | train | def choice(self,arr):
"""Uniform random selection of a member of an list
:param arr: list you want to select an element from
:type arr: list
:return: one element from the list
"""
ind = self.randint(0,len(arr)-1)
return arr[ind] | python | {
"resource": ""
} |
q47974 | RandomSource.different_random_nt | train | def different_random_nt(self,nt):
global nts
"""generate a random nucleotide change. uniform random. will never return itself
:param nt: current nucleotide
:type nt: char
:return: new nucleotide
:rtype: char
"""
return self._random.choice([x for x in nts if x != nt.upper()]) | python | {
"resource": ""
} |
q47975 | RandomSource.get_weighted_random_index | train | def get_weighted_random_index(self,weights):
"""Return an index of an array based on the weights
if a random number between 0 and 1 is less than an index return the lowest index
:param weights: a list of floats for how to weight each index [w1, w2, ... wN]
:type weights: list
:return: index
... | python | {
"resource": ""
} |
q47976 | RandomSource.uuid4 | train | def uuid4(self):
"""Make an id in the format of UUID4, but keep in mind this could very well be pseudorandom, and if it is you'll not be truely random, and can regenerate same id if same seed"""
return ''.join([hexchars[self.randint(0,15)] for x in range(0,8)]) + '-' +\
''.join([hexchars[self.randint... | python | {
"resource": ""
} |
q47977 | AssetSearchSession.get_assets_by_search | train | def get_assets_by_search(self, asset_query, asset_search):
"""Pass through to provider AssetSearchSession.get_assets_by_search"""
# Implemented from azosid template for -
# osid.resource.ResourceSearchSession.get_resources_by_search_template
if not self._can('search'):
raise ... | python | {
"resource": ""
} |
q47978 | CompositionSearchSession.get_compositions_by_search | train | def get_compositions_by_search(self, composition_query, composition_search):
"""Pass through to provider CompositionSearchSession.get_compositions_by_search"""
# Implemented from azosid template for -
# osid.resource.ResourceSearchSession.get_resources_by_search_template
if not self._can... | python | {
"resource": ""
} |
q47979 | extract_wav | train | def extract_wav(datafile, target=None):
""" Get LPCM 16bit audio stream from mediafile.
If `target` is a directory, create a .wav with the same basename as the input.
If target is empty, write to the directory of the source file. Otherwise, use it
directly as the target filename.
"... | python | {
"resource": ""
} |
q47980 | to_wav | train | def to_wav(mediafile):
""" Context manager providing a temporary WAV file created from the given media file.
"""
if mediafile.endswith(".wav"):
yield mediafile
else:
wavfile = tempfile.mktemp(__name__) + ".wav"
try:
extract_wav(mediafile, wavfile)
yield wa... | python | {
"resource": ""
} |
q47981 | get_comment_mdata | train | def get_comment_mdata():
"""Return default mdata map for Comment"""
return {
'text': {
'element_label': {
'text': 'text',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'formatTypeId': st... | python | {
"resource": ""
} |
q47982 | b64_hmac_md5 | train | def b64_hmac_md5(key, data):
"""
return base64-encoded HMAC-MD5 for key and data, with trailing '='
stripped.
"""
bdigest = base64.b64encode(hmac.new(key, data, _md5).digest()).strip().decode("utf-8")
return re.sub('=+$', '', bdigest) | python | {
"resource": ""
} |
q47983 | extract_domain | train | def extract_domain(host):
"""
Domain name extractor. Turns host names into domain names, ported
from pwdhash javascript code"""
host = re.sub('https?://', '', host)
host = re.match('([^/]+)', host).groups()[0]
domain = '.'.join(host.split('.')[-2:])
if domain in _domains:
domain = '.... | python | {
"resource": ""
} |
q47984 | generate | train | def generate(password, uri):
"""
generate the pwdhash password for master password and uri or
domain name.
"""
realm = extract_domain(uri)
if password.startswith(_password_prefix):
password = password[len(_password_prefix):]
password_hash = b64_hmac_md5(password.encode("utf-8"), rea... | python | {
"resource": ""
} |
q47985 | apply_constraints | train | def apply_constraints(phash, size, nonalphanumeric):
"""
Fiddle with the password a bit after hashing it so that it will
get through most website filters. We require one upper and lower
case, one digit, and we look at the user's password to determine
if there should be at least one alphanumeric or n... | python | {
"resource": ""
} |
q47986 | ArticleFolder.title | train | def title(self):
"""
Title for the first header.
"""
if self._title is None:
self._title = self.get_title()
return self._title | python | {
"resource": ""
} |
q47987 | ArticleFolder.get_title | train | def get_title(self):
"""
Get title line from .rst file.
**中文文档**
从一个 ``_filename`` 所指定的 .rst 文件中, 找到顶级标题.
也就是第一个 ``====`` 或 ``----`` 或 ``~~~~`` 上面一行.
"""
header_bar_char_list = "=-~+*#^"
cursor_previous_line = None
for cursor_line in textfile.re... | python | {
"resource": ""
} |
q47988 | ArticleFolder.toc_directive | train | def toc_directive(self, maxdepth=1):
"""
Generate toctree directive text.
:param table_of_content_header:
:param header_bar_char:
:param header_line_length:
:param maxdepth:
:return:
"""
articles_directive_content = TC.toc.render(
maxd... | python | {
"resource": ""
} |
q47989 | DocTree.fly | train | def fly(cls,
conf_path,
docname,
source,
maxdepth=1): # pragma: no cover
"""
Generate toctree directive for rst file.
:param conf_path: conf.py file absolute path
:param docname: the rst file relpath from conf.py directory.
:param... | python | {
"resource": ""
} |
q47990 | static | train | def static(request):
"Shorthand static URLs. In debug mode, the JavaScript is not minified."
static_url = settings.STATIC_URL
prefix = 'src' if settings.DEBUG else 'min'
return {
'CSS_URL': os.path.join(static_url, 'stylesheets/css'),
'IMAGES_URL': os.path.join(static_url, 'images'),
... | python | {
"resource": ""
} |
q47991 | AssessmentPart.get_assessment_part | train | def get_assessment_part(self):
"""Gets the parent assessment.
return: (osid.assessment.authoring.AssessmentPart) - the parent
assessment part
raise: IllegalState - ``has_parent_part()`` is ``false``
raise: OperationFailed - unable to complete request
*complianc... | python | {
"resource": ""
} |
q47992 | AssessmentPart.get_child_assessment_parts | train | def get_child_assessment_parts(self):
"""Gets any child assessment parts.
return: (osid.assessment.authoring.AssessmentPartList) - the
child assessment parts
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
... | python | {
"resource": ""
} |
q47993 | AssessmentPart._get_assessment_part_lookup_session | train | def _get_assessment_part_lookup_session(self):
"""need to account for magic parts"""
section = getattr(self, '_assessment_section', None)
session = get_assessment_part_lookup_session(self._runtime,
self._proxy,
... | python | {
"resource": ""
} |
q47994 | AssessmentPartForm.get_weight_metadata | train | def get_weight_metadata(self):
"""Gets the metadata for the weight.
return: (osid.Metadata) - metadata for the weight
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template
m... | python | {
"resource": ""
} |
q47995 | AssessmentPartForm.get_allocated_time_metadata | train | def get_allocated_time_metadata(self):
"""Gets the metadata for the allocated time.
return: (osid.Metadata) - metadata for the allocated time
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_met... | python | {
"resource": ""
} |
q47996 | AssessmentPartForm.set_allocated_time | train | def set_allocated_time(self, time):
"""Sets the allocated time.
arg: time (osid.calendaring.Duration): the allocated time
raise: InvalidArgument - ``time`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be imple... | python | {
"resource": ""
} |
q47997 | AssessmentPartForm.clear_allocated_time | train | def clear_allocated_time(self):
"""Clears the allocated time.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.assessment.As... | python | {
"resource": ""
} |
q47998 | SequenceRule.get_assessment_part_id | train | def get_assessment_part_id(self):
"""Gets the assessment part ``Id`` to which this rule belongs.
return: (osid.id.Id) - ``Id`` of an assessment part
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.Activity.get_object... | python | {
"resource": ""
} |
q47999 | SequenceRule.get_assessment_part | train | def get_assessment_part(self):
"""Gets the assessment part to which this rule belongs.
return: (osid.assessment.authoring.AssessmentPart) - an
assessment part
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.