_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q48900 | ReadEmitter.emit | train | def emit(self,rlen=150):
"""Emit a read based on a source sequence"""
source_tx = self._source.emit()
source_read = self._cutter.cut(source_tx)
if self._flip and self.options.rand.random() < 0.5: source_read = source_read.rc()
srname = self.options.rand.uuid4()
seqfull = FASTQ('@'+se... | python | {
"resource": ""
} |
q48901 | dictToH5 | train | def dictToH5(h5, d, link_copy=False):
""" Save a dictionary into an hdf5 file
h5py is not capable of handling dictionaries natively"""
global _array_cache
_array_cache = dict()
h5 = h5py.File(h5, mode="w")
dictToH5Group(d, h5["/"], link_copy=link_copy)
h5.close()
_array_cache = dict(... | python | {
"resource": ""
} |
q48902 | h5ToDict | train | def h5ToDict(h5, readH5pyDataset=True):
""" Read a hdf5 file into a dictionary """
h = h5py.File(h5, "r")
ret = unwrapArray(h, recursive=True, readH5pyDataset=readH5pyDataset)
if readH5pyDataset: h.close()
return ret | python | {
"resource": ""
} |
q48903 | _toDict | train | def _toDict(datastorage_obj,recursive=True):
""" this is the recursive part of the toDict (otherwise it fails when converting to DataStorage """
if "items" not in dir(datastorage_obj): return datastorage_obj
d = dict()
for k, v in datastorage_obj.items():
try:
d[k] = _toDict(v)
... | python | {
"resource": ""
} |
q48904 | ItemQuery.match_learning_objective_id | train | def match_learning_objective_id(self, objective_id, match):
"""Sets the learning objective ``Id`` for this query.
arg: objective_id (osid.id.Id): a learning objective ``Id``
arg: match (boolean): ``true`` for a positive match,
``false`` for negative match
raise: N... | python | {
"resource": ""
} |
q48905 | AssessmentOfferedQuery.match_start_time | train | def match_start_time(self, start, end, match):
"""Matches assessments whose start time falls between the specified range inclusive.
arg: start (osid.calendaring.DateTime): start of range
arg: end (osid.calendaring.DateTime): end of range
arg: match (boolean): ``true`` for a pos... | python | {
"resource": ""
} |
q48906 | AssessmentOfferedQuery.match_deadline | train | def match_deadline(self, start, end, match):
"""Matches assessments whose end time falls between the specified range inclusive.
arg: start (osid.calendaring.DateTime): start of range
arg: end (osid.calendaring.DateTime): end of range
arg: match (boolean): ``true`` for a positiv... | python | {
"resource": ""
} |
q48907 | AssessmentTakenQuery.match_taking_agent_id | train | def match_taking_agent_id(self, agent_id, match):
"""Sets the agent ``Id`` for this query.
arg: agent_id (osid.id.Id): an agent ``Id``
arg: match (boolean): ``true`` for a positive match,
``false`` for a negative match
raise: NullArgument - ``agent_id`` is ``null`... | python | {
"resource": ""
} |
q48908 | BankQuery.match_ancestor_bank_id | train | def match_ancestor_bank_id(self, bank_id, match):
"""Sets the bank ``Id`` for to match banks in which the specified bank is an acestor.
arg: bank_id (osid.id.Id): a bank ``Id``
arg: match (boolean): ``true`` for a positive match,
``false`` for a negative match
rais... | python | {
"resource": ""
} |
q48909 | Cmd.fill | train | def fill(cdb, defs, pparms):
"""
Take field values in parms and insert them into cdb based on
the field definitions in defs.
"""
#print "defs =", defs
parms = {n:v[2] for (n,v) in defs.items()} # Create parms for default field values.
parms.update(pparms) # Inse... | python | {
"resource": ""
} |
q48910 | Cmd.extract | train | def extract(data, defs, byteoffset=0):
"""
Extract fields from data into a structure based on field definitions in defs.
byteoffset is added to each local byte offset to get the byte offset returned for each field.
defs is a list of lists comprising start, width in bits, format,... | python | {
"resource": ""
} |
q48911 | get_question_mdata | train | def get_question_mdata():
"""Return default mdata map for Question"""
return {
'item': {
'element_label': {
'text': 'item',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'formatTypeId': ... | python | {
"resource": ""
} |
q48912 | get_answer_mdata | train | def get_answer_mdata():
"""Return default mdata map for Answer"""
return {
'item': {
'element_label': {
'text': 'item',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'formatTypeId': str(... | python | {
"resource": ""
} |
q48913 | get_item_mdata | train | def get_item_mdata():
"""Return default mdata map for Item"""
return {
'learning_objectives': {
'element_label': {
'text': 'learning objectives',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
... | python | {
"resource": ""
} |
q48914 | get_assessment_mdata | train | def get_assessment_mdata():
"""Return default mdata map for Assessment"""
return {
'rubric': {
'element_label': {
'text': 'rubric',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'formatT... | python | {
"resource": ""
} |
q48915 | get_assessment_taken_mdata | train | def get_assessment_taken_mdata():
"""Return default mdata map for AssessmentTaken"""
return {
'assessment_offered': {
'element_label': {
'text': 'assessment offered',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCR... | python | {
"resource": ""
} |
q48916 | get_assessment_section_mdata | train | def get_assessment_section_mdata():
"""Return default mdata map for AssessmentSection"""
return {
'assessment_taken': {
'element_label': {
'text': 'assessment taken',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCR... | python | {
"resource": ""
} |
q48917 | AuthorizationQuery.match_agent_id | train | def match_agent_id(self, agent_id, match):
"""Matches the agent identified by the given ``Id``.
arg: agent_id (osid.id.Id): the Id of the ``Agent``
arg: match (boolean): ``true`` if a positive match, ``false``
for a negative match
raise: NullArgument - ``agent_id`... | python | {
"resource": ""
} |
q48918 | AuthorizationQuery.match_function_id | train | def match_function_id(self, function_id, match):
"""Matches the function identified by the given ``Id``.
arg: function_id (osid.id.Id): the Id of the ``Function``
arg: match (boolean): ``true`` if a positive match, ``false``
for a negative match
raise: NullArgumen... | python | {
"resource": ""
} |
q48919 | AuthorizationQuery.match_qualifier_id | train | def match_qualifier_id(self, qualifier_id, match):
"""Matches the qualifier identified by the given ``Id``.
arg: qualifier_id (osid.id.Id): the Id of the ``Qualifier``
arg: match (boolean): ``true`` if a positive match, ``false``
for a negative match
raise: NullAr... | python | {
"resource": ""
} |
q48920 | make_temp | train | def make_temp(suffix="", prefix="tmp", dir=None):
"""
Creates a temporary file with a closed stream and deletes it when done.
:return: A contextmanager retrieving the file path.
"""
temporary = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)
os.close(temporary[0])
try:
yield... | python | {
"resource": ""
} |
q48921 | ToshlClient._list_response | train | def _list_response(self, response):
"""
This method check if the response is a dict and wrap it into a list.
If the response is already a list, it returns the response directly.
This workaround is necessary because the API doesn't return a list
if only one item is found.
... | python | {
"resource": ""
} |
q48922 | ObjectiveQuery.match_ancestor_objective_id | train | def match_ancestor_objective_id(self, objective_id=None, match=None):
"""Sets the objective ``Id`` for this query to match objectives that have the specified objective as an ancestor.
arg: objective_id (osid.id.Id): an objective ``Id``
arg: match (boolean): ``true`` for a positive match,
... | python | {
"resource": ""
} |
q48923 | ObjectiveQuery.match_descendant_objective_id | train | def match_descendant_objective_id(self, objective_id=None, match=None):
"""Sets the objective ``Id`` for this query to match objectives that have the specified objective as a descendant.
arg: objective_id (osid.id.Id): an objective ``Id``
arg: match (boolean): ``true`` for a positive matc... | python | {
"resource": ""
} |
q48924 | DataInputStream.skip | train | def skip(self, n):
"""Skips a specified number of ``bytes`` in the stream.
arg: n (cardinal): the number of ``bytes`` to skip
return: (cardinal) - the actual number of ``bytes`` skipped
raise: IllegalState - this stream has been closed or
``at_end_of_stream()`` is ``... | python | {
"resource": ""
} |
q48925 | CfbIO.root | train | def root(self):
""" Property provides access to root object in CFB. """
sector = self.header.directory_sector_start
position = (sector + 1) << self.header.sector_shift
return RootEntry(self, position) | python | {
"resource": ""
} |
q48926 | CfbIO.next_fat | train | def next_fat(self, current):
"""
Helper gives you seekable position of next FAT sector. Should not be
called from external code.
"""
sector_size = self.header.sector_size // 4
block = current // sector_size
difat_position = 76
if block >= 109:
... | python | {
"resource": ""
} |
q48927 | CfbIO.next_minifat | train | def next_minifat(self, current):
"""
Helpers provides access to next mini-FAT sector and returns it's
seekable position. Should not be called from external code.
"""
position = 0
sector_size = self.header.sector_size // 4
sector = self.header.minifat_sector_start
... | python | {
"resource": ""
} |
q48928 | ItemSearchSession.get_items_by_search | train | def get_items_by_search(self, item_query, item_search):
"""Pass through to provider ItemSearchSession.get_items_by_search"""
# Implemented from azosid template for -
# osid.resource.ResourceSearchSession.get_resources_by_search_template
if not self._can('search'):
raise Permi... | python | {
"resource": ""
} |
q48929 | AssessmentSearchSession.get_assessments_by_search | train | def get_assessments_by_search(self, assessment_query, assessment_search):
"""Pass through to provider AssessmentSearchSession.get_assessments_by_search"""
# Implemented from azosid template for -
# osid.resource.ResourceSearchSession.get_resources_by_search_template
if not self._can('sea... | python | {
"resource": ""
} |
q48930 | AssessmentOfferedSearchSession.get_assessments_offered_by_search | train | def get_assessments_offered_by_search(self, assessment_offered_query, assessment_offered_search):
"""Pass through to provider AssessmentOfferedSearchSession.get_assessments_offered_by_search"""
# Implemented from azosid template for -
# osid.resource.ResourceSearchSession.get_resources_by_search... | python | {
"resource": ""
} |
q48931 | AssessmentTakenSearchSession.get_assessments_taken_by_search | train | def get_assessments_taken_by_search(self, assessment_taken_query, assessment_taken_search):
"""Pass through to provider AssessmentTakenSearchSession.get_assessments_taken_by_search"""
# Implemented from azosid template for -
# osid.resource.ResourceSearchSession.get_resources_by_search_template
... | python | {
"resource": ""
} |
q48932 | get_authentication_mdata | train | def get_authentication_mdata():
"""Return default mdata map for Authentication"""
return {
'agent': {
'element_label': {
'text': 'agent',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'f... | python | {
"resource": ""
} |
q48933 | register | train | def register(username, password):
"""
Create a new user account. Creates a user account with the given
credentials on the selected cloud server.
"""
check_for_cloud_server()
server = Server(config["cloud_server"]["url"])
server.create_user(username, password) | python | {
"resource": ""
} |
q48934 | login | train | def login(username, password):
""" Log into your user account """
check_for_cloud_server()
old_username = config["cloud_server"]["username"]
if old_username and old_username != username:
raise click.ClickException(
"Already logged in as user \"{}\". Run `openag cloud user logout` "
... | python | {
"resource": ""
} |
q48935 | logout | train | def logout(ctx):
""" Log out of your user account """
check_for_cloud_server()
check_for_cloud_user()
if config["cloud_server"]["farm_name"]:
ctx.invoke(deinit_farm)
config["cloud_server"]["username"] = None
config["cloud_server"]["password"] = None | python | {
"resource": ""
} |
q48936 | Command.instruction | train | def instruction(self, val):
"""Set the action and command from an instruction"""
self._instruction = val
if isinstance(val, tuple):
if len(val) is 2:
self._action, self.command = val
else:
self._action, self.command, self.extra = val
... | python | {
"resource": ""
} |
q48937 | Command.as_string | train | def as_string(self):
"""Return the command as a single string for the docker file"""
if type(self.instruction) is str:
return self.instruction
if self.action == "FROM" and not isinstance(self.command, six.string_types):
extra = "" if self.extra is NotSpecified else " {0}... | python | {
"resource": ""
} |
q48938 | Commands.commands | train | def commands(self):
"""Memoize and return the flattened list of commands"""
if not getattr(self, "_commands", None):
self._commands = []
for command in self.orig_commands:
if isinstance(command, Command):
command = [command]
for... | python | {
"resource": ""
} |
q48939 | Commands.external_dependencies | train | def external_dependencies(self):
"""
Return all the external images this Dockerfile will depend on
These are images from self.dependent_images that aren't defined in this configuration.
"""
found = []
for dep in self.dependent_images:
if isinstance(dep, six.s... | python | {
"resource": ""
} |
q48940 | Commands.dependent_images | train | def dependent_images(self):
"""
Determine the dependent images from these commands
This includes all the FROM statements
and any external image from a complex ADD instruction that copies from another container
"""
found = []
for command in self.commands:
... | python | {
"resource": ""
} |
q48941 | ODEProblem.validate | train | def validate(self):
"""
Validates whether the ODE equations provided make sense i.e. the number of right-hand side equations
match the number of left-hand side equations.
"""
if self.left_hand_side.rows != self.right_hand_side.rows:
raise ValueError("There are {0} le... | python | {
"resource": ""
} |
q48942 | ODEProblem._repr_latex_ | train | def _repr_latex_(self):
"""
This is used in IPython notebook it allows us to render the ODEProblem object in LaTeX.
How Cool is this?
"""
# TODO: we're mixing HTML with latex here. That is not necessarily a good idea, but works
# with IPython 1.2.0. Once IPython 2.0 is re... | python | {
"resource": ""
} |
q48943 | decensor_iter | train | def decensor_iter(posts_info: Iterable[dict], site_url: str = DEFAULT_SITE
) -> Generator[dict, None, None]:
"""Apply decensoring on an iterable of posts info dicts from Danbooru API.
Any censored post is automatically decensored if needed."""
for info in posts_info:
yield decensor(... | python | {
"resource": ""
} |
q48944 | decensor | train | def decensor(post_info: dict, site_url: str = DEFAULT_SITE) -> dict:
"Decensor a post info dict from Danbooru API if needed."
return post_info \
if "md5" in post_info else fill_missing_info(post_info, site_url) | python | {
"resource": ""
} |
q48945 | fill_missing_info | train | def fill_missing_info(info: dict, site_url: str = DEFAULT_SITE) -> dict:
"Add missing info in a censored post info dict."
try:
md5, ext = find_censored_md5ext(info["id"])
except TypeError: # None returned by find_..
return info
sample_ext = "jpg" if ext != "zip" else "webm"
if inf... | python | {
"resource": ""
} |
q48946 | find_censored_md5ext | train | def find_censored_md5ext(post_id: int) -> Optional[str]:
"Find MD5 for a censored post's ID, return None if can't find."
try:
last_pull_date = LAST_PULL_DATE_FILE.read_text().strip()
except FileNotFoundError:
last_pull_date = ""
date = datetime.utcnow()
date = f"{date.year}{date.mon... | python | {
"resource": ""
} |
q48947 | AssessmentPartLookupSession._view_filter | train | def _view_filter(self):
"""
Overrides OsidSession._view_filter to add sequestering filter.
"""
view_filter = OsidSession._view_filter(self)
if self._sequestered_view == SEQUESTERED:
view_filter['sequestered'] = False
return view_filter | python | {
"resource": ""
} |
q48948 | AssessmentPartLookupSession.get_assessment_part | train | def get_assessment_part(self, assessment_part_id):
"""Gets the ``AssessmentPart`` specified by its ``Id``.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart`` to retrieve
return: (osid.assessment.authoring.AssessmentPart) - the
returned ... | python | {
"resource": ""
} |
q48949 | AssessmentPartLookupSession.get_assessment_parts_by_ids | train | def get_assessment_parts_by_ids(self, assessment_part_ids):
"""Gets an ``AssessmentPartList`` corresponding to the given ``IdList``.
arg: assessment_part_ids (osid.id.IdList): the list of
``Ids`` to retrieve
return: (osid.assessment.authoring.AssessmentPartList) - the
... | python | {
"resource": ""
} |
q48950 | AssessmentPartLookupSession.get_assessment_parts_by_genus_type | train | def get_assessment_parts_by_genus_type(self, assessment_part_genus_type):
"""Gets an ``AssessmentPartList`` corresponding to the given assessment part genus ``Type`` which does not include assessment parts of types derived from the specified ``Type``.
arg: assessment_part_genus_type (osid.type.Type)... | python | {
"resource": ""
} |
q48951 | AssessmentPartLookupSession.get_assessment_parts_for_assessment | train | def get_assessment_parts_for_assessment(self, assessment_id):
"""Gets an ``AssessmentPart`` for the given assessment.
arg: assessment_id (osid.id.Id): an assessment ``Id``
return: (osid.assessment.authoring.AssessmentPartList) - the
returned ``AssessmentPart`` list
ra... | python | {
"resource": ""
} |
q48952 | AssessmentPartLookupSession.get_assessment_parts | train | def get_assessment_parts(self):
"""Gets all ``AssessmentParts``.
return: (osid.assessment.authoring.AssessmentPartList) - a list
of ``AssessmentParts``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*complian... | python | {
"resource": ""
} |
q48953 | AssessmentPartLookupSession.get_assessment_parts_for_assessment_part | train | def get_assessment_parts_for_assessment_part(self, assessment_part_id):
"""Gets an ``AssessmentPart`` for the given assessment part.
arg: assessment_part_id (osid.id.Id): an assessment part ``Id``
return: (osid.assessment.authoring.AssessmentPartList) - the
returned ``Assessm... | python | {
"resource": ""
} |
q48954 | AssessmentPartQuerySession.get_assessment_parts_by_query | train | def get_assessment_parts_by_query(self, assessment_part_query):
"""Gets a list of ``AssessmentParts`` matching the given assessment part query.
arg: assessment_part_query
(osid.assessment.authoring.AssessmentPartQuery): the
assessment part query
return: (osid.... | python | {
"resource": ""
} |
q48955 | AssessmentPartAdminSession.get_assessment_part_form_for_create_for_assessment | train | def get_assessment_part_form_for_create_for_assessment(self, assessment_id, assessment_part_record_types):
"""Gets the assessment part form for creating new assessment parts for an assessment.
A new form should be requested for each create transaction.
arg: assessment_id (osid.id.Id): an as... | python | {
"resource": ""
} |
q48956 | AssessmentPartAdminSession.create_assessment_part_for_assessment | train | def create_assessment_part_for_assessment(self, assessment_part_form):
"""Creates a new assessment part.
arg: assessment_part_form
(osid.assessment.authoring.AssessmentPartForm):
assessment part form
return: (osid.assessment.authoring.AssessmentPart) - the new... | python | {
"resource": ""
} |
q48957 | AssessmentPartAdminSession.get_assessment_part_form_for_create_for_assessment_part | train | def get_assessment_part_form_for_create_for_assessment_part(self, assessment_part_id, assessment_part_record_types):
"""Gets the assessment part form for creating new assessment parts under another assessment part.
A new form should be requested for each create transaction.
arg: assessment_... | python | {
"resource": ""
} |
q48958 | AssessmentPartAdminSession.get_assessment_part_form_for_update | train | def get_assessment_part_form_for_update(self, assessment_part_id):
"""Gets the assessment part form for updating an existing assessment part.
A new assessment part form should be requested for each update
transaction.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
... | python | {
"resource": ""
} |
q48959 | AssessmentPartAdminSession.update_assessment_part | train | def update_assessment_part(self, assessment_part_id, assessment_part_form):
"""Updates an existing assessment part.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart``
arg: assessment_part_form
(osid.assessment.authoring.AssessmentPar... | python | {
"resource": ""
} |
q48960 | AssessmentPartAdminSession.delete_assessment_part | train | def delete_assessment_part(self, assessment_part_id):
"""Removes an asessment part and all mapped items.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart``
raise: NotFound - ``assessment_part_id`` not found
raise: NullArgument - ``assessment_... | python | {
"resource": ""
} |
q48961 | AssessmentPartAdminSession.alias_assessment_part | train | def alias_assessment_part(self, assessment_part_id, alias_id):
"""Adds an ``Id`` to an ``AssessmentPart`` for the purpose of creating compatibility.
The primary ``Id`` of the ``AssessmentPart`` is determined by
the provider. The new ``Id`` is an alias to the primary ``Id``.
If the alias... | python | {
"resource": ""
} |
q48962 | AssessmentPartBankSession.get_assessment_part_ids_by_bank | train | def get_assessment_part_ids_by_bank(self, bank_id):
"""Gets the list of ``AssessmentPartIds`` associated with an ``Bank``.
arg: bank_id (osid.id.Id): ``Id`` of the ``Bank``
return: (osid.id.IdList) - list of related assessment part
``Ids``
raise: NotFound - ``bank_id... | python | {
"resource": ""
} |
q48963 | AssessmentPartBankSession.get_assessment_parts_by_bank | train | def get_assessment_parts_by_bank(self, bank_id):
"""Gets the list of assessment parts associated with an ``Bank``.
arg: bank_id (osid.id.Id): ``Id`` of the ``Bank``
return: (osid.assessment.authoring.AssessmentPartList) - list of
related assessment parts
raise: NotFo... | python | {
"resource": ""
} |
q48964 | AssessmentPartBankSession.get_assessment_part_ids_by_banks | train | def get_assessment_part_ids_by_banks(self, bank_ids):
"""Gets the list of ``AssessmentPart Ids`` corresponding to a list of ``Banks``.
arg: bank_ids (osid.id.IdList): list of bank ``Ids``
return: (osid.id.IdList) - list of assessment part ``Ids``
raise: NullArgument - ``bank_ids`` i... | python | {
"resource": ""
} |
q48965 | AssessmentPartBankSession.get_assessment_parts_by_banks | train | def get_assessment_parts_by_banks(self, bank_ids):
"""Gets the list of assessment part corresponding to a list of ``Banks``.
arg: bank_ids (osid.id.IdList): list of bank ``Ids``
return: (osid.assessment.authoring.AssessmentPartList) - list of
assessment parts
raise: ... | python | {
"resource": ""
} |
q48966 | AssessmentPartBankSession.get_bank_ids_by_assessment_part | train | def get_bank_ids_by_assessment_part(self, assessment_part_id):
"""Gets the ``Bank`` ``Ids`` mapped to an ``AssessmentPart``.
arg: assessment_part_id (osid.id.Id): ``Id`` of an
``AssessmentPart``
return: (osid.id.IdList) - list of banks
raise: NotFound - ``assessment... | python | {
"resource": ""
} |
q48967 | AssessmentPartBankSession.get_banks_by_assessment_part | train | def get_banks_by_assessment_part(self, assessment_part_id):
"""Gets the ``Banks`` mapped to an ``AssessmentPart``.
arg: assessment_part_id (osid.id.Id): ``Id`` of an
``AssessmentPart``
return: (osid.assessment.BankList) - list of banks
raise: NotFound - ``assessment_... | python | {
"resource": ""
} |
q48968 | AssessmentPartBankAssignmentSession.get_assignable_bank_ids | train | def get_assignable_bank_ids(self, bank_id):
"""Gets a list of bank including and under the given bank node in which any assessment part can be assigned.
arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank``
return: (osid.id.IdList) - list of assignable bank ``Ids``
raise: NullArgume... | python | {
"resource": ""
} |
q48969 | AssessmentPartBankAssignmentSession.assign_assessment_part_to_bank | train | def assign_assessment_part_to_bank(self, assessment_part_id, bank_id):
"""Adds an existing ``AssessmentPart`` to an ``Bank``.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart``
arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank``
raise: Al... | python | {
"resource": ""
} |
q48970 | AssessmentPartBankAssignmentSession.unassign_assessment_part_from_bank | train | def unassign_assessment_part_from_bank(self, assessment_part_id, bank_id):
"""Removes an ``AssessmentPart`` from an ``Bank``.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart``
arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank``
raise: No... | python | {
"resource": ""
} |
q48971 | AssessmentPartBankAssignmentSession.reassign_assessment_part_to_bank | train | def reassign_assessment_part_to_bank(self, assessment_part_id, from_biank_id, to_bank_id):
"""Moves an ``AssessmentPart`` from one ``Bank`` to another.
Mappings to other ``Banks`` are unaffected.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart``
... | python | {
"resource": ""
} |
q48972 | AssessmentPartItemSession.get_assessment_part_items | train | def get_assessment_part_items(self, assessment_part_id):
"""Gets the list of items mapped to the given ``AssessmentPart``.
In plenary mode, the returned list contains all known items or
an error results. Otherwise, the returned list may contain only
those items that are accessible throu... | python | {
"resource": ""
} |
q48973 | AssessmentPartItemSession.get_assessment_parts_by_item | train | def get_assessment_parts_by_item(self, item_id):
"""Gets the assessment parts containing the given item.
In plenary mode, the returned list contains all known assessment
parts or an error results. Otherwise, the returned list may
contain only those assessment parts that are accessible t... | python | {
"resource": ""
} |
q48974 | AssessmentPartItemDesignSession.add_item | train | def add_item(self, item_id, assessment_part_id):
"""Appends an item to an assessment part.
arg: item_id (osid.id.Id): ``Id`` of the ``Item``
arg: assessment_part_id (osid.id.Id): ``Id`` of the
``AssessmentPart``
raise: AlreadyExists - ``item_id`` already part of
... | python | {
"resource": ""
} |
q48975 | AssessmentPartItemDesignSession.move_item_ahead | train | def move_item_ahead(self, item_id, assessment_part_id, reference_id):
"""Reorders items in an assessment part by moving the specified item in front of a reference item.
arg: item_id (osid.id.Id): ``Id`` of the ``Item``
arg: assessment_part_id (osid.id.Id): ``Id`` of the
``... | python | {
"resource": ""
} |
q48976 | AssessmentPartItemDesignSession.move_item_behind | train | def move_item_behind(self, item_id, assessment_part_id, reference_id):
"""Reorders items in an assessment part by moving the specified item behind of a reference item.
arg: item_id (osid.id.Id): ``Id`` of the ``Item``
arg: assessment_part_id (osid.id.Id): ``Id of the
Asses... | python | {
"resource": ""
} |
q48977 | AssessmentPartItemDesignSession.order_items | train | def order_items(self, item_ids, assessment_part_id):
"""Reorders a set of items in an assessment part.
arg: item_ids (osid.id.Id[]): ``Ids`` for a set of ``Items``
arg: assessment_part_id (osid.id.Id): ``Id`` of the
``AssessmentPartId``
raise: NotFound - ``assessm... | python | {
"resource": ""
} |
q48978 | AssessmentPartItemDesignSession.remove_item | train | def remove_item(self, item_id, assessment_part_id):
"""Removes an ``Item`` from an ``AssessmentPartId``.
arg: item_id (osid.id.Id): ``Id`` of the ``Item``
arg: assessment_part_id (osid.id.Id): ``Id`` of the
``AssessmentPartId``
raise: NotFound - ``item_id`` ``not... | python | {
"resource": ""
} |
q48979 | AssessmentPartItemDesignSession._get_assessment_part_collection | train | def _get_assessment_part_collection(self, assessment_part_id):
"""Returns a Mongo Collection and AssessmentPart given a AssessmentPart Id"""
collection = JSONClientValidated('assessment_authoring',
collection='AssessmentPart',
... | python | {
"resource": ""
} |
q48980 | SequenceRuleLookupSession.get_sequence_rule | train | def get_sequence_rule(self, sequence_rule_id):
"""Gets the ``SequenceRule`` specified by its ``Id``.
arg: sequence_rule_id (osid.id.Id): ``Id`` of the
``SequenceRule``
return: (osid.assessment.authoring.SequenceRule) - the sequence
rule
raise: NotFoun... | python | {
"resource": ""
} |
q48981 | SequenceRuleLookupSession.get_sequence_rules_by_ids | train | def get_sequence_rules_by_ids(self, sequence_rule_ids):
"""Gets a ``SequenceRuleList`` corresponding to the given ``IdList``.
arg: sequence_rule_ids (osid.id.IdList): the list of ``Ids``
to retrieve
return: (osid.assessment.authoring.SequenceRuleList) - the
re... | python | {
"resource": ""
} |
q48982 | SequenceRuleLookupSession.get_sequence_rules_by_genus_type | train | def get_sequence_rules_by_genus_type(self, sequence_rule_genus_type):
"""Gets a ``SequenceRuleList`` corresponding to the given sequence rule genus ``Type`` which does not include sequence rule of genus types derived from the specified ``Type``.
arg: sequence_rule_genus_type (osid.type.Type): a sequ... | python | {
"resource": ""
} |
q48983 | SequenceRuleLookupSession.get_sequence_rules_for_assessment_part | train | def get_sequence_rules_for_assessment_part(self, assessment_part_id):
"""Gets a ``SequenceRuleList`` for the given source assessment part.
arg: assessment_part_id (osid.id.Id): an assessment part
``Id``
return: (osid.assessment.authoring.SequenceRuleList) - the
... | python | {
"resource": ""
} |
q48984 | SequenceRuleLookupSession.get_sequence_rules_for_assessment | train | def get_sequence_rules_for_assessment(self, assessment_id):
"""Gets a ``SequenceRuleList`` for an entire assessment.
arg: assessment_id (osid.id.Id): an assessment ``Id``
return: (osid.assessment.authoring.SequenceRuleList) - the
returned ``SequenceRule`` list
raise: ... | python | {
"resource": ""
} |
q48985 | SequenceRuleLookupSession.get_sequence_rules | train | def get_sequence_rules(self):
"""Gets all ``SequenceRules``.
return: (osid.assessment.authoring.SequenceRuleList) - the
returned ``SequenceRule`` list
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*complianc... | python | {
"resource": ""
} |
q48986 | SequenceRuleAdminSession.get_sequence_rule_form_for_create | train | def get_sequence_rule_form_for_create(self, assessment_part_id, next_assessment_part_id, sequence_rule_record_types):
"""Gets the sequence rule form for creating new sequence rules between two assessment parts.
A new form should be requested for each create transaction.
arg: assessment_part... | python | {
"resource": ""
} |
q48987 | SequenceRuleAdminSession.create_sequence_rule | train | def create_sequence_rule(self, sequence_rule_form):
"""Creates a new ``SequenceRule``.
arg: sequence_rule_form
(osid.assessment.authoring.SequenceRuleForm): the form
for this ``SequenceRule``
return: (osid.assessment.authoring.SequenceRule) - the new
... | python | {
"resource": ""
} |
q48988 | SequenceRuleAdminSession.update_sequence_rule | train | def update_sequence_rule(self, sequence_rule_form):
"""Updates an existing sequence rule.
arg: sequence_rule_form
(osid.assessment.authoring.SequenceRuleForm): the form
containing the elements to be updated
raise: IllegalState - ``sequence_rule_form`` already... | python | {
"resource": ""
} |
q48989 | SequenceRuleAdminSession.delete_sequence_rule | train | def delete_sequence_rule(self, sequence_rule_id):
"""Deletes a ``SequenceRule``.
arg: sequence_rule_id (osid.id.Id): the ``Id`` of the
``SequenceRule`` to remove
raise: NotFound - ``sequence_rule_id`` not found
raise: NullArgument - ``sequence_rule_id`` is ``null``
... | python | {
"resource": ""
} |
q48990 | SequenceRuleAdminSession.alias_sequence_rule | train | def alias_sequence_rule(self, sequence_rule_id, alias_id):
"""Adds a ``Id`` to a ``SequenceRule`` for the purpose of creating compatibility.
The primary ``Id`` of the ``SequenceRule`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id`` . If the alias... | python | {
"resource": ""
} |
q48991 | DjangoAuthentication.get_agent | train | def get_agent(self):
"""Gets the ``Agent`` identified in this authentication credential.
:return: the ``Agent``
:rtype: ``osid.authentication.Agent``
:raise: ``OperationFailed`` -- unable to complete request
*compliance: mandatory -- This method must be implemented.*
"... | python | {
"resource": ""
} |
q48992 | spectrogram_image | train | def spectrogram_image(mediafile, dpi=72, outdir=None, outfile=None):
# TODO: Add some of the constants below as parameters
""" Create spectrogram image from audio data.
Return path to created image file.
"""
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
imp... | python | {
"resource": ""
} |
q48993 | EnclosureRecord.get_genus_type | train | def get_genus_type(self):
"""Overrides get_genus_type of extended object"""
enclosed_object_id = self.get_enclosed_object_id()
package = enclosed_object_id.get_identifier_namespace().split('.')[0]
obj = enclosed_object_id.get_identifier_namespace().split('.')[1]
return Type(
... | python | {
"resource": ""
} |
q48994 | EnclosureRecord.get_enclosed_object | train | def get_enclosed_object(self):
"""Return the enclosed object"""
if self._enclosed_object is None:
enclosed_object_id = self.get_enclosed_object_id()
package_name = enclosed_object_id.get_identifier_namespace().split('.')[0]
obj_name = enclosed_object_id.get_identifier... | python | {
"resource": ""
} |
q48995 | EnclosureFormRecord._init_metadata | train | def _init_metadata(self):
"""Initialize metadata for this record"""
self._enclosed_object_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'enclosed_object'),
'element... | python | {
"resource": ""
} |
q48996 | EnclosureFormRecord.get_display_name_metadata | train | def get_display_name_metadata(self):
"""Overrides get_display_name_metadata of extended object"""
metadata = dict(self.my_osid_object_form._mdata['display_name'])
metadata.update({'read_only': True})
return Metadata(**metadata) | python | {
"resource": ""
} |
q48997 | EnclosureFormRecord.get_description_metadata | train | def get_description_metadata(self):
"""Overrides get_description_metadata of extended object"""
metadata = dict(self.my_osid_object_form._description_metadata)
metadata.update({'read_only': True})
return Metadata(**metadata) | python | {
"resource": ""
} |
q48998 | EnclosureFormRecord.get_genus_type_metadata | train | def get_genus_type_metadata(self):
"""Overrides get_genus_type_metadata of extended object"""
metadata = dict(self.my_osid_object_form._genus_type_metadata)
metadata.update({'read_only': True})
return Metadata(**metadata) | python | {
"resource": ""
} |
q48999 | OsidProfile._initialize_manager | train | def _initialize_manager(self, runtime):
"""Sets the runtime, configuration and json client"""
if self._runtime is not None:
raise errors.IllegalState('this manager has already been initialized.')
self._runtime = runtime
self._config = runtime.get_configuration()
set_j... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.