repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
MacHu-GWU/docfly-project | docfly/doctree.py | DocTree.fly | 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 | 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... | [
"def",
"fly",
"(",
"cls",
",",
"conf_path",
",",
"docname",
",",
"source",
",",
"maxdepth",
"=",
"1",
")",
":",
"# pragma: no cover",
"msg",
"=",
"(",
"\"``.. articles::`` directive is going to be deprecated. \"",
"\"use ``.. autodoctree`` instead.\"",
")",
"warnings",
... | 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 source: rst content.
:param maxdepth: int, max toc tree depth. | [
"Generate",
"toctree",
"directive",
"for",
"rst",
"file",
"."
] | train | https://github.com/MacHu-GWU/docfly-project/blob/46da8a9793211301c3ebc12d195228dbf79fdfec/docfly/doctree.py#L144-L177 |
chop-dbhi/varify | varify/variants/resources.py | VariantAssessmentMetricsResource.get_assessment_data | def get_assessment_data(self, queryset, total_count, user_id):
"""
Calculates and sets the following data for the supplied queryset:
data = {
'count': <the number of items in the queryset>
'percentage': <percentage of total_count queryset represents>
... | python | def get_assessment_data(self, queryset, total_count, user_id):
"""
Calculates and sets the following data for the supplied queryset:
data = {
'count': <the number of items in the queryset>
'percentage': <percentage of total_count queryset represents>
... | [
"def",
"get_assessment_data",
"(",
"self",
",",
"queryset",
",",
"total_count",
",",
"user_id",
")",
":",
"# We need to convert the usernames to strings here because the JSON",
"# encoder will choke when serializing this data if the usernames are",
"# unicode as they are when we get them... | Calculates and sets the following data for the supplied queryset:
data = {
'count': <the number of items in the queryset>
'percentage': <percentage of total_count queryset represents>
'is_user_call': <true if user made this call, false otherwise>
... | [
"Calculates",
"and",
"sets",
"the",
"following",
"data",
"for",
"the",
"supplied",
"queryset",
":",
"data",
"=",
"{",
"count",
":",
"<the",
"number",
"of",
"items",
"in",
"the",
"queryset",
">",
"percentage",
":",
"<percentage",
"of",
"total_count",
"queryse... | train | https://github.com/chop-dbhi/varify/blob/5dc721e49ed9bd3582f4b117785fdd1a8b6ba777/varify/variants/resources.py#L205-L232 |
chop-dbhi/varify | varify/context_processors.py | static | 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 | 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'),
... | [
"def",
"static",
"(",
"request",
")",
":",
"static_url",
"=",
"settings",
".",
"STATIC_URL",
"prefix",
"=",
"'src'",
"if",
"settings",
".",
"DEBUG",
"else",
"'min'",
"return",
"{",
"'CSS_URL'",
":",
"os",
".",
"path",
".",
"join",
"(",
"static_url",
",",... | Shorthand static URLs. In debug mode, the JavaScript is not minified. | [
"Shorthand",
"static",
"URLs",
".",
"In",
"debug",
"mode",
"the",
"JavaScript",
"is",
"not",
"minified",
"."
] | train | https://github.com/chop-dbhi/varify/blob/5dc721e49ed9bd3582f4b117785fdd1a8b6ba777/varify/context_processors.py#L8-L16 |
mitsei/dlkit | dlkit/json_/authentication_process/objects.py | Authentication.get_agent_id | def get_agent_id(self):
"""Gets the ``Id`` of the ``Agent`` identified in this authentication credential.
return: (osid.id.Id) - the ``Agent Id``
*compliance: mandatory -- This method must be implemented.*
*implementation notes*: The Agent should be determined at the
time this c... | python | def get_agent_id(self):
"""Gets the ``Id`` of the ``Agent`` identified in this authentication credential.
return: (osid.id.Id) - the ``Agent Id``
*compliance: mandatory -- This method must be implemented.*
*implementation notes*: The Agent should be determined at the
time this c... | [
"def",
"get_agent_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_django_user",
"is",
"not",
"None",
":",
"return",
"Id",
"(",
"identifier",
"=",
"self",
".",
"_django_user",
".",
"get_username",
"(",
")",
",",
"namespace",
"=",
"'osid.agent.Agent'",
",",... | Gets the ``Id`` of the ``Agent`` identified in this authentication credential.
return: (osid.id.Id) - the ``Agent Id``
*compliance: mandatory -- This method must be implemented.*
*implementation notes*: The Agent should be determined at the
time this credential is created. | [
"Gets",
"the",
"Id",
"of",
"the",
"Agent",
"identified",
"in",
"this",
"authentication",
"credential",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication_process/objects.py#L41-L57 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPart.get_assessment_part | 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 | 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... | [
"def",
"get_assessment_part",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"has_parent_part",
"(",
")",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'no parent part'",
")",
"lookup_session",
"=",
"self",
".",
"_get_assessment_part_lookup_session",
"(",
... | 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
*compliance: mandatory -- This method must be implem... | [
"Gets",
"the",
"parent",
"assessment",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L110-L123 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPart.get_child_assessment_parts | 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 | 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.*
... | [
"def",
"get_child_assessment_parts",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"has_children",
"(",
")",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'no children assessment parts'",
")",
"# only returned unsequestered children?",
"lookup_session",
"=",
"... | 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.* | [
"Gets",
"any",
"child",
"assessment",
"parts",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L182-L196 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPart.get_items | def get_items(self):
"""This is out of spec, but required for adaptive assessment parts?"""
ils = get_item_lookup_session(runtime=self._runtime, proxy=self._proxy)
ils.use_federated_bank_view()
items = []
if self.has_items():
for idstr in self._my_map['itemIds']:
... | python | def get_items(self):
"""This is out of spec, but required for adaptive assessment parts?"""
ils = get_item_lookup_session(runtime=self._runtime, proxy=self._proxy)
ils.use_federated_bank_view()
items = []
if self.has_items():
for idstr in self._my_map['itemIds']:
... | [
"def",
"get_items",
"(",
"self",
")",
":",
"ils",
"=",
"get_item_lookup_session",
"(",
"runtime",
"=",
"self",
".",
"_runtime",
",",
"proxy",
"=",
"self",
".",
"_proxy",
")",
"ils",
".",
"use_federated_bank_view",
"(",
")",
"items",
"=",
"[",
"]",
"if",
... | This is out of spec, but required for adaptive assessment parts? | [
"This",
"is",
"out",
"of",
"spec",
"but",
"required",
"for",
"adaptive",
"assessment",
"parts?"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L264-L272 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPart.get_item_ids | def get_item_ids(self):
"""This is out of spec, but required for adaptive assessment parts?"""
item_ids = []
if self.has_items():
for idstr in self._my_map['itemIds']:
item_ids.append(idstr)
return IdList(item_ids) | python | def get_item_ids(self):
"""This is out of spec, but required for adaptive assessment parts?"""
item_ids = []
if self.has_items():
for idstr in self._my_map['itemIds']:
item_ids.append(idstr)
return IdList(item_ids) | [
"def",
"get_item_ids",
"(",
"self",
")",
":",
"item_ids",
"=",
"[",
"]",
"if",
"self",
".",
"has_items",
"(",
")",
":",
"for",
"idstr",
"in",
"self",
".",
"_my_map",
"[",
"'itemIds'",
"]",
":",
"item_ids",
".",
"append",
"(",
"idstr",
")",
"return",
... | This is out of spec, but required for adaptive assessment parts? | [
"This",
"is",
"out",
"of",
"spec",
"but",
"required",
"for",
"adaptive",
"assessment",
"parts?"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L274-L280 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPart.get_next_assessment_part_id | def get_next_assessment_part_id(self, assessment_part_id):
"""This supports the basic simple sequence case. Can be overriden in a record for other cases"""
if self.has_next_assessment_part(assessment_part_id):
return Id(self._my_map['childIds'][self._my_map['childIds'].index(str(assessment_p... | python | def get_next_assessment_part_id(self, assessment_part_id):
"""This supports the basic simple sequence case. Can be overriden in a record for other cases"""
if self.has_next_assessment_part(assessment_part_id):
return Id(self._my_map['childIds'][self._my_map['childIds'].index(str(assessment_p... | [
"def",
"get_next_assessment_part_id",
"(",
"self",
",",
"assessment_part_id",
")",
":",
"if",
"self",
".",
"has_next_assessment_part",
"(",
"assessment_part_id",
")",
":",
"return",
"Id",
"(",
"self",
".",
"_my_map",
"[",
"'childIds'",
"]",
"[",
"self",
".",
"... | This supports the basic simple sequence case. Can be overriden in a record for other cases | [
"This",
"supports",
"the",
"basic",
"simple",
"sequence",
"case",
".",
"Can",
"be",
"overriden",
"in",
"a",
"record",
"for",
"other",
"cases"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L296-L299 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPart._get_assessment_part_lookup_session | 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 | 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,
... | [
"def",
"_get_assessment_part_lookup_session",
"(",
"self",
")",
":",
"section",
"=",
"getattr",
"(",
"self",
",",
"'_assessment_section'",
",",
"None",
")",
"session",
"=",
"get_assessment_part_lookup_session",
"(",
"self",
".",
"_runtime",
",",
"self",
".",
"_pro... | need to account for magic parts | [
"need",
"to",
"account",
"for",
"magic",
"parts"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L306-L314 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPartForm._init_metadata | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidContainableForm._init_metadata(self)
osid_objects.OsidOperableForm._init_metadata(self)
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
if 'assessment_part_id' not in kwargs:
... | python | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidContainableForm._init_metadata(self)
osid_objects.OsidOperableForm._init_metadata(self)
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
if 'assessment_part_id' not in kwargs:
... | [
"def",
"_init_metadata",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"osid_objects",
".",
"OsidContainableForm",
".",
"_init_metadata",
"(",
"self",
")",
"osid_objects",
".",
"OsidOperableForm",
".",
"_init_metadata",
"(",
"self",
")",
"osid_objects",
".",
... | Initialize form metadata | [
"Initialize",
"form",
"metadata"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L338-L367 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPartForm._init_map | def _init_map(self, record_types=None, **kwargs):
"""Initialize form map"""
osid_objects.OsidContainableForm._init_map(self)
osid_objects.OsidOperableForm._init_map(self)
osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
if 'assessment_part_id' in kwargs:
... | python | def _init_map(self, record_types=None, **kwargs):
"""Initialize form map"""
osid_objects.OsidContainableForm._init_map(self)
osid_objects.OsidOperableForm._init_map(self)
osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
if 'assessment_part_id' in kwargs:
... | [
"def",
"_init_map",
"(",
"self",
",",
"record_types",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"osid_objects",
".",
"OsidContainableForm",
".",
"_init_map",
"(",
"self",
")",
"osid_objects",
".",
"OsidOperableForm",
".",
"_init_map",
"(",
"self",
")",... | Initialize form map | [
"Initialize",
"form",
"map"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L369-L391 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPartForm.get_weight_metadata | 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 | 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... | [
"def",
"get_weight_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'weight'",
"]",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing... | Gets the metadata for the weight.
return: (osid.Metadata) - metadata for the weight
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"weight",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L393-L403 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPartForm.get_allocated_time_metadata | 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 | 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... | [
"def",
"get_allocated_time_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'allocated_time'",
"]",
")",
"metadata",
".",
"update",
"(",
"... | Gets the metadata for the allocated time.
return: (osid.Metadata) - metadata for the allocated time
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"allocated",
"time",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L431-L441 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPartForm.set_allocated_time | 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 | 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... | [
"def",
"set_allocated_time",
"(",
"self",
",",
"time",
")",
":",
"# Implemented from template for osid.assessment.AssessmentOfferedForm.set_duration_template",
"if",
"self",
".",
"get_allocated_time_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"errors",... | 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 implemented.* | [
"Sets",
"the",
"allocated",
"time",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L446-L466 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | AssessmentPartForm.clear_allocated_time | 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 | 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... | [
"def",
"clear_allocated_time",
"(",
"self",
")",
":",
"# Implemented from template for osid.assessment.AssessmentOfferedForm.clear_duration_template",
"if",
"(",
"self",
".",
"get_allocated_time_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_all... | Clears the allocated time.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Clears",
"the",
"allocated",
"time",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L468-L480 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRule.get_assessment_part_id | 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 | 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... | [
"def",
"get_assessment_part_id",
"(",
"self",
")",
":",
"# Implemented from template for osid.learning.Activity.get_objective_id",
"if",
"not",
"bool",
"(",
"self",
".",
"_my_map",
"[",
"'assessmentPartId'",
"]",
")",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
... | 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.* | [
"Gets",
"the",
"assessment",
"part",
"Id",
"to",
"which",
"this",
"rule",
"belongs",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L647-L657 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRule.get_assessment_part | 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 | 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.*... | [
"def",
"get_assessment_part",
"(",
"self",
")",
":",
"# Implemented from template for osid.learning.Activity.get_objective",
"if",
"not",
"bool",
"(",
"self",
".",
"_my_map",
"[",
"'assessmentPartId'",
"]",
")",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'asse... | 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.* | [
"Gets",
"the",
"assessment",
"part",
"to",
"which",
"this",
"rule",
"belongs",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L661-L678 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRuleForm._init_metadata | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
self._cumulative_default = self._mdata['cumulative']['default_boolean_values'][0]
self._minimum_score_default = self._mdata['minimum_score']['default_cardinal_val... | python | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
self._cumulative_default = self._mdata['cumulative']['default_boolean_values'][0]
self._minimum_score_default = self._mdata['minimum_score']['default_cardinal_val... | [
"def",
"_init_metadata",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"osid_objects",
".",
"OsidObjectForm",
".",
"_init_metadata",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_cumulative_default",
"=",
"self",
".",
"_mdata",
"[",
"'cumulat... | Initialize form metadata | [
"Initialize",
"form",
"metadata"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L814-L819 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRuleForm._init_map | def _init_map(self, record_types=None, **kwargs):
"""Initialize form map"""
osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
self._my_map['nextAssessmentPartId'] = str(kwargs['next_assessment_part_id'])
self._my_map['cumulative'] = self._cumulative_default
s... | python | def _init_map(self, record_types=None, **kwargs):
"""Initialize form map"""
osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
self._my_map['nextAssessmentPartId'] = str(kwargs['next_assessment_part_id'])
self._my_map['cumulative'] = self._cumulative_default
s... | [
"def",
"_init_map",
"(",
"self",
",",
"record_types",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"osid_objects",
".",
"OsidObjectForm",
".",
"_init_map",
"(",
"self",
",",
"record_types",
"=",
"record_types",
")",
"self",
".",
"_my_map",
"[",
"'nextAs... | Initialize form map | [
"Initialize",
"form",
"map"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L821-L830 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRuleForm.get_minimum_score_metadata | def get_minimum_score_metadata(self):
"""Gets the metadata for the minimum score.
return: (osid.Metadata) - metadata for the minimum score
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metada... | python | def get_minimum_score_metadata(self):
"""Gets the metadata for the minimum score.
return: (osid.Metadata) - metadata for the minimum score
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metada... | [
"def",
"get_minimum_score_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'minimum_score'",
"]",
")",
"metadata",
".",
"update",
"(",
"{"... | Gets the metadata for the minimum score.
return: (osid.Metadata) - metadata for the minimum score
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"minimum",
"score",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L832-L842 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRuleForm.get_maximum_score_metadata | def get_maximum_score_metadata(self):
"""Gets the metadata for the maximum score.
return: (osid.Metadata) - metadata for the maximum score
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metada... | python | def get_maximum_score_metadata(self):
"""Gets the metadata for the maximum score.
return: (osid.Metadata) - metadata for the maximum score
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metada... | [
"def",
"get_maximum_score_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'maximum_score'",
"]",
")",
"metadata",
".",
"update",
"(",
"{"... | Gets the metadata for the maximum score.
return: (osid.Metadata) - metadata for the maximum score
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"maximum",
"score",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L860-L870 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRuleForm.get_cumulative_metadata | def get_cumulative_metadata(self):
"""Gets the metadata for the cumulative flag.
return: (osid.Metadata) - metadata for the cumulative flag
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metad... | python | def get_cumulative_metadata(self):
"""Gets the metadata for the cumulative flag.
return: (osid.Metadata) - metadata for the cumulative flag
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceForm.get_group_metad... | [
"def",
"get_cumulative_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'cumulative'",
"]",
")",
"metadata",
".",
"update",
"(",
"{",
"'... | Gets the metadata for the cumulative flag.
return: (osid.Metadata) - metadata for the cumulative flag
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"cumulative",
"flag",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L888-L898 |
mitsei/dlkit | dlkit/json_/assessment_authoring/objects.py | SequenceRuleForm.set_cumulative | def set_cumulative(self, cumulative):
"""Applies this rule to all previous assessment parts.
arg: cumulative (boolean): ``true`` to apply to all previous
assessment parts. ``false`` to apply to the immediate
previous assessment part
raise: InvalidArgument - `... | python | def set_cumulative(self, cumulative):
"""Applies this rule to all previous assessment parts.
arg: cumulative (boolean): ``true`` to apply to all previous
assessment parts. ``false`` to apply to the immediate
previous assessment part
raise: InvalidArgument - `... | [
"def",
"set_cumulative",
"(",
"self",
",",
"cumulative",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.set_group_template",
"if",
"self",
".",
"get_cumulative_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"errors",
".",
"NoAcc... | Applies this rule to all previous assessment parts.
arg: cumulative (boolean): ``true`` to apply to all previous
assessment parts. ``false`` to apply to the immediate
previous assessment part
raise: InvalidArgument - ``cumulative`` is invalid
raise: NoAccess... | [
"Applies",
"this",
"rule",
"to",
"all",
"previous",
"assessment",
"parts",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/objects.py#L903-L919 |
raamana/hiwenet | docs/example_thickness_hiwenet.py | get_parcellation | def get_parcellation(atlas, parcel_param):
"Placeholder to insert your own function to return parcellation in reference space."
parc_path = os.path.join(atlas, 'parcellation_param{}.mgh'.format(parcel_param))
parcel = nibabel.freesurfer.io.read_geometry(parc_path)
return parcel | python | def get_parcellation(atlas, parcel_param):
"Placeholder to insert your own function to return parcellation in reference space."
parc_path = os.path.join(atlas, 'parcellation_param{}.mgh'.format(parcel_param))
parcel = nibabel.freesurfer.io.read_geometry(parc_path)
return parcel | [
"def",
"get_parcellation",
"(",
"atlas",
",",
"parcel_param",
")",
":",
"parc_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"atlas",
",",
"'parcellation_param{}.mgh'",
".",
"format",
"(",
"parcel_param",
")",
")",
"parcel",
"=",
"nibabel",
".",
"freesurfe... | Placeholder to insert your own function to return parcellation in reference space. | [
"Placeholder",
"to",
"insert",
"your",
"own",
"function",
"to",
"return",
"parcellation",
"in",
"reference",
"space",
"."
] | train | https://github.com/raamana/hiwenet/blob/b12699b3722fd0a6a835e7d7ca4baf58fb181809/docs/example_thickness_hiwenet.py#L25-L31 |
raamana/hiwenet | docs/example_thickness_hiwenet.py | get_features | def get_features(subject_id):
"Placeholder to insert your own function to read subject-wise features."
features_path = os.path.join(my_project,'base_features', subject_id, 'features.txt')
feature_vector = np.loadtxt(features_path)
return feature_vector | python | def get_features(subject_id):
"Placeholder to insert your own function to read subject-wise features."
features_path = os.path.join(my_project,'base_features', subject_id, 'features.txt')
feature_vector = np.loadtxt(features_path)
return feature_vector | [
"def",
"get_features",
"(",
"subject_id",
")",
":",
"features_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"my_project",
",",
"'base_features'",
",",
"subject_id",
",",
"'features.txt'",
")",
"feature_vector",
"=",
"np",
".",
"loadtxt",
"(",
"features_path... | Placeholder to insert your own function to read subject-wise features. | [
"Placeholder",
"to",
"insert",
"your",
"own",
"function",
"to",
"read",
"subject",
"-",
"wise",
"features",
"."
] | train | https://github.com/raamana/hiwenet/blob/b12699b3722fd0a6a835e7d7ca4baf58fb181809/docs/example_thickness_hiwenet.py#L52-L58 |
mitsei/dlkit | dlkit/handcar/type/sessions.py | TypeLookupSession.get_type | def get_type(self, namespace=None, identifier=None, authority=None):
"""Gets a Type by its string representation which is a combination
of the authority and identifier.
This method only returns the Type if it is known by the given
identification components.
arg: namespace (s... | python | def get_type(self, namespace=None, identifier=None, authority=None):
"""Gets a Type by its string representation which is a combination
of the authority and identifier.
This method only returns the Type if it is known by the given
identification components.
arg: namespace (s... | [
"def",
"get_type",
"(",
"self",
",",
"namespace",
"=",
"None",
",",
"identifier",
"=",
"None",
",",
"authority",
"=",
"None",
")",
":",
"from",
".",
"import",
"types",
"from",
".",
".",
"osid",
".",
"osid_errors",
"import",
"NotFound",
",",
"NullArgument... | Gets a Type by its string representation which is a combination
of the authority and identifier.
This method only returns the Type if it is known by the given
identification components.
arg: namespace (string): the identifier namespace
arg: identifier (string): the identi... | [
"Gets",
"a",
"Type",
"by",
"its",
"string",
"representation",
"which",
"is",
"a",
"combination",
"of",
"the",
"authority",
"and",
"identifier",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/type/sessions.py#L51-L84 |
mitsei/dlkit | dlkit/handcar/type/sessions.py | TypeLookupSession.has_type | def has_type(self, type_=None):
"""Tests if the given Type is known.
arg: type (osid.type.Type): the Type to look for
return: (boolean) - true if the given Type is known, false
otherwise
raise: NullArgument - type is null
raise: OperationFailed - unable to c... | python | def has_type(self, type_=None):
"""Tests if the given Type is known.
arg: type (osid.type.Type): the Type to look for
return: (boolean) - true if the given Type is known, false
otherwise
raise: NullArgument - type is null
raise: OperationFailed - unable to c... | [
"def",
"has_type",
"(",
"self",
",",
"type_",
"=",
"None",
")",
":",
"# This seems silly :)",
"return",
"bool",
"(",
"self",
".",
"get_type",
"(",
"namespace",
"=",
"type_",
".",
"get_namespace",
"(",
")",
",",
"identifier",
"=",
"type_",
".",
"get_identif... | Tests if the given Type is known.
arg: type (osid.type.Type): the Type to look for
return: (boolean) - true if the given Type is known, false
otherwise
raise: NullArgument - type is null
raise: OperationFailed - unable to complete request
raise: PermissionD... | [
"Tests",
"if",
"the",
"given",
"Type",
"is",
"known",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/type/sessions.py#L86-L101 |
mitsei/dlkit | dlkit/handcar/type/sessions.py | TypeLookupSession.get_types | def get_types(self):
"""Gets all the known Types.
return: (osid.type.TypeList) - the list of all known Types
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
compliance: mandatory - This method must be implemented.
""... | python | def get_types(self):
"""Gets all the known Types.
return: (osid.type.TypeList) - the list of all known Types
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
compliance: mandatory - This method must be implemented.
""... | [
"def",
"get_types",
"(",
"self",
")",
":",
"from",
".",
"import",
"types",
"url_path",
"=",
"'/handcar/services/learning/types/'",
"type_list",
"=",
"self",
".",
"_get_request",
"(",
"url_path",
")",
"type_list",
"+=",
"types",
".",
"TYPES",
"return",
"objects",... | Gets all the known Types.
return: (osid.type.TypeList) - the list of all known Types
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
compliance: mandatory - This method must be implemented. | [
"Gets",
"all",
"the",
"known",
"Types",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/type/sessions.py#L146-L159 |
mitsei/dlkit | dlkit/json_/resource/simple_agent.py | OsidObject.get_display_name | def get_display_name(self):
"""Creates a display name"""
return DisplayText(text=self.id_.get_identifier(),
language_type=DEFAULT_LANGUAGE_TYPE,
script_type=DEFAULT_SCRIPT_TYPE,
format_type=DEFAULT_FORMAT_TYPE,) | python | def get_display_name(self):
"""Creates a display name"""
return DisplayText(text=self.id_.get_identifier(),
language_type=DEFAULT_LANGUAGE_TYPE,
script_type=DEFAULT_SCRIPT_TYPE,
format_type=DEFAULT_FORMAT_TYPE,) | [
"def",
"get_display_name",
"(",
"self",
")",
":",
"return",
"DisplayText",
"(",
"text",
"=",
"self",
".",
"id_",
".",
"get_identifier",
"(",
")",
",",
"language_type",
"=",
"DEFAULT_LANGUAGE_TYPE",
",",
"script_type",
"=",
"DEFAULT_SCRIPT_TYPE",
",",
"format_typ... | Creates a display name | [
"Creates",
"a",
"display",
"name"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/simple_agent.py#L61-L66 |
mitsei/dlkit | dlkit/json_/resource/simple_agent.py | OsidObject.get_description | def get_description(self):
"""Creates a description"""
return DisplayText(text='Agent representing ' + str(self.id_),
language_type=DEFAULT_LANGUAGE_TYPE,
script_type=DEFAULT_SCRIPT_TYPE,
format_type=DEFAULT_FORMAT_TYPE,) | python | def get_description(self):
"""Creates a description"""
return DisplayText(text='Agent representing ' + str(self.id_),
language_type=DEFAULT_LANGUAGE_TYPE,
script_type=DEFAULT_SCRIPT_TYPE,
format_type=DEFAULT_FORMAT_TYPE,) | [
"def",
"get_description",
"(",
"self",
")",
":",
"return",
"DisplayText",
"(",
"text",
"=",
"'Agent representing '",
"+",
"str",
"(",
"self",
".",
"id_",
")",
",",
"language_type",
"=",
"DEFAULT_LANGUAGE_TYPE",
",",
"script_type",
"=",
"DEFAULT_SCRIPT_TYPE",
","... | Creates a description | [
"Creates",
"a",
"description"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/simple_agent.py#L68-L73 |
ilgarm/pyzimbra | pyzimbra/util.py | empty | def empty(val):
"""
Checks if value is empty.
All unknown data types considered as empty values.
@return: bool
"""
if val == None:
return True
if isinstance(val,str) and len(val) > 0:
return False
return True | python | def empty(val):
"""
Checks if value is empty.
All unknown data types considered as empty values.
@return: bool
"""
if val == None:
return True
if isinstance(val,str) and len(val) > 0:
return False
return True | [
"def",
"empty",
"(",
"val",
")",
":",
"if",
"val",
"==",
"None",
":",
"return",
"True",
"if",
"isinstance",
"(",
"val",
",",
"str",
")",
"and",
"len",
"(",
"val",
")",
">",
"0",
":",
"return",
"False",
"return",
"True"
] | Checks if value is empty.
All unknown data types considered as empty values.
@return: bool | [
"Checks",
"if",
"value",
"is",
"empty",
".",
"All",
"unknown",
"data",
"types",
"considered",
"as",
"empty",
"values",
"."
] | train | https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/util.py#L30-L42 |
pyroscope/auvyon | pavement.py | docs | def docs():
""" Create documentation.
"""
from epydoc import cli
path('build').exists() or path('build').makedirs()
# get storage path
docs_dir = options.docs.get('docs_dir', 'docs/apidocs')
# clean up previous docs
(path(docs_dir) / "epydoc.css").exists() and path(docs_dir).rmtree()
... | python | def docs():
""" Create documentation.
"""
from epydoc import cli
path('build').exists() or path('build').makedirs()
# get storage path
docs_dir = options.docs.get('docs_dir', 'docs/apidocs')
# clean up previous docs
(path(docs_dir) / "epydoc.css").exists() and path(docs_dir).rmtree()
... | [
"def",
"docs",
"(",
")",
":",
"from",
"epydoc",
"import",
"cli",
"path",
"(",
"'build'",
")",
".",
"exists",
"(",
")",
"or",
"path",
"(",
"'build'",
")",
".",
"makedirs",
"(",
")",
"# get storage path",
"docs_dir",
"=",
"options",
".",
"docs",
".",
"... | Create documentation. | [
"Create",
"documentation",
"."
] | train | https://github.com/pyroscope/auvyon/blob/5115c26f966df03df92a9934580b66c72e23d4e8/pavement.py#L131-L172 |
pyroscope/auvyon | pavement.py | release | def release():
""" Check release before upload to PyPI.
"""
sh("paver bdist_egg")
# Check that source distribution can be built and is complete
print
print "~" * 78
print "TESTING SOURCE BUILD"
sh(
"{ cd dist/ && unzip -q %s-%s.zip && cd %s-%s/"
" && /usr/bin/python set... | python | def release():
""" Check release before upload to PyPI.
"""
sh("paver bdist_egg")
# Check that source distribution can be built and is complete
print
print "~" * 78
print "TESTING SOURCE BUILD"
sh(
"{ cd dist/ && unzip -q %s-%s.zip && cd %s-%s/"
" && /usr/bin/python set... | [
"def",
"release",
"(",
")",
":",
"sh",
"(",
"\"paver bdist_egg\"",
")",
"# Check that source distribution can be built and is complete",
"print",
"print",
"\"~\"",
"*",
"78",
"print",
"\"TESTING SOURCE BUILD\"",
"sh",
"(",
"\"{ cd dist/ && unzip -q %s-%s.zip && cd %s-%s/\"",
... | Check release before upload to PyPI. | [
"Check",
"release",
"before",
"upload",
"to",
"PyPI",
"."
] | train | https://github.com/pyroscope/auvyon/blob/5115c26f966df03df92a9934580b66c72e23d4e8/pavement.py#L236-L260 |
pyroscope/auvyon | pavement.py | lint | def lint():
""" Report pylint results.
"""
from pylint import lint as linter
# report according to file extension
reporters = {
".html": linter.HTMLReporter,
".log": linter.ParseableTextReporter,
".txt": linter.TextReporter,
}
lint_build_dir = path("build/lint")
... | python | def lint():
""" Report pylint results.
"""
from pylint import lint as linter
# report according to file extension
reporters = {
".html": linter.HTMLReporter,
".log": linter.ParseableTextReporter,
".txt": linter.TextReporter,
}
lint_build_dir = path("build/lint")
... | [
"def",
"lint",
"(",
")",
":",
"from",
"pylint",
"import",
"lint",
"as",
"linter",
"# report according to file extension",
"reporters",
"=",
"{",
"\".html\"",
":",
"linter",
".",
"HTMLReporter",
",",
"\".log\"",
":",
"linter",
".",
"ParseableTextReporter",
",",
"... | Report pylint results. | [
"Report",
"pylint",
"results",
"."
] | train | https://github.com/pyroscope/auvyon/blob/5115c26f966df03df92a9934580b66c72e23d4e8/pavement.py#L272-L333 |
cloudnull/cloudlib | cloudlib/indicator.py | Spinner.indicator | def indicator(self):
"""Produce the spinner."""
while self.run:
try:
size = self.work_q.qsize()
except Exception:
note = 'Please wait '
else:
note = 'Number of Jobs in Queue = %s ' % size
if self.msg:
... | python | def indicator(self):
"""Produce the spinner."""
while self.run:
try:
size = self.work_q.qsize()
except Exception:
note = 'Please wait '
else:
note = 'Number of Jobs in Queue = %s ' % size
if self.msg:
... | [
"def",
"indicator",
"(",
"self",
")",
":",
"while",
"self",
".",
"run",
":",
"try",
":",
"size",
"=",
"self",
".",
"work_q",
".",
"qsize",
"(",
")",
"except",
"Exception",
":",
"note",
"=",
"'Please wait '",
"else",
":",
"note",
"=",
"'Number of Jobs i... | Produce the spinner. | [
"Produce",
"the",
"spinner",
"."
] | train | https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/indicator.py#L66-L84 |
cloudnull/cloudlib | cloudlib/indicator.py | Spinner.start | def start(self):
"""Indicate that we are performing work in a thread.
:returns: multiprocessing job object
"""
if self.run is True:
self.job = multiprocessing.Process(target=self.indicator)
self.job.start()
return self.job | python | def start(self):
"""Indicate that we are performing work in a thread.
:returns: multiprocessing job object
"""
if self.run is True:
self.job = multiprocessing.Process(target=self.indicator)
self.job.start()
return self.job | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"run",
"is",
"True",
":",
"self",
".",
"job",
"=",
"multiprocessing",
".",
"Process",
"(",
"target",
"=",
"self",
".",
"indicator",
")",
"self",
".",
"job",
".",
"start",
"(",
")",
"return",... | Indicate that we are performing work in a thread.
:returns: multiprocessing job object | [
"Indicate",
"that",
"we",
"are",
"performing",
"work",
"in",
"a",
"thread",
"."
] | train | https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/indicator.py#L86-L95 |
cloudnull/cloudlib | cloudlib/indicator.py | Spinner.stop | def stop(self):
"""Stop the indicator process."""
if self.run is True and all([self.job, self.job.is_alive()]):
print('Done.')
self.job.terminate() | python | def stop(self):
"""Stop the indicator process."""
if self.run is True and all([self.job, self.job.is_alive()]):
print('Done.')
self.job.terminate() | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"run",
"is",
"True",
"and",
"all",
"(",
"[",
"self",
".",
"job",
",",
"self",
".",
"job",
".",
"is_alive",
"(",
")",
"]",
")",
":",
"print",
"(",
"'Done.'",
")",
"self",
".",
"job",
"."... | Stop the indicator process. | [
"Stop",
"the",
"indicator",
"process",
"."
] | train | https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/indicator.py#L97-L102 |
mdiener/grace | grace/py27/cssmin.py | remove_comments | def remove_comments(css):
"""Remove all CSS comment blocks."""
iemac = False
preserve = False
comment_start = css.find("/*")
while comment_start >= 0:
# Preserve comments that look like `/*!...*/`.
# Slicing is used to make sure we don"t get an IndexError.
preserve = css[com... | python | def remove_comments(css):
"""Remove all CSS comment blocks."""
iemac = False
preserve = False
comment_start = css.find("/*")
while comment_start >= 0:
# Preserve comments that look like `/*!...*/`.
# Slicing is used to make sure we don"t get an IndexError.
preserve = css[com... | [
"def",
"remove_comments",
"(",
"css",
")",
":",
"iemac",
"=",
"False",
"preserve",
"=",
"False",
"comment_start",
"=",
"css",
".",
"find",
"(",
"\"/*\"",
")",
"while",
"comment_start",
">=",
"0",
":",
"# Preserve comments that look like `/*!...*/`.",
"# Slicing is... | Remove all CSS comment blocks. | [
"Remove",
"all",
"CSS",
"comment",
"blocks",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/cssmin.py#L19-L50 |
mdiener/grace | grace/py27/cssmin.py | remove_unnecessary_whitespace | def remove_unnecessary_whitespace(css):
"""Remove unnecessary whitespace characters."""
def pseudoclasscolon(css):
"""
Prevents 'p :link' from becoming 'p:link'.
Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is
translated back again later.
"""
... | python | def remove_unnecessary_whitespace(css):
"""Remove unnecessary whitespace characters."""
def pseudoclasscolon(css):
"""
Prevents 'p :link' from becoming 'p:link'.
Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is
translated back again later.
"""
... | [
"def",
"remove_unnecessary_whitespace",
"(",
"css",
")",
":",
"def",
"pseudoclasscolon",
"(",
"css",
")",
":",
"\"\"\"\n Prevents 'p :link' from becoming 'p:link'.\n\n Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is\n translated back again later.\n ... | Remove unnecessary whitespace characters. | [
"Remove",
"unnecessary",
"whitespace",
"characters",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/cssmin.py#L53-L93 |
mdiener/grace | grace/py27/cssmin.py | normalize_rgb_colors_to_hex | def normalize_rgb_colors_to_hex(css):
"""Convert `rgb(51,102,153)` to `#336699`."""
regex = re.compile(r"rgb\s*\(\s*([0-9,\s]+)\s*\)")
match = regex.search(css)
while match:
colors = [s.strip() for s in match.group(1).split(",")]
hexcolor = '#%.2x%.2x%.2x' % tuple(map(int, colors))
... | python | def normalize_rgb_colors_to_hex(css):
"""Convert `rgb(51,102,153)` to `#336699`."""
regex = re.compile(r"rgb\s*\(\s*([0-9,\s]+)\s*\)")
match = regex.search(css)
while match:
colors = [s.strip() for s in match.group(1).split(",")]
hexcolor = '#%.2x%.2x%.2x' % tuple(map(int, colors))
... | [
"def",
"normalize_rgb_colors_to_hex",
"(",
"css",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"rgb\\s*\\(\\s*([0-9,\\s]+)\\s*\\)\"",
")",
"match",
"=",
"regex",
".",
"search",
"(",
"css",
")",
"while",
"match",
":",
"colors",
"=",
"[",
"s",
".",
... | Convert `rgb(51,102,153)` to `#336699`. | [
"Convert",
"rgb",
"(",
"51",
"102",
"153",
")",
"to",
"#336699",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/cssmin.py#L108-L118 |
mdiener/grace | grace/py27/cssmin.py | condense_multidimensional_zeros | def condense_multidimensional_zeros(css):
"""Replace `:0 0 0 0;`, `:0 0 0;` etc. with `:0;`."""
css = css.replace(":0 0 0 0;", ":0;")
css = css.replace(":0 0 0;", ":0;")
css = css.replace(":0 0;", ":0;")
# Revert `background-position:0;` to the valid `background-position:0 0;`.
css = css.repla... | python | def condense_multidimensional_zeros(css):
"""Replace `:0 0 0 0;`, `:0 0 0;` etc. with `:0;`."""
css = css.replace(":0 0 0 0;", ":0;")
css = css.replace(":0 0 0;", ":0;")
css = css.replace(":0 0;", ":0;")
# Revert `background-position:0;` to the valid `background-position:0 0;`.
css = css.repla... | [
"def",
"condense_multidimensional_zeros",
"(",
"css",
")",
":",
"css",
"=",
"css",
".",
"replace",
"(",
"\":0 0 0 0;\"",
",",
"\":0;\"",
")",
"css",
"=",
"css",
".",
"replace",
"(",
"\":0 0 0;\"",
",",
"\":0;\"",
")",
"css",
"=",
"css",
".",
"replace",
"... | Replace `:0 0 0 0;`, `:0 0 0;` etc. with `:0;`. | [
"Replace",
":",
"0",
"0",
"0",
"0",
";",
":",
"0",
"0",
"0",
";",
"etc",
".",
"with",
":",
"0",
";",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/cssmin.py#L127-L137 |
mdiener/grace | grace/py27/cssmin.py | condense_hex_colors | def condense_hex_colors(css):
"""Shorten colors from #AABBCC to #ABC where possible."""
regex = re.compile(r"([^\"'=\s])(\s*)#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])")
match = regex.search(css)
while match:
first = match.group(3) + match.group(5) + match.g... | python | def condense_hex_colors(css):
"""Shorten colors from #AABBCC to #ABC where possible."""
regex = re.compile(r"([^\"'=\s])(\s*)#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])")
match = regex.search(css)
while match:
first = match.group(3) + match.group(5) + match.g... | [
"def",
"condense_hex_colors",
"(",
"css",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"([^\\\"'=\\s])(\\s*)#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\"",
")",
"match",
"=",
"regex",
".",
"search",
"(",
"css",
")",
"while",
... | Shorten colors from #AABBCC to #ABC where possible. | [
"Shorten",
"colors",
"from",
"#AABBCC",
"to",
"#ABC",
"where",
"possible",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/cssmin.py#L146-L159 |
mdiener/grace | grace/py27/cssmin.py | wrap_css_lines | def wrap_css_lines(css, line_length):
"""Wrap the lines of the given CSS to an approximate length."""
lines = []
line_start = 0
for i, char in enumerate(css):
# It's safe to break after `}` characters.
if char == '}' and (i - line_start >= line_length):
lines.append(css[line... | python | def wrap_css_lines(css, line_length):
"""Wrap the lines of the given CSS to an approximate length."""
lines = []
line_start = 0
for i, char in enumerate(css):
# It's safe to break after `}` characters.
if char == '}' and (i - line_start >= line_length):
lines.append(css[line... | [
"def",
"wrap_css_lines",
"(",
"css",
",",
"line_length",
")",
":",
"lines",
"=",
"[",
"]",
"line_start",
"=",
"0",
"for",
"i",
",",
"char",
"in",
"enumerate",
"(",
"css",
")",
":",
"# It's safe to break after `}` characters.",
"if",
"char",
"==",
"'}'",
"a... | Wrap the lines of the given CSS to an approximate length. | [
"Wrap",
"the",
"lines",
"of",
"the",
"given",
"CSS",
"to",
"an",
"approximate",
"length",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/cssmin.py#L174-L187 |
mitsei/dlkit | dlkit/json_/logging_/default_mdata.py | get_log_entry_mdata | def get_log_entry_mdata():
"""Return default mdata map for LogEntry"""
return {
'priority': {
'element_label': {
'text': 'priority',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'format... | python | def get_log_entry_mdata():
"""Return default mdata map for LogEntry"""
return {
'priority': {
'element_label': {
'text': 'priority',
'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
'format... | [
"def",
"get_log_entry_mdata",
"(",
")",
":",
"return",
"{",
"'priority'",
":",
"{",
"'element_label'",
":",
"{",
"'text'",
":",
"'priority'",
",",
"'languageTypeId'",
":",
"str",
"(",
"DEFAULT_LANGUAGE_TYPE",
")",
",",
"'scriptTypeId'",
":",
"str",
"(",
"DEFAU... | Return default mdata map for LogEntry | [
"Return",
"default",
"mdata",
"map",
"for",
"LogEntry"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/default_mdata.py#L23-L89 |
juju/juju-bundlelib | jujubundlelib/cli.py | get_changeset | def get_changeset(args):
"""Dump the changeset objects as JSON, reading the provided bundle YAML.
The YAML can be provided either from stdin or by passing a file path as
first argument.
"""
# Parse the arguments.
parser = argparse.ArgumentParser(description=get_changeset.__doc__)
parser.add... | python | def get_changeset(args):
"""Dump the changeset objects as JSON, reading the provided bundle YAML.
The YAML can be provided either from stdin or by passing a file path as
first argument.
"""
# Parse the arguments.
parser = argparse.ArgumentParser(description=get_changeset.__doc__)
parser.add... | [
"def",
"get_changeset",
"(",
"args",
")",
":",
"# Parse the arguments.",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"get_changeset",
".",
"__doc__",
")",
"parser",
".",
"add_argument",
"(",
"'infile'",
",",
"nargs",
"=",
"'?'",
... | Dump the changeset objects as JSON, reading the provided bundle YAML.
The YAML can be provided either from stdin or by passing a file path as
first argument. | [
"Dump",
"the",
"changeset",
"objects",
"as",
"JSON",
"reading",
"the",
"provided",
"bundle",
"YAML",
"."
] | train | https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/cli.py#L26-L58 |
Vagrants/blackbird | blackbird/plugins/statistics.py | ConcreteJob.build_items | def build_items(self):
"""
get the items from STATS QUEUE
calculate self.stats
make new items from self.stats
put the new items for ITEM QUEUE
"""
while not self.stats_queue.empty():
item = self.stats_queue.get()
self.calculate(item)
... | python | def build_items(self):
"""
get the items from STATS QUEUE
calculate self.stats
make new items from self.stats
put the new items for ITEM QUEUE
"""
while not self.stats_queue.empty():
item = self.stats_queue.get()
self.calculate(item)
... | [
"def",
"build_items",
"(",
"self",
")",
":",
"while",
"not",
"self",
".",
"stats_queue",
".",
"empty",
"(",
")",
":",
"item",
"=",
"self",
".",
"stats_queue",
".",
"get",
"(",
")",
"self",
".",
"calculate",
"(",
"item",
")",
"for",
"key",
",",
"val... | get the items from STATS QUEUE
calculate self.stats
make new items from self.stats
put the new items for ITEM QUEUE | [
"get",
"the",
"items",
"from",
"STATS",
"QUEUE",
"calculate",
"self",
".",
"stats",
"make",
"new",
"items",
"from",
"self",
".",
"stats",
"put",
"the",
"new",
"items",
"for",
"ITEM",
"QUEUE"
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/plugins/statistics.py#L27-L49 |
askovpen/discord_simple | pylint-recursive.py | check | def check(module):
global passed, failed
'''
apply pylint to the file specified if it is a *.py file
'''
module_name = module.rsplit('/', 1)[1]
if module[-3:] == ".py" and module_name not in IGNORED_FILES:
print ("CHECKING ", module)
pout = os.popen('pylint %s'% module, 'r')
for line in pout:
... | python | def check(module):
global passed, failed
'''
apply pylint to the file specified if it is a *.py file
'''
module_name = module.rsplit('/', 1)[1]
if module[-3:] == ".py" and module_name not in IGNORED_FILES:
print ("CHECKING ", module)
pout = os.popen('pylint %s'% module, 'r')
for line in pout:
... | [
"def",
"check",
"(",
"module",
")",
":",
"global",
"passed",
",",
"failed",
"module_name",
"=",
"module",
".",
"rsplit",
"(",
"'/'",
",",
"1",
")",
"[",
"1",
"]",
"if",
"module",
"[",
"-",
"3",
":",
"]",
"==",
"\".py\"",
"and",
"module_name",
"not"... | apply pylint to the file specified if it is a *.py file | [
"apply",
"pylint",
"to",
"the",
"file",
"specified",
"if",
"it",
"is",
"a",
"*",
".",
"py",
"file"
] | train | https://github.com/askovpen/discord_simple/blob/6dff3a94b63bb3657fae8b16e3d03f944afee71b/pylint-recursive.py#L17-L36 |
planetlabs/es_fluent | es_fluent/builder.py | QueryBuilder.and_filter | def and_filter(self, filter_or_string, *args, **kwargs):
"""
Convenience method to delegate to the root_filter to generate an
:class:`~es_fluent.filters.core.And` clause.
:return: :class:`~es_fluent.builder.QueryBuilder`
"""
self.root_filter.and_filter(filter_or_string, ... | python | def and_filter(self, filter_or_string, *args, **kwargs):
"""
Convenience method to delegate to the root_filter to generate an
:class:`~es_fluent.filters.core.And` clause.
:return: :class:`~es_fluent.builder.QueryBuilder`
"""
self.root_filter.and_filter(filter_or_string, ... | [
"def",
"and_filter",
"(",
"self",
",",
"filter_or_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"root_filter",
".",
"and_filter",
"(",
"filter_or_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | Convenience method to delegate to the root_filter to generate an
:class:`~es_fluent.filters.core.And` clause.
:return: :class:`~es_fluent.builder.QueryBuilder` | [
"Convenience",
"method",
"to",
"delegate",
"to",
"the",
"root_filter",
"to",
"generate",
"an",
":",
"class",
":",
"~es_fluent",
".",
"filters",
".",
"core",
".",
"And",
"clause",
"."
] | train | https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/builder.py#L37-L45 |
planetlabs/es_fluent | es_fluent/builder.py | QueryBuilder.or_filter | def or_filter(self, filter_or_string, *args, **kwargs):
"""
Convenience method to delegate to the root_filter to generate an `or`
clause.
:return: :class:`~es_fluent.builder.QueryBuilder`
"""
self.root_filter.or_filter(filter_or_string, *args, **kwargs)
return se... | python | def or_filter(self, filter_or_string, *args, **kwargs):
"""
Convenience method to delegate to the root_filter to generate an `or`
clause.
:return: :class:`~es_fluent.builder.QueryBuilder`
"""
self.root_filter.or_filter(filter_or_string, *args, **kwargs)
return se... | [
"def",
"or_filter",
"(",
"self",
",",
"filter_or_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"root_filter",
".",
"or_filter",
"(",
"filter_or_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | Convenience method to delegate to the root_filter to generate an `or`
clause.
:return: :class:`~es_fluent.builder.QueryBuilder` | [
"Convenience",
"method",
"to",
"delegate",
"to",
"the",
"root_filter",
"to",
"generate",
"an",
"or",
"clause",
"."
] | train | https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/builder.py#L47-L55 |
planetlabs/es_fluent | es_fluent/builder.py | QueryBuilder.add_filter | def add_filter(self, filter_or_string, *args, **kwargs):
"""
Adds a filter to the query builder's filters.
:return: :class:`~es_fluent.builder.QueryBuilder`
"""
self.root_filter.add_filter(filter_or_string, *args, **kwargs)
return self | python | def add_filter(self, filter_or_string, *args, **kwargs):
"""
Adds a filter to the query builder's filters.
:return: :class:`~es_fluent.builder.QueryBuilder`
"""
self.root_filter.add_filter(filter_or_string, *args, **kwargs)
return self | [
"def",
"add_filter",
"(",
"self",
",",
"filter_or_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"root_filter",
".",
"add_filter",
"(",
"filter_or_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | Adds a filter to the query builder's filters.
:return: :class:`~es_fluent.builder.QueryBuilder` | [
"Adds",
"a",
"filter",
"to",
"the",
"query",
"builder",
"s",
"filters",
"."
] | train | https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/builder.py#L57-L64 |
planetlabs/es_fluent | es_fluent/builder.py | QueryBuilder.sort | def sort(self, field, direction="asc"):
"""
Adds sort criteria.
"""
if not isinstance(field, basestring):
raise ValueError("Field should be a string")
if direction not in ["asc", "desc"]:
raise ValueError("Sort direction should be `asc` or `desc`")
... | python | def sort(self, field, direction="asc"):
"""
Adds sort criteria.
"""
if not isinstance(field, basestring):
raise ValueError("Field should be a string")
if direction not in ["asc", "desc"]:
raise ValueError("Sort direction should be `asc` or `desc`")
... | [
"def",
"sort",
"(",
"self",
",",
"field",
",",
"direction",
"=",
"\"asc\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"field",
",",
"basestring",
")",
":",
"raise",
"ValueError",
"(",
"\"Field should be a string\"",
")",
"if",
"direction",
"not",
"in",
"["... | Adds sort criteria. | [
"Adds",
"sort",
"criteria",
"."
] | train | https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/builder.py#L144-L153 |
planetlabs/es_fluent | es_fluent/builder.py | QueryBuilder.remove_sort | def remove_sort(self, field_name):
"""
Clears sorting criteria affecting ``field_name``.
"""
self.sorts = [dict(field=value) for field, value in self.sorts if field
is not field_name] | python | def remove_sort(self, field_name):
"""
Clears sorting criteria affecting ``field_name``.
"""
self.sorts = [dict(field=value) for field, value in self.sorts if field
is not field_name] | [
"def",
"remove_sort",
"(",
"self",
",",
"field_name",
")",
":",
"self",
".",
"sorts",
"=",
"[",
"dict",
"(",
"field",
"=",
"value",
")",
"for",
"field",
",",
"value",
"in",
"self",
".",
"sorts",
"if",
"field",
"is",
"not",
"field_name",
"]"
] | Clears sorting criteria affecting ``field_name``. | [
"Clears",
"sorting",
"criteria",
"affecting",
"field_name",
"."
] | train | https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/builder.py#L155-L160 |
ivbeg/qddate | qddate/dirty.py | matchPrefix | def matchPrefix(text):
"""
This is silver bullet, cornerstone and magic wand of speed of this algorithm
it filters patterns using manually selected rules. Yes, yes, it's "dirty" code and it could be beautified in
many ways but this library intended to be fast, not beautiful. Without matching is x1.3 slo... | python | def matchPrefix(text):
"""
This is silver bullet, cornerstone and magic wand of speed of this algorithm
it filters patterns using manually selected rules. Yes, yes, it's "dirty" code and it could be beautified in
many ways but this library intended to be fast, not beautiful. Without matching is x1.3 slo... | [
"def",
"matchPrefix",
"(",
"text",
")",
":",
"basekeys",
"=",
"[",
"]",
"if",
"not",
"text",
"[",
"0",
"]",
".",
"isdigit",
"(",
")",
":",
"if",
"ord",
"(",
"text",
"[",
"0",
"]",
".",
"lower",
"(",
")",
")",
"in",
"range",
"(",
"ord",
"(",
... | This is silver bullet, cornerstone and magic wand of speed of this algorithm
it filters patterns using manually selected rules. Yes, yes, it's "dirty" code and it could be beautified in
many ways but this library intended to be fast, not beautiful. Without matching is x1.3 slower so let it be.
:param text: ... | [
"This",
"is",
"silver",
"bullet",
"cornerstone",
"and",
"magic",
"wand",
"of",
"speed",
"of",
"this",
"algorithm",
"it",
"filters",
"patterns",
"using",
"manually",
"selected",
"rules",
".",
"Yes",
"yes",
"it",
"s",
"dirty",
"code",
"and",
"it",
"could",
"... | train | https://github.com/ivbeg/qddate/blob/f7730610611f2509ab264bc8d77a902742daf08c/qddate/dirty.py#L8-L73 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession._get_catalog_hierarchy_id | def _get_catalog_hierarchy_id(self, catalog_id, proxy, runtime):
"""Gets the catalog hierarchy"""
seed_str = convert_catalog_id_to_object_id_string(catalog_id)
ident = Id(authority=self._authority,
namespace='hierarchy.Hierarchy',
identifier=seed_str)
... | python | def _get_catalog_hierarchy_id(self, catalog_id, proxy, runtime):
"""Gets the catalog hierarchy"""
seed_str = convert_catalog_id_to_object_id_string(catalog_id)
ident = Id(authority=self._authority,
namespace='hierarchy.Hierarchy',
identifier=seed_str)
... | [
"def",
"_get_catalog_hierarchy_id",
"(",
"self",
",",
"catalog_id",
",",
"proxy",
",",
"runtime",
")",
":",
"seed_str",
"=",
"convert_catalog_id_to_object_id_string",
"(",
"catalog_id",
")",
"ident",
"=",
"Id",
"(",
"authority",
"=",
"self",
".",
"_authority",
"... | Gets the catalog hierarchy | [
"Gets",
"the",
"catalog",
"hierarchy"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L94-L100 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession._create_catalog_hierarchy | def _create_catalog_hierarchy(self, catalog_id, proxy, runtime):
"""Creates a catalog hierarchy"""
seed_str = convert_catalog_id_to_object_id_string(catalog_id)
has = HierarchyAdminSession(proxy, runtime)
hfc = has.get_hierarchy_form_for_create([])
hfc.set_display_name(catalog_id... | python | def _create_catalog_hierarchy(self, catalog_id, proxy, runtime):
"""Creates a catalog hierarchy"""
seed_str = convert_catalog_id_to_object_id_string(catalog_id)
has = HierarchyAdminSession(proxy, runtime)
hfc = has.get_hierarchy_form_for_create([])
hfc.set_display_name(catalog_id... | [
"def",
"_create_catalog_hierarchy",
"(",
"self",
",",
"catalog_id",
",",
"proxy",
",",
"runtime",
")",
":",
"seed_str",
"=",
"convert_catalog_id_to_object_id_string",
"(",
"catalog_id",
")",
"has",
"=",
"HierarchyAdminSession",
"(",
"proxy",
",",
"runtime",
")",
"... | Creates a catalog hierarchy | [
"Creates",
"a",
"catalog",
"hierarchy"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L102-L117 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession._set_relationship_type | def _set_relationship_type(self, type_identifier, display_name=None, display_label=None, description=None, domain='Relationship'):
"""Sets the relationship type"""
if display_name is None:
display_name = type_identifier
if display_label is None:
display_label = display_na... | python | def _set_relationship_type(self, type_identifier, display_name=None, display_label=None, description=None, domain='Relationship'):
"""Sets the relationship type"""
if display_name is None:
display_name = type_identifier
if display_label is None:
display_label = display_na... | [
"def",
"_set_relationship_type",
"(",
"self",
",",
"type_identifier",
",",
"display_name",
"=",
"None",
",",
"display_label",
"=",
"None",
",",
"description",
"=",
"None",
",",
"domain",
"=",
"'Relationship'",
")",
":",
"if",
"display_name",
"is",
"None",
":",... | Sets the relationship type | [
"Sets",
"the",
"relationship",
"type"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L119-L133 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession.get_roots | def get_roots(self):
"""Gets the root nodes of this hierarchy.
return: (osid.id.IdList) - the root nodes
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.*
"""... | python | def get_roots(self):
"""Gets the root nodes of this hierarchy.
return: (osid.id.IdList) - the root nodes
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.*
"""... | [
"def",
"get_roots",
"(",
"self",
")",
":",
"id_list",
"=",
"[",
"]",
"for",
"r",
"in",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_source",
"(",
"self",
".",
"_phantom_root_id",
",",
"self",
".",
"_relationship_type",
")",
":",
"id_list",
... | Gets the root nodes of this hierarchy.
return: (osid.id.IdList) - the root nodes
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"root",
"nodes",
"of",
"this",
"hierarchy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L181-L193 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession.is_parent | def is_parent(self, id_, parent_id):
"""Tests if an ``Id`` is a direct parent of another.
arg: id (osid.id.Id): the ``Id`` to query
arg: parent_id (osid.id.Id): the ``Id`` of a parent
return: (boolean) - ``true`` if this ``parent_id`` is a parent
of ``id,`` ``fals... | python | def is_parent(self, id_, parent_id):
"""Tests if an ``Id`` is a direct parent of another.
arg: id (osid.id.Id): the ``Id`` to query
arg: parent_id (osid.id.Id): the ``Id`` of a parent
return: (boolean) - ``true`` if this ``parent_id`` is a parent
of ``id,`` ``fals... | [
"def",
"is_parent",
"(",
"self",
",",
"id_",
",",
"parent_id",
")",
":",
"return",
"bool",
"(",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_peers",
"(",
"parent_id",
",",
"id_",
",",
"self",
".",
"_relationship_type",
")",
".",
"available",
... | Tests if an ``Id`` is a direct parent of another.
arg: id (osid.id.Id): the ``Id`` to query
arg: parent_id (osid.id.Id): the ``Id`` of a parent
return: (boolean) - ``true`` if this ``parent_id`` is a parent
of ``id,`` ``false`` otherwise
raise: NotFound - ``id`` ... | [
"Tests",
"if",
"an",
"Id",
"is",
"a",
"direct",
"parent",
"of",
"another",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L216-L235 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession.get_parents | def get_parents(self, id_):
"""Gets the parents of the given ``id``.
arg: id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the parents of the ``id``
raise: NotFound - ``id`` is not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed... | python | def get_parents(self, id_):
"""Gets the parents of the given ``id``.
arg: id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the parents of the ``id``
raise: NotFound - ``id`` is not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed... | [
"def",
"get_parents",
"(",
"self",
",",
"id_",
")",
":",
"id_list",
"=",
"[",
"]",
"for",
"r",
"in",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_destination",
"(",
"id_",
",",
"self",
".",
"_relationship_type",
")",
":",
"ident",
"=",
"r... | Gets the parents of the given ``id``.
arg: id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the parents of the ``id``
raise: NotFound - ``id`` is not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
r... | [
"Gets",
"the",
"parents",
"of",
"the",
"given",
"id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L238-L255 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession.is_child | def is_child(self, id_, child_id):
"""Tests if a node is a direct child of another.
arg: id (osid.id.Id): the ``Id`` to query
arg: child_id (osid.id.Id): the ``Id`` of a child
return: (boolean) - ``true`` if this ``child_id`` is a child of
the ``Id,`` ``false`` ot... | python | def is_child(self, id_, child_id):
"""Tests if a node is a direct child of another.
arg: id (osid.id.Id): the ``Id`` to query
arg: child_id (osid.id.Id): the ``Id`` of a child
return: (boolean) - ``true`` if this ``child_id`` is a child of
the ``Id,`` ``false`` ot... | [
"def",
"is_child",
"(",
"self",
",",
"id_",
",",
"child_id",
")",
":",
"return",
"bool",
"(",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_peers",
"(",
"id_",
",",
"child_id",
",",
"self",
".",
"_relationship_type",
")",
".",
"available",
"... | Tests if a node is a direct child of another.
arg: id (osid.id.Id): the ``Id`` to query
arg: child_id (osid.id.Id): the ``Id`` of a child
return: (boolean) - ``true`` if this ``child_id`` is a child of
the ``Id,`` ``false`` otherwise
raise: NotFound - ``id`` is n... | [
"Tests",
"if",
"a",
"node",
"is",
"a",
"direct",
"child",
"of",
"another",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L295-L314 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession.get_children | def get_children(self, id_):
"""Gets the children of the given ``Id``.
arg: id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the ``id``
raise: NotFound - ``id`` is not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFai... | python | def get_children(self, id_):
"""Gets the children of the given ``Id``.
arg: id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the ``id``
raise: NotFound - ``id`` is not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFai... | [
"def",
"get_children",
"(",
"self",
",",
"id_",
")",
":",
"id_list",
"=",
"[",
"]",
"for",
"r",
"in",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_source",
"(",
"id_",
",",
"self",
".",
"_relationship_type",
")",
":",
"id_list",
".",
"app... | Gets the children of the given ``Id``.
arg: id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the ``id``
raise: NotFound - ``id`` is not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
... | [
"Gets",
"the",
"children",
"of",
"the",
"given",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L317-L332 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyTraversalSession.get_nodes | def get_nodes(self, id_, ancestor_levels=10, descendant_levels=10, include_siblings=False):
"""Gets a portion of the hierarchy for the given ``Id``.
arg: id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include.... | python | def get_nodes(self, id_, ancestor_levels=10, descendant_levels=10, include_siblings=False):
"""Gets a portion of the hierarchy for the given ``Id``.
arg: id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include.... | [
"def",
"get_nodes",
"(",
"self",
",",
"id_",
",",
"ancestor_levels",
"=",
"10",
",",
"descendant_levels",
"=",
"10",
",",
"include_siblings",
"=",
"False",
")",
":",
"# This impl ignores include_siblings, assumes false",
"include_siblings",
"=",
"bool",
"(",
"includ... | Gets a portion of the hierarchy for the given ``Id``.
arg: id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include. A value of 0 returns no
parents in the node.
arg: descendant_levels (cardin... | [
"Gets",
"a",
"portion",
"of",
"the",
"hierarchy",
"for",
"the",
"given",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L353-L390 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession.add_root | def add_root(self, id_):
"""Adds a root node.
arg: id (osid.id.Id): the ``Id`` of the node
raise: AlreadyExists - ``id`` is already in hierarchy
raise: NotFound - ``id`` not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete... | python | def add_root(self, id_):
"""Adds a root node.
arg: id (osid.id.Id): the ``Id`` of the node
raise: AlreadyExists - ``id`` is already in hierarchy
raise: NotFound - ``id`` not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete... | [
"def",
"add_root",
"(",
"self",
",",
"id_",
")",
":",
"if",
"(",
"bool",
"(",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_source",
"(",
"id_",
",",
"self",
".",
"_relationship_type",
")",
".",
"available",
"(",
")",
")",
"or",
"bool",
... | Adds a root node.
arg: id (osid.id.Id): the ``Id`` of the node
raise: AlreadyExists - ``id`` is already in hierarchy
raise: NotFound - ``id`` not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionD... | [
"Adds",
"a",
"root",
"node",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L514-L529 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession.add_child | def add_child(self, id_, child_id):
"""Adds a child to a ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``child_id`` is already a child of
``id``
raise: NotFound - ``id``... | python | def add_child(self, id_, child_id):
"""Adds a child to a ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``child_id`` is already a child of
``id``
raise: NotFound - ``id``... | [
"def",
"add_child",
"(",
"self",
",",
"id_",
",",
"child_id",
")",
":",
"if",
"bool",
"(",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_peers",
"(",
"id_",
",",
"child_id",
",",
"self",
".",
"_relationship_type",
")",
".",
"available",
"(",... | Adds a child to a ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``child_id`` is already a child of
``id``
raise: NotFound - ``id`` or ``child_id`` not found
raise: Null... | [
"Adds",
"a",
"child",
"to",
"a",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L532-L552 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession.remove_root | def remove_root(self, id_):
"""Removes a root node.
arg: id (osid.id.Id): the ``Id`` of the node
raise: NotFound - ``id`` was not found or not in hierarchy
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
raise: Permissi... | python | def remove_root(self, id_):
"""Removes a root node.
arg: id (osid.id.Id): the ``Id`` of the node
raise: NotFound - ``id`` was not found or not in hierarchy
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
raise: Permissi... | [
"def",
"remove_root",
"(",
"self",
",",
"id_",
")",
":",
"result",
"=",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_peers",
"(",
"self",
".",
"_phantom_root_id",
",",
"id_",
",",
"self",
".",
"_relationship_type",
")",
"if",
"not",
"bool",
... | Removes a root node.
arg: id (osid.id.Id): the ``Id`` of the node
raise: NotFound - ``id`` was not found or not in hierarchy
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
... | [
"Removes",
"a",
"root",
"node",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L555-L570 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession.remove_child | def remove_child(self, id_, child_id):
"""Removes a childfrom an ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
arg: child_id (osid.id.Id): the ``Id`` of the child to remove
raise: NotFound - ``id`` or ``child_id`` was not found or
``child_id`` is not a chil... | python | def remove_child(self, id_, child_id):
"""Removes a childfrom an ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
arg: child_id (osid.id.Id): the ``Id`` of the child to remove
raise: NotFound - ``id`` or ``child_id`` was not found or
``child_id`` is not a chil... | [
"def",
"remove_child",
"(",
"self",
",",
"id_",
",",
"child_id",
")",
":",
"result",
"=",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_peers",
"(",
"id_",
",",
"child_id",
",",
"self",
".",
"_relationship_type",
")",
"if",
"not",
"bool",
"(... | Removes a childfrom an ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
arg: child_id (osid.id.Id): the ``Id`` of the child to remove
raise: NotFound - ``id`` or ``child_id`` was not found or
``child_id`` is not a child of ``id``
raise: NullArgument - ``id`` ... | [
"Removes",
"a",
"childfrom",
"an",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L573-L589 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession.remove_children | def remove_children(self, id_):
"""Removes all childrenfrom an ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
raise: NotFound - an node identified by the given ``Id`` was
not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unab... | python | def remove_children(self, id_):
"""Removes all childrenfrom an ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
raise: NotFound - an node identified by the given ``Id`` was
not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unab... | [
"def",
"remove_children",
"(",
"self",
",",
"id_",
")",
":",
"results",
"=",
"self",
".",
"_rls",
".",
"get_relationships_by_genus_type_for_source",
"(",
"id_",
",",
"self",
".",
"_relationship_type",
")",
"if",
"results",
".",
"available",
"(",
")",
"==",
"... | Removes all childrenfrom an ``Id``.
arg: id (osid.id.Id): the ``Id`` of the node
raise: NotFound - an node identified by the given ``Id`` was
not found
raise: NullArgument - ``id`` is ``null``
raise: OperationFailed - unable to complete request
raise: Perm... | [
"Removes",
"all",
"childrenfrom",
"an",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L592-L608 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession._adopt_orphans | def _adopt_orphans(self, negligent_parent_id):
"""Clean up orphaned children"""
for child_id in self._hts.get_children(negligent_parent_id):
self.remove_child(negligent_parent_id, child_id)
if not self._hts.has_parents(child_id):
self._assign_as_root(child_id) | python | def _adopt_orphans(self, negligent_parent_id):
"""Clean up orphaned children"""
for child_id in self._hts.get_children(negligent_parent_id):
self.remove_child(negligent_parent_id, child_id)
if not self._hts.has_parents(child_id):
self._assign_as_root(child_id) | [
"def",
"_adopt_orphans",
"(",
"self",
",",
"negligent_parent_id",
")",
":",
"for",
"child_id",
"in",
"self",
".",
"_hts",
".",
"get_children",
"(",
"negligent_parent_id",
")",
":",
"self",
".",
"remove_child",
"(",
"negligent_parent_id",
",",
"child_id",
")",
... | Clean up orphaned children | [
"Clean",
"up",
"orphaned",
"children"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L610-L615 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyDesignSession._assign_as_root | def _assign_as_root(self, id_):
"""Assign an id_ a root object in the hierarchy"""
rfc = self._ras.get_relationship_form_for_create(self._phantom_root_id, id_, [])
rfc.set_display_name('Implicit Root to ' + str(id_) + ' Parent-Child Relationship')
rfc.set_description(self._relationship_t... | python | def _assign_as_root(self, id_):
"""Assign an id_ a root object in the hierarchy"""
rfc = self._ras.get_relationship_form_for_create(self._phantom_root_id, id_, [])
rfc.set_display_name('Implicit Root to ' + str(id_) + ' Parent-Child Relationship')
rfc.set_description(self._relationship_t... | [
"def",
"_assign_as_root",
"(",
"self",
",",
"id_",
")",
":",
"rfc",
"=",
"self",
".",
"_ras",
".",
"get_relationship_form_for_create",
"(",
"self",
".",
"_phantom_root_id",
",",
"id_",
",",
"[",
"]",
")",
"rfc",
".",
"set_display_name",
"(",
"'Implicit Root ... | Assign an id_ a root object in the hierarchy | [
"Assign",
"an",
"id_",
"a",
"root",
"object",
"in",
"the",
"hierarchy"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L617-L623 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyAdminSession.can_create_hierarchy_with_record_types | def can_create_hierarchy_with_record_types(self, hierarchy_record_types):
"""Tests if this user can create a single ``Hierarchy`` using the desired record types.
While ``HierarchyManager.getHierarchyRecordTypes()`` can be used
to examine which records are supported, this method tests which
... | python | def can_create_hierarchy_with_record_types(self, hierarchy_record_types):
"""Tests if this user can create a single ``Hierarchy`` using the desired record types.
While ``HierarchyManager.getHierarchyRecordTypes()`` can be used
to examine which records are supported, this method tests which
... | [
"def",
"can_create_hierarchy_with_record_types",
"(",
"self",
",",
"hierarchy_record_types",
")",
":",
"# Implemented from template for",
"# osid.resource.BinAdminSession.can_create_bin_with_record_types",
"# NOTE: It is expected that real authentication hints will be",
"# handled in a service... | Tests if this user can create a single ``Hierarchy`` using the desired record types.
While ``HierarchyManager.getHierarchyRecordTypes()`` can be used
to examine which records are supported, this method tests which
record(s) are required for creating a specific ``Hierarchy``.
Providing a... | [
"Tests",
"if",
"this",
"user",
"can",
"create",
"a",
"single",
"Hierarchy",
"using",
"the",
"desired",
"record",
"types",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L978-L1001 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyAdminSession.update_hierarchy | def update_hierarchy(self, hierarchy_form):
"""Updates an existing hierarchy.
arg: hierarchy_form (osid.hierarchy.HierarchyForm): the form
containing the elements to be updated
raise: IllegalState - ``hierarchy_form`` already used in an
update transaction
... | python | def update_hierarchy(self, hierarchy_form):
"""Updates an existing hierarchy.
arg: hierarchy_form (osid.hierarchy.HierarchyForm): the form
containing the elements to be updated
raise: IllegalState - ``hierarchy_form`` already used in an
update transaction
... | [
"def",
"update_hierarchy",
"(",
"self",
",",
"hierarchy_form",
")",
":",
"# Implemented from template for",
"# osid.resource.BinAdminSession.update_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
"... | Updates an existing hierarchy.
arg: hierarchy_form (osid.hierarchy.HierarchyForm): the form
containing the elements to be updated
raise: IllegalState - ``hierarchy_form`` already used in an
update transaction
raise: InvalidArgument - the form contains an inv... | [
"Updates",
"an",
"existing",
"hierarchy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L1146-L1186 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyAdminSession.delete_hierarchy | def delete_hierarchy(self, hierarchy_id):
"""Deletes a ``Hierarchy``.
arg: hierarchy_id (osid.id.Id): the ``Id`` of the
``Hierarchy`` to remove
raise: NotFound - ``hierarchy_id`` not found
raise: NullArgument - ``hierarchy_id`` is ``null``
raise: OperationF... | python | def delete_hierarchy(self, hierarchy_id):
"""Deletes a ``Hierarchy``.
arg: hierarchy_id (osid.id.Id): the ``Id`` of the
``Hierarchy`` to remove
raise: NotFound - ``hierarchy_id`` not found
raise: NullArgument - ``hierarchy_id`` is ``null``
raise: OperationF... | [
"def",
"delete_hierarchy",
"(",
"self",
",",
"hierarchy_id",
")",
":",
"collection",
"=",
"JSONClientValidated",
"(",
"'hierarchy'",
",",
"collection",
"=",
"'Hierarchy'",
",",
"runtime",
"=",
"self",
".",
"_runtime",
")",
"if",
"not",
"isinstance",
"(",
"hier... | Deletes a ``Hierarchy``.
arg: hierarchy_id (osid.id.Id): the ``Id`` of the
``Hierarchy`` to remove
raise: NotFound - ``hierarchy_id`` not found
raise: NullArgument - ``hierarchy_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: Pe... | [
"Deletes",
"a",
"Hierarchy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L1211-L1231 |
mitsei/dlkit | dlkit/json_/hierarchy/sessions.py | HierarchyAdminSession.alias_hierarchy | def alias_hierarchy(self, hierarchy_id, alias_id):
"""Adds an ``Id`` to a ``Hierarchy`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Hierarchy`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer ... | python | def alias_hierarchy(self, hierarchy_id, alias_id):
"""Adds an ``Id`` to a ``Hierarchy`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Hierarchy`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer ... | [
"def",
"alias_hierarchy",
"(",
"self",
",",
"hierarchy_id",
",",
"alias_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinLookupSession.alias_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_cat... | Adds an ``Id`` to a ``Hierarchy`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Hierarchy`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to another vault it is
reassigned to the given vault `... | [
"Adds",
"an",
"Id",
"to",
"a",
"Hierarchy",
"for",
"the",
"purpose",
"of",
"creating",
"compatibility",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/sessions.py#L1252-L1276 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager._set_bank_view | def _set_bank_view(self, session):
"""Sets the underlying bank view to match current view"""
if self._bank_view == COMPARATIVE:
try:
session.use_comparative_bank_view()
except AttributeError:
pass
else:
try:
sess... | python | def _set_bank_view(self, session):
"""Sets the underlying bank view to match current view"""
if self._bank_view == COMPARATIVE:
try:
session.use_comparative_bank_view()
except AttributeError:
pass
else:
try:
sess... | [
"def",
"_set_bank_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_bank_view",
"==",
"COMPARATIVE",
":",
"try",
":",
"session",
".",
"use_comparative_bank_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
... | Sets the underlying bank view to match current view | [
"Sets",
"the",
"underlying",
"bank",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L397-L408 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.use_plenary_bank_view | def use_plenary_bank_view(self):
"""Pass through to provider ItemBankSession.use_plenary_bank_view"""
self._bank_view = PLENARY
# self._get_provider_session('item_bank_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | python | def use_plenary_bank_view(self):
"""Pass through to provider ItemBankSession.use_plenary_bank_view"""
self._bank_view = PLENARY
# self._get_provider_session('item_bank_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | [
"def",
"use_plenary_bank_view",
"(",
"self",
")",
":",
"self",
".",
"_bank_view",
"=",
"PLENARY",
"# self._get_provider_session('item_bank_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
"try",
... | Pass through to provider ItemBankSession.use_plenary_bank_view | [
"Pass",
"through",
"to",
"provider",
"ItemBankSession",
".",
"use_plenary_bank_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L891-L899 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.get_banks_by_item | def get_banks_by_item(self, *args, **kwargs):
"""Pass through to provider ItemBankSession.get_banks_by_item"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('item_bank_session').get_banks_by_item(*a... | python | def get_banks_by_item(self, *args, **kwargs):
"""Pass through to provider ItemBankSession.get_banks_by_item"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('item_bank_session').get_banks_by_item(*a... | [
"def",
"get_banks_by_item",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceBinSession.get_bins_by_resource",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'item_bank_sess... | Pass through to provider ItemBankSession.get_banks_by_item | [
"Pass",
"through",
"to",
"provider",
"ItemBankSession",
".",
"get_banks_by_item"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L931-L939 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.get_bank | def get_bank(self, *args, **kwargs):
"""Pass through to provider BankLookupSession.get_bank"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bin
return Bank(
self._provider_manager,
self._get_provider_session('bank_lookup_session')... | python | def get_bank(self, *args, **kwargs):
"""Pass through to provider BankLookupSession.get_bank"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bin
return Bank(
self._provider_manager,
self._get_provider_session('bank_lookup_session')... | [
"def",
"get_bank",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bin",
"return",
"Bank",
"(",
"self",
".",
"_provider_manager",
",",
"self",
".",
"_get_provider_sess... | Pass through to provider BankLookupSession.get_bank | [
"Pass",
"through",
"to",
"provider",
"BankLookupSession",
".",
"get_bank"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L1243-L1251 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.get_banks | def get_banks(self):
"""Pass through to provider BankLookupSession.get_banks"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('bank_lookup_session').get_banks()
cat_list = []
for cat in c... | python | def get_banks(self):
"""Pass through to provider BankLookupSession.get_banks"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('bank_lookup_session').get_banks()
cat_list = []
for cat in c... | [
"def",
"get_banks",
"(",
"self",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bins_template",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'bank_lookup_session'",
")",
".",
"get_banks",
"(",
")",
"cat_list",
"=... | Pass through to provider BankLookupSession.get_banks | [
"Pass",
"through",
"to",
"provider",
"BankLookupSession",
".",
"get_banks"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L1303-L1311 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.get_bank_form | def get_bank_form(self, *args, **kwargs):
"""Pass through to provider BankAdminSession.get_bank_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if i... | python | def get_bank_form(self, *args, **kwargs):
"""Pass through to provider BankAdminSession.get_bank_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if i... | [
"def",
"get_bank_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# 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",
... | Pass through to provider BankAdminSession.get_bank_form_for_update | [
"Pass",
"through",
"to",
"provider",
"BankAdminSession",
".",
"get_bank_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L1379-L1387 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.save_bank | def save_bank(self, bank_form, *args, **kwargs):
"""Pass through to provider BankAdminSession.update_bank"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if bank_form.is_for_update():
return self.update_bank(bank_form, *args, **kwargs)
... | python | def save_bank(self, bank_form, *args, **kwargs):
"""Pass through to provider BankAdminSession.update_bank"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if bank_form.is_for_update():
return self.update_bank(bank_form, *args, **kwargs)
... | [
"def",
"save_bank",
"(",
"self",
",",
"bank_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.update_bin",
"if",
"bank_form",
".",
"is_for_update",
"(",
")",
":",
"return",
"self... | Pass through to provider BankAdminSession.update_bank | [
"Pass",
"through",
"to",
"provider",
"BankAdminSession",
".",
"update_bank"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L1400-L1407 |
mitsei/dlkit | dlkit/services/assessment.py | AssessmentManager.use_comparative_assessment_part_bank_view | def use_comparative_assessment_part_bank_view(self):
"""Pass through to provider AssessmentPartBankSession.use_comparative_assessment_part_bank_view"""
self._bank_view = COMPARATIVE
# self._get_provider_session('assessment_part_bank_session') # To make sure the session is tracked
for ses... | python | def use_comparative_assessment_part_bank_view(self):
"""Pass through to provider AssessmentPartBankSession.use_comparative_assessment_part_bank_view"""
self._bank_view = COMPARATIVE
# self._get_provider_session('assessment_part_bank_session') # To make sure the session is tracked
for ses... | [
"def",
"use_comparative_assessment_part_bank_view",
"(",
"self",
")",
":",
"self",
".",
"_bank_view",
"=",
"COMPARATIVE",
"# self._get_provider_session('assessment_part_bank_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessio... | Pass through to provider AssessmentPartBankSession.use_comparative_assessment_part_bank_view | [
"Pass",
"through",
"to",
"provider",
"AssessmentPartBankSession",
".",
"use_comparative_assessment_part_bank_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L1690-L1698 |
mitsei/dlkit | dlkit/services/assessment.py | Bank._set_bank_view | def _set_bank_view(self, session):
"""Sets the underlying bank view to match current view"""
if self._bank_view == FEDERATED:
try:
session.use_federated_bank_view()
except AttributeError:
pass
else:
try:
session.... | python | def _set_bank_view(self, session):
"""Sets the underlying bank view to match current view"""
if self._bank_view == FEDERATED:
try:
session.use_federated_bank_view()
except AttributeError:
pass
else:
try:
session.... | [
"def",
"_set_bank_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_bank_view",
"==",
"FEDERATED",
":",
"try",
":",
"session",
".",
"use_federated_bank_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
"ses... | Sets the underlying bank view to match current view | [
"Sets",
"the",
"underlying",
"bank",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2045-L2056 |
mitsei/dlkit | dlkit/services/assessment.py | Bank._get_sub_package_provider_session | def _get_sub_package_provider_session(self, sub_package, session_name, proxy=None):
"""Gets the session from a sub-package"""
agent_key = self._get_agent_key()
if session_name in self._provider_sessions[agent_key]:
return self._provider_sessions[agent_key][session_name]
else:... | python | def _get_sub_package_provider_session(self, sub_package, session_name, proxy=None):
"""Gets the session from a sub-package"""
agent_key = self._get_agent_key()
if session_name in self._provider_sessions[agent_key]:
return self._provider_sessions[agent_key][session_name]
else:... | [
"def",
"_get_sub_package_provider_session",
"(",
"self",
",",
"sub_package",
",",
"session_name",
",",
"proxy",
"=",
"None",
")",
":",
"agent_key",
"=",
"self",
".",
"_get_agent_key",
"(",
")",
"if",
"session_name",
"in",
"self",
".",
"_provider_sessions",
"[",
... | Gets the session from a sub-package | [
"Gets",
"the",
"session",
"from",
"a",
"sub",
"-",
"package"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2143-L2159 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_comparative_item_view | def use_comparative_item_view(self):
"""Pass through to provider ItemLookupSession.use_comparative_item_view"""
self._object_views['item'] = COMPARATIVE
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():... | python | def use_comparative_item_view(self):
"""Pass through to provider ItemLookupSession.use_comparative_item_view"""
self._object_views['item'] = COMPARATIVE
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():... | [
"def",
"use_comparative_item_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'item'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('item_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_se... | Pass through to provider ItemLookupSession.use_comparative_item_view | [
"Pass",
"through",
"to",
"provider",
"ItemLookupSession",
".",
"use_comparative_item_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2423-L2431 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_plenary_item_view | def use_plenary_item_view(self):
"""Pass through to provider ItemLookupSession.use_plenary_item_view"""
self._object_views['item'] = PLENARY
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_plenary_item_view(self):
"""Pass through to provider ItemLookupSession.use_plenary_item_view"""
self._object_views['item'] = PLENARY
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_plenary_item_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'item'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('item_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",... | Pass through to provider ItemLookupSession.use_plenary_item_view | [
"Pass",
"through",
"to",
"provider",
"ItemLookupSession",
".",
"use_plenary_item_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2433-L2441 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_federated_bank_view | def use_federated_bank_view(self):
"""Pass through to provider ItemLookupSession.use_federated_bank_view"""
self._bank_view = FEDERATED
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:... | python | def use_federated_bank_view(self):
"""Pass through to provider ItemLookupSession.use_federated_bank_view"""
self._bank_view = FEDERATED
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:... | [
"def",
"use_federated_bank_view",
"(",
"self",
")",
":",
"self",
".",
"_bank_view",
"=",
"FEDERATED",
"# self._get_provider_session('item_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
"... | Pass through to provider ItemLookupSession.use_federated_bank_view | [
"Pass",
"through",
"to",
"provider",
"ItemLookupSession",
".",
"use_federated_bank_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2443-L2451 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_isolated_bank_view | def use_isolated_bank_view(self):
"""Pass through to provider ItemLookupSession.use_isolated_bank_view"""
self._bank_view = ISOLATED
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | python | def use_isolated_bank_view(self):
"""Pass through to provider ItemLookupSession.use_isolated_bank_view"""
self._bank_view = ISOLATED
# self._get_provider_session('item_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | [
"def",
"use_isolated_bank_view",
"(",
"self",
")",
":",
"self",
".",
"_bank_view",
"=",
"ISOLATED",
"# self._get_provider_session('item_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
"tr... | Pass through to provider ItemLookupSession.use_isolated_bank_view | [
"Pass",
"through",
"to",
"provider",
"ItemLookupSession",
".",
"use_isolated_bank_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2453-L2461 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.get_item_form | def get_item_form(self, *args, **kwargs):
"""Pass through to provider ItemAdminSession.get_item_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 ... | python | def get_item_form(self, *args, **kwargs):
"""Pass through to provider ItemAdminSession.get_item_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 ... | [
"def",
"get_item_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# 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",
... | Pass through to provider ItemAdminSession.get_item_form_for_update | [
"Pass",
"through",
"to",
"provider",
"ItemAdminSession",
".",
"get_item_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2603-L2611 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.save_item | def save_item(self, item_form, *args, **kwargs):
"""Pass through to provider ItemAdminSession.update_item"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if item_form.is_for_update():
return self.update_item(item_form, *args, ... | python | def save_item(self, item_form, *args, **kwargs):
"""Pass through to provider ItemAdminSession.update_item"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if item_form.is_for_update():
return self.update_item(item_form, *args, ... | [
"def",
"save_item",
"(",
"self",
",",
"item_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.update_resource",
"if",
"item_form",
".",
"is_for_update",
"(",
")",
":",
"return... | Pass through to provider ItemAdminSession.update_item | [
"Pass",
"through",
"to",
"provider",
"ItemAdminSession",
".",
"update_item"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2625-L2632 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_comparative_assessment_view | def use_comparative_assessment_view(self):
"""Pass through to provider AssessmentLookupSession.use_comparative_assessment_view"""
self._object_views['assessment'] = COMPARATIVE
# self._get_provider_session('assessment_lookup_session') # To make sure the session is tracked
for session in ... | python | def use_comparative_assessment_view(self):
"""Pass through to provider AssessmentLookupSession.use_comparative_assessment_view"""
self._object_views['assessment'] = COMPARATIVE
# self._get_provider_session('assessment_lookup_session') # To make sure the session is tracked
for session in ... | [
"def",
"use_comparative_assessment_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'assessment'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('assessment_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
... | Pass through to provider AssessmentLookupSession.use_comparative_assessment_view | [
"Pass",
"through",
"to",
"provider",
"AssessmentLookupSession",
".",
"use_comparative_assessment_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2818-L2826 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_plenary_assessment_view | def use_plenary_assessment_view(self):
"""Pass through to provider AssessmentLookupSession.use_plenary_assessment_view"""
self._object_views['assessment'] = PLENARY
# self._get_provider_session('assessment_lookup_session') # To make sure the session is tracked
for session in self._get_pr... | python | def use_plenary_assessment_view(self):
"""Pass through to provider AssessmentLookupSession.use_plenary_assessment_view"""
self._object_views['assessment'] = PLENARY
# self._get_provider_session('assessment_lookup_session') # To make sure the session is tracked
for session in self._get_pr... | [
"def",
"use_plenary_assessment_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'assessment'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('assessment_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_p... | Pass through to provider AssessmentLookupSession.use_plenary_assessment_view | [
"Pass",
"through",
"to",
"provider",
"AssessmentLookupSession",
".",
"use_plenary_assessment_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2828-L2836 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.get_assessment_form | def get_assessment_form(self, *args, **kwargs):
"""Pass through to provider AssessmentAdminSession.get_assessment_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... | python | def get_assessment_form(self, *args, **kwargs):
"""Pass through to provider AssessmentAdminSession.get_assessment_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... | [
"def",
"get_assessment_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.get_resource_form_for_update",
"# This method might be a bit sketchy. Time will tell.",
"if",
"isinstan... | Pass through to provider AssessmentAdminSession.get_assessment_form_for_update | [
"Pass",
"through",
"to",
"provider",
"AssessmentAdminSession",
".",
"get_assessment_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2936-L2944 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.save_assessment | def save_assessment(self, assessment_form, *args, **kwargs):
"""Pass through to provider AssessmentAdminSession.update_assessment"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if assessment_form.is_for_update():
return self.... | python | def save_assessment(self, assessment_form, *args, **kwargs):
"""Pass through to provider AssessmentAdminSession.update_assessment"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if assessment_form.is_for_update():
return self.... | [
"def",
"save_assessment",
"(",
"self",
",",
"assessment_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.update_resource",
"if",
"assessment_form",
".",
"is_for_update",
"(",
")"... | Pass through to provider AssessmentAdminSession.update_assessment | [
"Pass",
"through",
"to",
"provider",
"AssessmentAdminSession",
".",
"update_assessment"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L2958-L2965 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.add_item | def add_item(self, *args, **kwargs):
"""Pass through to provider methods."""
try:
self._get_provider_session('assessment_basic_authoring_session').add_item(*args, **kwargs)
except InvalidArgument:
self._get_sub_package_provider_session(
'assessment_authori... | python | def add_item(self, *args, **kwargs):
"""Pass through to provider methods."""
try:
self._get_provider_session('assessment_basic_authoring_session').add_item(*args, **kwargs)
except InvalidArgument:
self._get_sub_package_provider_session(
'assessment_authori... | [
"def",
"add_item",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"_get_provider_session",
"(",
"'assessment_basic_authoring_session'",
")",
".",
"add_item",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"exc... | Pass through to provider methods. | [
"Pass",
"through",
"to",
"provider",
"methods",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L3002-L3008 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.remove_item | def remove_item(self, *args, **kwargs):
"""Pass through to provider methods."""
try:
self._get_provider_session('assessment_basic_authoring_session').remove_item(*args, **kwargs)
except InvalidArgument:
self._get_sub_package_provider_session(
'assessment_a... | python | def remove_item(self, *args, **kwargs):
"""Pass through to provider methods."""
try:
self._get_provider_session('assessment_basic_authoring_session').remove_item(*args, **kwargs)
except InvalidArgument:
self._get_sub_package_provider_session(
'assessment_a... | [
"def",
"remove_item",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"_get_provider_session",
"(",
"'assessment_basic_authoring_session'",
")",
".",
"remove_item",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
... | Pass through to provider methods. | [
"Pass",
"through",
"to",
"provider",
"methods",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L3010-L3016 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.order_items | def order_items(self, *args, **kwargs):
"""Pass through to provider methods."""
try:
self._get_provider_session('assessment_basic_authoring_session').order_items(*args, **kwargs)
except InvalidArgument:
self._get_sub_package_provider_session(
'assessment_a... | python | def order_items(self, *args, **kwargs):
"""Pass through to provider methods."""
try:
self._get_provider_session('assessment_basic_authoring_session').order_items(*args, **kwargs)
except InvalidArgument:
self._get_sub_package_provider_session(
'assessment_a... | [
"def",
"order_items",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"_get_provider_session",
"(",
"'assessment_basic_authoring_session'",
")",
".",
"order_items",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
... | Pass through to provider methods. | [
"Pass",
"through",
"to",
"provider",
"methods",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L3022-L3028 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_comparative_assessment_offered_view | def use_comparative_assessment_offered_view(self):
"""Pass through to provider AssessmentOfferedLookupSession.use_comparative_assessment_offered_view"""
self._object_views['assessment_offered'] = COMPARATIVE
# self._get_provider_session('assessment_offered_lookup_session') # To make sure the ses... | python | def use_comparative_assessment_offered_view(self):
"""Pass through to provider AssessmentOfferedLookupSession.use_comparative_assessment_offered_view"""
self._object_views['assessment_offered'] = COMPARATIVE
# self._get_provider_session('assessment_offered_lookup_session') # To make sure the ses... | [
"def",
"use_comparative_assessment_offered_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'assessment_offered'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('assessment_offered_lookup_session') # To make sure the session is tracked",
"for",
"session",
... | Pass through to provider AssessmentOfferedLookupSession.use_comparative_assessment_offered_view | [
"Pass",
"through",
"to",
"provider",
"AssessmentOfferedLookupSession",
".",
"use_comparative_assessment_offered_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L3038-L3046 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.use_plenary_assessment_offered_view | def use_plenary_assessment_offered_view(self):
"""Pass through to provider AssessmentOfferedLookupSession.use_plenary_assessment_offered_view"""
self._object_views['assessment_offered'] = PLENARY
# self._get_provider_session('assessment_offered_lookup_session') # To make sure the session is trac... | python | def use_plenary_assessment_offered_view(self):
"""Pass through to provider AssessmentOfferedLookupSession.use_plenary_assessment_offered_view"""
self._object_views['assessment_offered'] = PLENARY
# self._get_provider_session('assessment_offered_lookup_session') # To make sure the session is trac... | [
"def",
"use_plenary_assessment_offered_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'assessment_offered'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('assessment_offered_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
... | Pass through to provider AssessmentOfferedLookupSession.use_plenary_assessment_offered_view | [
"Pass",
"through",
"to",
"provider",
"AssessmentOfferedLookupSession",
".",
"use_plenary_assessment_offered_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L3048-L3056 |
mitsei/dlkit | dlkit/services/assessment.py | Bank.get_assessment_offered_form | def get_assessment_offered_form(self, *args, **kwargs):
"""Pass through to provider AssessmentOfferedAdminSession.get_assessment_offered_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a... | python | def get_assessment_offered_form(self, *args, **kwargs):
"""Pass through to provider AssessmentOfferedAdminSession.get_assessment_offered_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a... | [
"def",
"get_assessment_offered_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.get_resource_form_for_update",
"# This method might be a bit sketchy. Time will tell.",
"if",
"... | Pass through to provider AssessmentOfferedAdminSession.get_assessment_offered_form_for_update | [
"Pass",
"through",
"to",
"provider",
"AssessmentOfferedAdminSession",
".",
"get_assessment_offered_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/assessment.py#L3166-L3174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.