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 |
|---|---|---|---|---|---|---|---|---|---|---|
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | InlineChoiceFeedbackAndFilesAnswerFormRecord.clear_choice_ids | def clear_choice_ids(self, inline_region):
"""stub"""
if (self.get_choice_ids_metadata().is_read_only() or
self.get_choice_ids_metadata().is_required()):
raise NoAccess()
if inline_region in self.my_osid_object_form._my_map['inlineRegions']:
self.my_osid_o... | python | def clear_choice_ids(self, inline_region):
"""stub"""
if (self.get_choice_ids_metadata().is_read_only() or
self.get_choice_ids_metadata().is_required()):
raise NoAccess()
if inline_region in self.my_osid_object_form._my_map['inlineRegions']:
self.my_osid_o... | [
"def",
"clear_choice_ids",
"(",
"self",
",",
"inline_region",
")",
":",
"if",
"(",
"self",
".",
"get_choice_ids_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_choice_ids_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L542-L551 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | InlineChoiceFeedbackAndFilesAnswerRecord.get_inline_choice_ids | def get_inline_choice_ids(self):
"""stub"""
return_data = {}
for inline_region, data in self.my_osid_object._my_map['inlineRegions'].items():
return_data[inline_region] = {
'choiceIds': IdList(data['choiceIds'])
}
return return_data | python | def get_inline_choice_ids(self):
"""stub"""
return_data = {}
for inline_region, data in self.my_osid_object._my_map['inlineRegions'].items():
return_data[inline_region] = {
'choiceIds': IdList(data['choiceIds'])
}
return return_data | [
"def",
"get_inline_choice_ids",
"(",
"self",
")",
":",
"return_data",
"=",
"{",
"}",
"for",
"inline_region",
",",
"data",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'inlineRegions'",
"]",
".",
"items",
"(",
")",
":",
"return_data",
"[",
"in... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L581-L588 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | MultiLanguageInlineChoiceQuestionFormRecord._init_map | def _init_map(self):
"""stub"""
super(MultiLanguageInlineChoiceQuestionFormRecord, self)._init_map()
self.my_osid_object_form._my_map['choices'] = \
self._choices_metadata['default_object_values'][0] | python | def _init_map(self):
"""stub"""
super(MultiLanguageInlineChoiceQuestionFormRecord, self)._init_map()
self.my_osid_object_form._my_map['choices'] = \
self._choices_metadata['default_object_values'][0] | [
"def",
"_init_map",
"(",
"self",
")",
":",
"super",
"(",
"MultiLanguageInlineChoiceQuestionFormRecord",
",",
"self",
")",
".",
"_init_map",
"(",
")",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'choices'",
"]",
"=",
"self",
".",
"_choices_metadata"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L605-L609 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | MultiLanguageInlineChoiceQuestionFormRecord.remove_choice_language | def remove_choice_language(self, language_type, choice_id, inline_region):
"""stub"""
if len(self.my_osid_object_form._my_map['choices'][inline_region]) == 0:
raise IllegalState('there are currently no choices defined for this region')
if self.get_choices_metadata().is_read_only():
... | python | def remove_choice_language(self, language_type, choice_id, inline_region):
"""stub"""
if len(self.my_osid_object_form._my_map['choices'][inline_region]) == 0:
raise IllegalState('there are currently no choices defined for this region')
if self.get_choices_metadata().is_read_only():
... | [
"def",
"remove_choice_language",
"(",
"self",
",",
"language_type",
",",
"choice_id",
",",
"inline_region",
")",
":",
"if",
"len",
"(",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'choices'",
"]",
"[",
"inline_region",
"]",
")",
"==",
"0",
":",... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L671-L686 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | MultiLanguageInlineChoiceQuestionFormRecord.add_choice | def add_choice(self, choice, inline_region, identifier=None, name=''):
"""stub"""
if inline_region not in self.my_osid_object_form._my_map['choices']:
raise IllegalState('that inline region does not exist. Please call add_inline_region first')
if identifier is None:
iden... | python | def add_choice(self, choice, inline_region, identifier=None, name=''):
"""stub"""
if inline_region not in self.my_osid_object_form._my_map['choices']:
raise IllegalState('that inline region does not exist. Please call add_inline_region first')
if identifier is None:
iden... | [
"def",
"add_choice",
"(",
"self",
",",
"choice",
",",
"inline_region",
",",
"identifier",
"=",
"None",
",",
"name",
"=",
"''",
")",
":",
"if",
"inline_region",
"not",
"in",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'choices'",
"]",
":",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L696-L716 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | MultiLanguageInlineChoiceQuestionFormRecord.edit_choice | def edit_choice(self, new_choice, choice_id, inline_region):
"""edit an existing choice, to keep the ID the same"""
if inline_region not in self.my_osid_object_form._my_map['choices']:
raise IllegalState('that inline region does not exist')
if not isinstance(new_choice, DisplayText):... | python | def edit_choice(self, new_choice, choice_id, inline_region):
"""edit an existing choice, to keep the ID the same"""
if inline_region not in self.my_osid_object_form._my_map['choices']:
raise IllegalState('that inline region does not exist')
if not isinstance(new_choice, DisplayText):... | [
"def",
"edit_choice",
"(",
"self",
",",
"new_choice",
",",
"choice_id",
",",
"inline_region",
")",
":",
"if",
"inline_region",
"not",
"in",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'choices'",
"]",
":",
"raise",
"IllegalState",
"(",
"'that inl... | edit an existing choice, to keep the ID the same | [
"edit",
"an",
"existing",
"choice",
"to",
"keep",
"the",
"ID",
"the",
"same"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L719-L735 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | MultiLanguageInlineChoiceQuestionRecord.get_choices | def get_choices(self):
"""stub"""
# ideally would return a displayText object in text ... except for legacy
# use cases like OEA, it expects a text string.
choices = {}
# for region_name, region_choices in self.my_osid_object.object_map['choices'].items():
for region_name... | python | def get_choices(self):
"""stub"""
# ideally would return a displayText object in text ... except for legacy
# use cases like OEA, it expects a text string.
choices = {}
# for region_name, region_choices in self.my_osid_object.object_map['choices'].items():
for region_name... | [
"def",
"get_choices",
"(",
"self",
")",
":",
"# ideally would return a displayText object in text ... except for legacy",
"# use cases like OEA, it expects a text string.",
"choices",
"=",
"{",
"}",
"# for region_name, region_choices in self.my_osid_object.object_map['choices'].items():",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L867-L884 |
mitsei/dlkit | dlkit/records/assessment/qti/inline_choice_records.py | InlineChoiceAnswerFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._inline_regions_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'inline_regions'),
'element_label': 'set of inline regions',... | python | def _init_metadata(self):
"""stub"""
self._inline_regions_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'inline_regions'),
'element_label': 'set of inline regions',... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_inline_regions_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
"_authority",
",",
"self",
".",
"my_osid_object_form",
".",
"_namespace",
",",
"'inline_re... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/inline_choice_records.py#L926-L967 |
ND-CSE-30151/tock | tock/syntax.py | parse_multiple | def parse_multiple(s, f, values=None):
"""Parse multiple comma-separated elements, each of which is parsed
using function f."""
if values is None: values = []
values.append(f(s))
if s.pos < len(s) and s.cur == ',':
s.pos += 1
return parse_multiple(s, f, values)
else:
r... | python | def parse_multiple(s, f, values=None):
"""Parse multiple comma-separated elements, each of which is parsed
using function f."""
if values is None: values = []
values.append(f(s))
if s.pos < len(s) and s.cur == ',':
s.pos += 1
return parse_multiple(s, f, values)
else:
r... | [
"def",
"parse_multiple",
"(",
"s",
",",
"f",
",",
"values",
"=",
"None",
")",
":",
"if",
"values",
"is",
"None",
":",
"values",
"=",
"[",
"]",
"values",
".",
"append",
"(",
"f",
"(",
"s",
")",
")",
"if",
"s",
".",
"pos",
"<",
"len",
"(",
"s",... | Parse multiple comma-separated elements, each of which is parsed
using function f. | [
"Parse",
"multiple",
"comma",
"-",
"separated",
"elements",
"each",
"of",
"which",
"is",
"parsed",
"using",
"function",
"f",
"."
] | train | https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/syntax.py#L85-L94 |
ND-CSE-30151/tock | tock/syntax.py | string_to_state | def string_to_state(s):
"""s is a string possibly preceded by > or @."""
s = lexer(s)
attrs = {}
while True:
if s.cur == '>':
attrs['start'] = True
s.pos += 1
elif s.cur == '@':
attrs['accept'] = True
s.pos += 1
else:
br... | python | def string_to_state(s):
"""s is a string possibly preceded by > or @."""
s = lexer(s)
attrs = {}
while True:
if s.cur == '>':
attrs['start'] = True
s.pos += 1
elif s.cur == '@':
attrs['accept'] = True
s.pos += 1
else:
br... | [
"def",
"string_to_state",
"(",
"s",
")",
":",
"s",
"=",
"lexer",
"(",
"s",
")",
"attrs",
"=",
"{",
"}",
"while",
"True",
":",
"if",
"s",
".",
"cur",
"==",
"'>'",
":",
"attrs",
"[",
"'start'",
"]",
"=",
"True",
"s",
".",
"pos",
"+=",
"1",
"eli... | s is a string possibly preceded by > or @. | [
"s",
"is",
"a",
"string",
"possibly",
"preceded",
"by",
">",
"or"
] | train | https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/syntax.py#L131-L146 |
ND-CSE-30151/tock | tock/syntax.py | string_to_config | def string_to_config(s):
"""s is a comma-separated list of stores."""
from .machines import Configuration
s = lexer(s)
x = parse_multiple(s, parse_store)
parse_end(s)
return Configuration(x) | python | def string_to_config(s):
"""s is a comma-separated list of stores."""
from .machines import Configuration
s = lexer(s)
x = parse_multiple(s, parse_store)
parse_end(s)
return Configuration(x) | [
"def",
"string_to_config",
"(",
"s",
")",
":",
"from",
".",
"machines",
"import",
"Configuration",
"s",
"=",
"lexer",
"(",
"s",
")",
"x",
"=",
"parse_multiple",
"(",
"s",
",",
"parse_store",
")",
"parse_end",
"(",
"s",
")",
"return",
"Configuration",
"("... | s is a comma-separated list of stores. | [
"s",
"is",
"a",
"comma",
"-",
"separated",
"list",
"of",
"stores",
"."
] | train | https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/syntax.py#L154-L160 |
ND-CSE-30151/tock | tock/syntax.py | string_to_configs | def string_to_configs(s):
"""s is a string in one of the following formats:
- x,y
- (x,y)
- {x,y}
- {(w,x),(y,z)}
In any case, returns a set of tuples of stores.
"""
s = lexer(s)
value = None
if s.pos == len(s):
value = set()
elif s.cur == '{':
... | python | def string_to_configs(s):
"""s is a string in one of the following formats:
- x,y
- (x,y)
- {x,y}
- {(w,x),(y,z)}
In any case, returns a set of tuples of stores.
"""
s = lexer(s)
value = None
if s.pos == len(s):
value = set()
elif s.cur == '{':
... | [
"def",
"string_to_configs",
"(",
"s",
")",
":",
"s",
"=",
"lexer",
"(",
"s",
")",
"value",
"=",
"None",
"if",
"s",
".",
"pos",
"==",
"len",
"(",
"s",
")",
":",
"value",
"=",
"set",
"(",
")",
"elif",
"s",
".",
"cur",
"==",
"'{'",
":",
"value",... | s is a string in one of the following formats:
- x,y
- (x,y)
- {x,y}
- {(w,x),(y,z)}
In any case, returns a set of tuples of stores. | [
"s",
"is",
"a",
"string",
"in",
"one",
"of",
"the",
"following",
"formats",
":",
"-",
"x",
"y",
"-",
"(",
"x",
"y",
")",
"-",
"{",
"x",
"y",
"}",
"-",
"{",
"(",
"w",
"x",
")",
"(",
"y",
"z",
")",
"}",
"In",
"any",
"case",
"returns",
"a",
... | train | https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/syntax.py#L162-L183 |
ND-CSE-30151/tock | tock/syntax.py | string_to_transition | def string_to_transition(s):
"""s is a string of the form a,b or a,b->c,d"""
from .machines import Transition
s = lexer(s)
lhs = parse_multiple(s, parse_store)
if s.pos < len(s) and s.cur == "->":
s.pos += 1
rhs = parse_multiple(s, parse_store)
else:
rhs = ()
parse_en... | python | def string_to_transition(s):
"""s is a string of the form a,b or a,b->c,d"""
from .machines import Transition
s = lexer(s)
lhs = parse_multiple(s, parse_store)
if s.pos < len(s) and s.cur == "->":
s.pos += 1
rhs = parse_multiple(s, parse_store)
else:
rhs = ()
parse_en... | [
"def",
"string_to_transition",
"(",
"s",
")",
":",
"from",
".",
"machines",
"import",
"Transition",
"s",
"=",
"lexer",
"(",
"s",
")",
"lhs",
"=",
"parse_multiple",
"(",
"s",
",",
"parse_store",
")",
"if",
"s",
".",
"pos",
"<",
"len",
"(",
"s",
")",
... | s is a string of the form a,b or a,b->c,d | [
"s",
"is",
"a",
"string",
"of",
"the",
"form",
"a",
"b",
"or",
"a",
"b",
"-",
">",
"c",
"d"
] | train | https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/syntax.py#L185-L196 |
theosysbio/means | src/means/inference/hypercube.py | hypercube | def hypercube(number_of_samples, variables):
"""
This implements Latin Hypercube Sampling.
See https://mathieu.fenniak.net/latin-hypercube-sampling/ for intuitive explanation of what it is
:param number_of_samples: number of segments/samples
:param variables: initial parameters and conditions (lis... | python | def hypercube(number_of_samples, variables):
"""
This implements Latin Hypercube Sampling.
See https://mathieu.fenniak.net/latin-hypercube-sampling/ for intuitive explanation of what it is
:param number_of_samples: number of segments/samples
:param variables: initial parameters and conditions (lis... | [
"def",
"hypercube",
"(",
"number_of_samples",
",",
"variables",
")",
":",
"number_of_dimensions",
"=",
"len",
"(",
"variables",
")",
"# Split range 0-1 into `nSeg` segments of equal size",
"segment_ranges",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"number_of_sam... | This implements Latin Hypercube Sampling.
See https://mathieu.fenniak.net/latin-hypercube-sampling/ for intuitive explanation of what it is
:param number_of_samples: number of segments/samples
:param variables: initial parameters and conditions (list of ranges, i.e. (70, 110), (0.1, 0.5) ..)
:return: | [
"This",
"implements",
"Latin",
"Hypercube",
"Sampling",
"."
] | train | https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/inference/hypercube.py#L3-L54 |
theosysbio/means | src/means/io/latex.py | LatexPrintableObject.output_latex | def output_latex(self, filename_or_file_handle):
"""
Output the file to a latex document
:param filename_or_file_handle: filename or already opened file handle to output to
:return:
"""
if isinstance(filename_or_file_handle, basestring):
file_handle = file(fi... | python | def output_latex(self, filename_or_file_handle):
"""
Output the file to a latex document
:param filename_or_file_handle: filename or already opened file handle to output to
:return:
"""
if isinstance(filename_or_file_handle, basestring):
file_handle = file(fi... | [
"def",
"output_latex",
"(",
"self",
",",
"filename_or_file_handle",
")",
":",
"if",
"isinstance",
"(",
"filename_or_file_handle",
",",
"basestring",
")",
":",
"file_handle",
"=",
"file",
"(",
"filename_or_file_handle",
",",
"'w'",
")",
"we_opened",
"=",
"True",
... | Output the file to a latex document
:param filename_or_file_handle: filename or already opened file handle to output to
:return: | [
"Output",
"the",
"file",
"to",
"a",
"latex",
"document",
":",
"param",
"filename_or_file_handle",
":",
"filename",
"or",
"already",
"opened",
"file",
"handle",
"to",
"output",
"to",
":",
"return",
":"
] | train | https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/io/latex.py#L18-L36 |
mitsei/dlkit | dlkit/records/assessment/qti/extended_text_interaction.py | QTIExtendedTextAnswerQuestionFormRecord._init_map | def _init_map(self):
"""stub"""
self.my_osid_object_form._my_map['maxStrings'] = \
self._max_strings_metadata['default_integer_values'][0]
self.my_osid_object_form._my_map['expectedLength'] = \
self._expected_length_metadata['default_integer_values'][0]
self.my_os... | python | def _init_map(self):
"""stub"""
self.my_osid_object_form._my_map['maxStrings'] = \
self._max_strings_metadata['default_integer_values'][0]
self.my_osid_object_form._my_map['expectedLength'] = \
self._expected_length_metadata['default_integer_values'][0]
self.my_os... | [
"def",
"_init_map",
"(",
"self",
")",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'maxStrings'",
"]",
"=",
"self",
".",
"_max_strings_metadata",
"[",
"'default_integer_values'",
"]",
"[",
"0",
"]",
"self",
".",
"my_osid_object_form",
".",
"_... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/extended_text_interaction.py#L29-L37 |
mitsei/dlkit | dlkit/records/assessment/qti/extended_text_interaction.py | QTIExtendedTextAnswerQuestionFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._max_strings_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'maxStrings'),
'element_label': 'maxStrings',
'inst... | python | def _init_metadata(self):
"""stub"""
self._max_strings_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'maxStrings'),
'element_label': 'maxStrings',
'inst... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_max_strings_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
"_authority",
",",
"self",
".",
"my_osid_object_form",
".",
"_namespace",
",",
"'maxStrings'"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/extended_text_interaction.py#L39-L92 |
mitsei/dlkit | dlkit/records/assessment/qti/extended_text_interaction.py | QTIExtendedTextAnswerQuestionFormRecord.set_max_strings | def set_max_strings(self, max_strings):
"""stub"""
if not self.my_osid_object_form._is_valid_integer(
max_strings, self.get_max_strings_metadata()):
raise InvalidArgument('maxStrings')
self.my_osid_object_form._my_map['maxStrings'] = max_strings | python | def set_max_strings(self, max_strings):
"""stub"""
if not self.my_osid_object_form._is_valid_integer(
max_strings, self.get_max_strings_metadata()):
raise InvalidArgument('maxStrings')
self.my_osid_object_form._my_map['maxStrings'] = max_strings | [
"def",
"set_max_strings",
"(",
"self",
",",
"max_strings",
")",
":",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_integer",
"(",
"max_strings",
",",
"self",
".",
"get_max_strings_metadata",
"(",
")",
")",
":",
"raise",
"InvalidArgument",
"(",... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/extended_text_interaction.py#L106-L111 |
mitsei/dlkit | dlkit/records/assessment/qti/extended_text_interaction.py | QTIExtendedTextAnswerQuestionFormRecord.set_expected_length | def set_expected_length(self, expected_length):
"""stub"""
if not self.my_osid_object_form._is_valid_integer(
expected_length, self.get_expected_length_metadata()):
raise InvalidArgument('expectedLength')
self.my_osid_object_form._my_map['expectedLength'] = expected_l... | python | def set_expected_length(self, expected_length):
"""stub"""
if not self.my_osid_object_form._is_valid_integer(
expected_length, self.get_expected_length_metadata()):
raise InvalidArgument('expectedLength')
self.my_osid_object_form._my_map['expectedLength'] = expected_l... | [
"def",
"set_expected_length",
"(",
"self",
",",
"expected_length",
")",
":",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_integer",
"(",
"expected_length",
",",
"self",
".",
"get_expected_length_metadata",
"(",
")",
")",
":",
"raise",
"InvalidA... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/extended_text_interaction.py#L118-L123 |
mitsei/dlkit | dlkit/records/assessment/qti/extended_text_interaction.py | QTIExtendedTextAnswerQuestionFormRecord.set_expected_lines | def set_expected_lines(self, expected_lines):
"""stub"""
if not self.my_osid_object_form._is_valid_integer(
expected_lines, self.get_expected_lines_metadata()):
raise InvalidArgument('expectedLines')
self.my_osid_object_form._my_map['expectedLines'] = expected_lines | python | def set_expected_lines(self, expected_lines):
"""stub"""
if not self.my_osid_object_form._is_valid_integer(
expected_lines, self.get_expected_lines_metadata()):
raise InvalidArgument('expectedLines')
self.my_osid_object_form._my_map['expectedLines'] = expected_lines | [
"def",
"set_expected_lines",
"(",
"self",
",",
"expected_lines",
")",
":",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_integer",
"(",
"expected_lines",
",",
"self",
".",
"get_expected_lines_metadata",
"(",
")",
")",
":",
"raise",
"InvalidArgum... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/qti/extended_text_interaction.py#L130-L135 |
delfick/harpoon | harpoon/option_spec/task_objs.py | Task.run | def run(self, collector, image, available_actions, tasks, **extras):
"""Run this task"""
task_func = available_actions[self.action]
configuration = collector.configuration.wrapped()
if self.options:
if image:
configuration.update({"images": {image: self.optio... | python | def run(self, collector, image, available_actions, tasks, **extras):
"""Run this task"""
task_func = available_actions[self.action]
configuration = collector.configuration.wrapped()
if self.options:
if image:
configuration.update({"images": {image: self.optio... | [
"def",
"run",
"(",
"self",
",",
"collector",
",",
"image",
",",
"available_actions",
",",
"tasks",
",",
"*",
"*",
"extras",
")",
":",
"task_func",
"=",
"available_actions",
"[",
"self",
".",
"action",
"]",
"configuration",
"=",
"collector",
".",
"configura... | Run this task | [
"Run",
"this",
"task"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/option_spec/task_objs.py#L42-L75 |
delfick/harpoon | harpoon/option_spec/task_objs.py | Task.find_image | def find_image(self, image, configuration):
"""Complain if we don't have an image"""
images = configuration["images"]
available = list(images.keys())
if not image:
info = {}
if available:
info["available"] = available
raise BadOption("... | python | def find_image(self, image, configuration):
"""Complain if we don't have an image"""
images = configuration["images"]
available = list(images.keys())
if not image:
info = {}
if available:
info["available"] = available
raise BadOption("... | [
"def",
"find_image",
"(",
"self",
",",
"image",
",",
"configuration",
")",
":",
"images",
"=",
"configuration",
"[",
"\"images\"",
"]",
"available",
"=",
"list",
"(",
"images",
".",
"keys",
"(",
")",
")",
"if",
"not",
"image",
":",
"info",
"=",
"{",
... | Complain if we don't have an image | [
"Complain",
"if",
"we",
"don",
"t",
"have",
"an",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/option_spec/task_objs.py#L77-L89 |
OpenAgInitiative/openag_python | openag/cli/utils.py | replicate_global_dbs | def replicate_global_dbs(cloud_url=None, local_url=None):
"""
Set up replication of the global databases from the cloud server to the
local server.
:param str cloud_url: Used to override the cloud url from the global
configuration in case the calling function is in the process of
initializing t... | python | def replicate_global_dbs(cloud_url=None, local_url=None):
"""
Set up replication of the global databases from the cloud server to the
local server.
:param str cloud_url: Used to override the cloud url from the global
configuration in case the calling function is in the process of
initializing t... | [
"def",
"replicate_global_dbs",
"(",
"cloud_url",
"=",
"None",
",",
"local_url",
"=",
"None",
")",
":",
"local_url",
"=",
"local_url",
"or",
"config",
"[",
"\"local_server\"",
"]",
"[",
"\"url\"",
"]",
"cloud_url",
"=",
"cloud_url",
"or",
"config",
"[",
"\"cl... | Set up replication of the global databases from the cloud server to the
local server.
:param str cloud_url: Used to override the cloud url from the global
configuration in case the calling function is in the process of
initializing the cloud server
:param str local_url: Used to override the local u... | [
"Set",
"up",
"replication",
"of",
"the",
"global",
"databases",
"from",
"the",
"cloud",
"server",
"to",
"the",
"local",
"server",
"."
] | train | https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/utils.py#L52-L70 |
OpenAgInitiative/openag_python | openag/cli/utils.py | cancel_global_db_replication | def cancel_global_db_replication():
"""
Cancel replication of the global databases from the cloud server to the
local server.
"""
local_url = config["local_server"]["url"]
server = Server(local_url)
for db_name in global_dbs:
server.cancel_replication(db_name) | python | def cancel_global_db_replication():
"""
Cancel replication of the global databases from the cloud server to the
local server.
"""
local_url = config["local_server"]["url"]
server = Server(local_url)
for db_name in global_dbs:
server.cancel_replication(db_name) | [
"def",
"cancel_global_db_replication",
"(",
")",
":",
"local_url",
"=",
"config",
"[",
"\"local_server\"",
"]",
"[",
"\"url\"",
"]",
"server",
"=",
"Server",
"(",
"local_url",
")",
"for",
"db_name",
"in",
"global_dbs",
":",
"server",
".",
"cancel_replication",
... | Cancel replication of the global databases from the cloud server to the
local server. | [
"Cancel",
"replication",
"of",
"the",
"global",
"databases",
"from",
"the",
"cloud",
"server",
"to",
"the",
"local",
"server",
"."
] | train | https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/utils.py#L72-L80 |
OpenAgInitiative/openag_python | openag/cli/utils.py | replicate_per_farm_dbs | def replicate_per_farm_dbs(cloud_url=None, local_url=None, farm_name=None):
"""
Sete up replication of the per-farm databases from the local server to the
cloud server.
:param str cloud_url: Used to override the cloud url from the global
configuration in case the calling function is in the process ... | python | def replicate_per_farm_dbs(cloud_url=None, local_url=None, farm_name=None):
"""
Sete up replication of the per-farm databases from the local server to the
cloud server.
:param str cloud_url: Used to override the cloud url from the global
configuration in case the calling function is in the process ... | [
"def",
"replicate_per_farm_dbs",
"(",
"cloud_url",
"=",
"None",
",",
"local_url",
"=",
"None",
",",
"farm_name",
"=",
"None",
")",
":",
"cloud_url",
"=",
"cloud_url",
"or",
"config",
"[",
"\"cloud_server\"",
"]",
"[",
"\"url\"",
"]",
"local_url",
"=",
"local... | Sete up replication of the per-farm databases from the local server to the
cloud server.
:param str cloud_url: Used to override the cloud url from the global
configuration in case the calling function is in the process of
initializing the cloud server
:param str local_url: Used to override the loca... | [
"Sete",
"up",
"replication",
"of",
"the",
"per",
"-",
"farm",
"databases",
"from",
"the",
"local",
"server",
"to",
"the",
"cloud",
"server",
"."
] | train | https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/utils.py#L82-L121 |
OpenAgInitiative/openag_python | openag/cli/utils.py | cancel_per_farm_db_replication | def cancel_per_farm_db_replication():
"""
Cancel replication of the per-farm databases from the local server to the
cloud server.
"""
cloud_url = config["cloud_server"]["url"]
local_url = config["local_server"]["url"]
server = Server(local_url)
for db_name in per_farm_dbs:
server... | python | def cancel_per_farm_db_replication():
"""
Cancel replication of the per-farm databases from the local server to the
cloud server.
"""
cloud_url = config["cloud_server"]["url"]
local_url = config["local_server"]["url"]
server = Server(local_url)
for db_name in per_farm_dbs:
server... | [
"def",
"cancel_per_farm_db_replication",
"(",
")",
":",
"cloud_url",
"=",
"config",
"[",
"\"cloud_server\"",
"]",
"[",
"\"url\"",
"]",
"local_url",
"=",
"config",
"[",
"\"local_server\"",
"]",
"[",
"\"url\"",
"]",
"server",
"=",
"Server",
"(",
"local_url",
")"... | Cancel replication of the per-farm databases from the local server to the
cloud server. | [
"Cancel",
"replication",
"of",
"the",
"per",
"-",
"farm",
"databases",
"from",
"the",
"local",
"server",
"to",
"the",
"cloud",
"server",
"."
] | train | https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/utils.py#L123-L132 |
python-odin/odinweb | odinweb/cors.py | CORS._register_options | def _register_options(self, api_interface):
# type: (ApiInterfaceBase) -> None
"""
Register CORS options endpoints.
"""
op_paths = api_interface.op_paths(collate_methods=True)
for path, operations in op_paths.items():
if api.Method.OPTIONS not in operations:
... | python | def _register_options(self, api_interface):
# type: (ApiInterfaceBase) -> None
"""
Register CORS options endpoints.
"""
op_paths = api_interface.op_paths(collate_methods=True)
for path, operations in op_paths.items():
if api.Method.OPTIONS not in operations:
... | [
"def",
"_register_options",
"(",
"self",
",",
"api_interface",
")",
":",
"# type: (ApiInterfaceBase) -> None",
"op_paths",
"=",
"api_interface",
".",
"op_paths",
"(",
"collate_methods",
"=",
"True",
")",
"for",
"path",
",",
"operations",
"in",
"op_paths",
".",
"it... | Register CORS options endpoints. | [
"Register",
"CORS",
"options",
"endpoints",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L74-L82 |
python-odin/odinweb | odinweb/cors.py | CORS.cors_options | def cors_options(self, request, **_):
"""
CORS options response method.
Broken out if this needs to be customised.
"""
return create_response(
request,
headers=self.pre_flight_headers(request, request.supported_methods)
) | python | def cors_options(self, request, **_):
"""
CORS options response method.
Broken out if this needs to be customised.
"""
return create_response(
request,
headers=self.pre_flight_headers(request, request.supported_methods)
) | [
"def",
"cors_options",
"(",
"self",
",",
"request",
",",
"*",
"*",
"_",
")",
":",
"return",
"create_response",
"(",
"request",
",",
"headers",
"=",
"self",
".",
"pre_flight_headers",
"(",
"request",
",",
"request",
".",
"supported_methods",
")",
")"
] | CORS options response method.
Broken out if this needs to be customised. | [
"CORS",
"options",
"response",
"method",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L84-L94 |
python-odin/odinweb | odinweb/cors.py | CORS._options_operation | def _options_operation(self, api_interface, path, methods):
# type: (ApiInterfaceBase, UrlPath, List[api.Method]) -> None
"""
Generate an options operation for the specified path
"""
# Trim off path prefix.
if path.startswith(api_interface.path_prefix):
path =... | python | def _options_operation(self, api_interface, path, methods):
# type: (ApiInterfaceBase, UrlPath, List[api.Method]) -> None
"""
Generate an options operation for the specified path
"""
# Trim off path prefix.
if path.startswith(api_interface.path_prefix):
path =... | [
"def",
"_options_operation",
"(",
"self",
",",
"api_interface",
",",
"path",
",",
"methods",
")",
":",
"# type: (ApiInterfaceBase, UrlPath, List[api.Method]) -> None",
"# Trim off path prefix.",
"if",
"path",
".",
"startswith",
"(",
"api_interface",
".",
"path_prefix",
")... | Generate an options operation for the specified path | [
"Generate",
"an",
"options",
"operation",
"for",
"the",
"specified",
"path"
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L96-L112 |
python-odin/odinweb | odinweb/cors.py | CORS.allow_origin | def allow_origin(self, request):
# type: (BaseHttpRequest) -> str
"""
Generate allow origin header
"""
origins = self.origins
if origins is AnyOrigin:
return '*'
else:
origin = request.origin
return origin if origin in origins e... | python | def allow_origin(self, request):
# type: (BaseHttpRequest) -> str
"""
Generate allow origin header
"""
origins = self.origins
if origins is AnyOrigin:
return '*'
else:
origin = request.origin
return origin if origin in origins e... | [
"def",
"allow_origin",
"(",
"self",
",",
"request",
")",
":",
"# type: (BaseHttpRequest) -> str",
"origins",
"=",
"self",
".",
"origins",
"if",
"origins",
"is",
"AnyOrigin",
":",
"return",
"'*'",
"else",
":",
"origin",
"=",
"request",
".",
"origin",
"return",
... | Generate allow origin header | [
"Generate",
"allow",
"origin",
"header"
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L114-L124 |
python-odin/odinweb | odinweb/cors.py | CORS.pre_flight_headers | def pre_flight_headers(self, request, methods):
# type: (BaseHttpRequest, Sequence[api.Method]) -> Dict[str, str]
"""
Generate pre-flight headers.
"""
methods = ', '.join(m.value for m in methods)
headers = {
'Allow': methods,
'Cache-Control': 'no-... | python | def pre_flight_headers(self, request, methods):
# type: (BaseHttpRequest, Sequence[api.Method]) -> Dict[str, str]
"""
Generate pre-flight headers.
"""
methods = ', '.join(m.value for m in methods)
headers = {
'Allow': methods,
'Cache-Control': 'no-... | [
"def",
"pre_flight_headers",
"(",
"self",
",",
"request",
",",
"methods",
")",
":",
"# type: (BaseHttpRequest, Sequence[api.Method]) -> Dict[str, str]",
"methods",
"=",
"', '",
".",
"join",
"(",
"m",
".",
"value",
"for",
"m",
"in",
"methods",
")",
"headers",
"=",
... | Generate pre-flight headers. | [
"Generate",
"pre",
"-",
"flight",
"headers",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L126-L148 |
python-odin/odinweb | odinweb/cors.py | CORS.request_headers | def request_headers(self, request):
"""
Generate standard request headers
"""
headers = {}
allow_origin = self.allow_origin(request)
if allow_origin:
headers = dict_filter({
'Access-Control-Allow-Origin': allow_origin,
'Access-... | python | def request_headers(self, request):
"""
Generate standard request headers
"""
headers = {}
allow_origin = self.allow_origin(request)
if allow_origin:
headers = dict_filter({
'Access-Control-Allow-Origin': allow_origin,
'Access-... | [
"def",
"request_headers",
"(",
"self",
",",
"request",
")",
":",
"headers",
"=",
"{",
"}",
"allow_origin",
"=",
"self",
".",
"allow_origin",
"(",
"request",
")",
"if",
"allow_origin",
":",
"headers",
"=",
"dict_filter",
"(",
"{",
"'Access-Control-Allow-Origin'... | Generate standard request headers | [
"Generate",
"standard",
"request",
"headers"
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L150-L164 |
python-odin/odinweb | odinweb/cors.py | CORS.post_request | def post_request(self, request, response):
# type: (BaseHttpRequest, HttpResponse) -> HttpResponse
"""
Post-request hook to allow CORS headers to responses.
"""
if request.method != api.Method.OPTIONS:
response.headers.update(self.request_headers(request))
ret... | python | def post_request(self, request, response):
# type: (BaseHttpRequest, HttpResponse) -> HttpResponse
"""
Post-request hook to allow CORS headers to responses.
"""
if request.method != api.Method.OPTIONS:
response.headers.update(self.request_headers(request))
ret... | [
"def",
"post_request",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"# type: (BaseHttpRequest, HttpResponse) -> HttpResponse",
"if",
"request",
".",
"method",
"!=",
"api",
".",
"Method",
".",
"OPTIONS",
":",
"response",
".",
"headers",
".",
"update",
... | Post-request hook to allow CORS headers to responses. | [
"Post",
"-",
"request",
"hook",
"to",
"allow",
"CORS",
"headers",
"to",
"responses",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/cors.py#L166-L173 |
nrcharles/caelum | caelum/eere.py | _muck_w_date | def _muck_w_date(record):
"""muck with the date because EPW starts counting from 1 and goes to 24."""
# minute 60 is actually minute 0?
temp_d = datetime.datetime(int(record['Year']), int(record['Month']),
int(record['Day']), int(record['Hour']) % 24,
... | python | def _muck_w_date(record):
"""muck with the date because EPW starts counting from 1 and goes to 24."""
# minute 60 is actually minute 0?
temp_d = datetime.datetime(int(record['Year']), int(record['Month']),
int(record['Day']), int(record['Hour']) % 24,
... | [
"def",
"_muck_w_date",
"(",
"record",
")",
":",
"# minute 60 is actually minute 0?",
"temp_d",
"=",
"datetime",
".",
"datetime",
"(",
"int",
"(",
"record",
"[",
"'Year'",
"]",
")",
",",
"int",
"(",
"record",
"[",
"'Month'",
"]",
")",
",",
"int",
"(",
"re... | muck with the date because EPW starts counting from 1 and goes to 24. | [
"muck",
"with",
"the",
"date",
"because",
"EPW",
"starts",
"counting",
"from",
"1",
"and",
"goes",
"to",
"24",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/eere.py#L57-L66 |
nrcharles/caelum | caelum/eere.py | _station_info | def _station_info(station_code):
"""filename based meta data for a station code."""
url_file = open(env.SRC_PATH + '/eere.csv')
for line in csv.DictReader(url_file):
if line['station_code'] == station_code:
return line
raise KeyError('Station not found') | python | def _station_info(station_code):
"""filename based meta data for a station code."""
url_file = open(env.SRC_PATH + '/eere.csv')
for line in csv.DictReader(url_file):
if line['station_code'] == station_code:
return line
raise KeyError('Station not found') | [
"def",
"_station_info",
"(",
"station_code",
")",
":",
"url_file",
"=",
"open",
"(",
"env",
".",
"SRC_PATH",
"+",
"'/eere.csv'",
")",
"for",
"line",
"in",
"csv",
".",
"DictReader",
"(",
"url_file",
")",
":",
"if",
"line",
"[",
"'station_code'",
"]",
"=="... | filename based meta data for a station code. | [
"filename",
"based",
"meta",
"data",
"for",
"a",
"station",
"code",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/eere.py#L75-L81 |
nrcharles/caelum | caelum/eere.py | _basename | def _basename(station_code, fmt=None):
"""region, country, weather_station, station_code, data_format, url."""
info = _station_info(station_code)
if not fmt:
fmt = info['data_format']
basename = '%s.%s' % (info['url'].rsplit('/', 1)[1].rsplit('.', 1)[0],
DATA_EXTENTIONS... | python | def _basename(station_code, fmt=None):
"""region, country, weather_station, station_code, data_format, url."""
info = _station_info(station_code)
if not fmt:
fmt = info['data_format']
basename = '%s.%s' % (info['url'].rsplit('/', 1)[1].rsplit('.', 1)[0],
DATA_EXTENTIONS... | [
"def",
"_basename",
"(",
"station_code",
",",
"fmt",
"=",
"None",
")",
":",
"info",
"=",
"_station_info",
"(",
"station_code",
")",
"if",
"not",
"fmt",
":",
"fmt",
"=",
"info",
"[",
"'data_format'",
"]",
"basename",
"=",
"'%s.%s'",
"%",
"(",
"info",
"[... | region, country, weather_station, station_code, data_format, url. | [
"region",
"country",
"weather_station",
"station_code",
"data_format",
"url",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/eere.py#L84-L91 |
nrcharles/caelum | caelum/eere.py | twopercent | def twopercent(station_code):
"""Two percent high design temperature for a location.
Degrees in Celcius
Args:
station_code (str): Weather Station Code
Returns:
float degrees Celcius
"""
# (DB=>MWB) 2%, MaxDB=
temp = None
try:
fin = open('%s/%s' % (env.WEATHER_D... | python | def twopercent(station_code):
"""Two percent high design temperature for a location.
Degrees in Celcius
Args:
station_code (str): Weather Station Code
Returns:
float degrees Celcius
"""
# (DB=>MWB) 2%, MaxDB=
temp = None
try:
fin = open('%s/%s' % (env.WEATHER_D... | [
"def",
"twopercent",
"(",
"station_code",
")",
":",
"# (DB=>MWB) 2%, MaxDB=",
"temp",
"=",
"None",
"try",
":",
"fin",
"=",
"open",
"(",
"'%s/%s'",
"%",
"(",
"env",
".",
"WEATHER_DATA_PATH",
",",
"_basename",
"(",
"station_code",
",",
"'ddy'",
")",
")",
")"... | Two percent high design temperature for a location.
Degrees in Celcius
Args:
station_code (str): Weather Station Code
Returns:
float degrees Celcius | [
"Two",
"percent",
"high",
"design",
"temperature",
"for",
"a",
"location",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/eere.py#L94-L136 |
nrcharles/caelum | caelum/eere.py | minimum | def minimum(station_code):
"""Extreme Minimum Design Temperature for a location.
Degrees in Celcius
Args:
station_code (str): Weather Station Code
Returns:
float degrees Celcius
"""
temp = None
fin = None
try:
fin = open('%s/%s' % (env.WEATHER_DATA_PATH,
... | python | def minimum(station_code):
"""Extreme Minimum Design Temperature for a location.
Degrees in Celcius
Args:
station_code (str): Weather Station Code
Returns:
float degrees Celcius
"""
temp = None
fin = None
try:
fin = open('%s/%s' % (env.WEATHER_DATA_PATH,
... | [
"def",
"minimum",
"(",
"station_code",
")",
":",
"temp",
"=",
"None",
"fin",
"=",
"None",
"try",
":",
"fin",
"=",
"open",
"(",
"'%s/%s'",
"%",
"(",
"env",
".",
"WEATHER_DATA_PATH",
",",
"_basename",
"(",
"station_code",
",",
"'ddy'",
")",
")",
")",
"... | Extreme Minimum Design Temperature for a location.
Degrees in Celcius
Args:
station_code (str): Weather Station Code
Returns:
float degrees Celcius | [
"Extreme",
"Minimum",
"Design",
"Temperature",
"for",
"a",
"location",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/eere.py#L139-L176 |
nrcharles/caelum | caelum/eere.py | EPWdata.next | def next(self):
"""Weather data record.
Yields:
dict
"""
record = self.epw_data.next()
local_time = _muck_w_date(record)
record['datetime'] = local_time
# does this fix a specific data set or a general issue?
if self.DST:
localdt =... | python | def next(self):
"""Weather data record.
Yields:
dict
"""
record = self.epw_data.next()
local_time = _muck_w_date(record)
record['datetime'] = local_time
# does this fix a specific data set or a general issue?
if self.DST:
localdt =... | [
"def",
"next",
"(",
"self",
")",
":",
"record",
"=",
"self",
".",
"epw_data",
".",
"next",
"(",
")",
"local_time",
"=",
"_muck_w_date",
"(",
"record",
")",
"record",
"[",
"'datetime'",
"]",
"=",
"local_time",
"# does this fix a specific data set or a general iss... | Weather data record.
Yields:
dict | [
"Weather",
"data",
"record",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/eere.py#L239-L256 |
cloudnull/cloudlib | cloudlib/utils.py | ensure_string | def ensure_string(obj):
"""Return String and if Unicode convert to string.
:param obj: ``str`` || ``unicode``
:return: ``str``
"""
if sys.version_info < (3, 2, 0) and isinstance(obj, unicode):
return str(obj.encode('utf8'))
else:
return obj | python | def ensure_string(obj):
"""Return String and if Unicode convert to string.
:param obj: ``str`` || ``unicode``
:return: ``str``
"""
if sys.version_info < (3, 2, 0) and isinstance(obj, unicode):
return str(obj.encode('utf8'))
else:
return obj | [
"def",
"ensure_string",
"(",
"obj",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"2",
",",
"0",
")",
"and",
"isinstance",
"(",
"obj",
",",
"unicode",
")",
":",
"return",
"str",
"(",
"obj",
".",
"encode",
"(",
"'utf8'",
")",
")"... | Return String and if Unicode convert to string.
:param obj: ``str`` || ``unicode``
:return: ``str`` | [
"Return",
"String",
"and",
"if",
"Unicode",
"convert",
"to",
"string",
"."
] | train | https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/utils.py#L52-L62 |
cloudnull/cloudlib | cloudlib/utils.py | dict_update | def dict_update(base_dict, update_dict):
"""Return an updated dictionary.
If ``update_dict`` is a dictionary it will be used to update the `
`base_dict`` which is then returned.
:param request_kwargs: ``dict``
:param kwargs: ``dict``
:return: ``dict``
"""
if isinstance(update_dict, dic... | python | def dict_update(base_dict, update_dict):
"""Return an updated dictionary.
If ``update_dict`` is a dictionary it will be used to update the `
`base_dict`` which is then returned.
:param request_kwargs: ``dict``
:param kwargs: ``dict``
:return: ``dict``
"""
if isinstance(update_dict, dic... | [
"def",
"dict_update",
"(",
"base_dict",
",",
"update_dict",
")",
":",
"if",
"isinstance",
"(",
"update_dict",
",",
"dict",
")",
":",
"base_dict",
".",
"update",
"(",
"update_dict",
")",
"return",
"base_dict"
] | Return an updated dictionary.
If ``update_dict`` is a dictionary it will be used to update the `
`base_dict`` which is then returned.
:param request_kwargs: ``dict``
:param kwargs: ``dict``
:return: ``dict`` | [
"Return",
"an",
"updated",
"dictionary",
"."
] | train | https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/utils.py#L65-L78 |
python-odin/odinweb | odinweb/containers.py | ResourceApi.op_paths | def op_paths(self, path_base):
# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]
"""
Return all operations stored in containers.
"""
path_base += self.path_prefix
for operation in self._operations:
for op_path in operation.op_paths(path_ba... | python | def op_paths(self, path_base):
# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]
"""
Return all operations stored in containers.
"""
path_base += self.path_prefix
for operation in self._operations:
for op_path in operation.op_paths(path_ba... | [
"def",
"op_paths",
"(",
"self",
",",
"path_base",
")",
":",
"# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]",
"path_base",
"+=",
"self",
".",
"path_prefix",
"for",
"operation",
"in",
"self",
".",
"_operations",
":",
"for",
"op_path",
"in",
"oper... | Return all operations stored in containers. | [
"Return",
"all",
"operations",
"stored",
"in",
"containers",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L131-L140 |
python-odin/odinweb | odinweb/containers.py | ApiContainer.operation | def operation(self, path, methods=Method.GET, resource=None, tags=None, summary=None, middleware=None):
# type: (UrlPath, Union[Method, Tuple[Method]], Type[Resource], Tags, str, list) -> Operation
"""
:param path: A sub path that can be used as a action.
:param methods: HTTP method(s) t... | python | def operation(self, path, methods=Method.GET, resource=None, tags=None, summary=None, middleware=None):
# type: (UrlPath, Union[Method, Tuple[Method]], Type[Resource], Tags, str, list) -> Operation
"""
:param path: A sub path that can be used as a action.
:param methods: HTTP method(s) t... | [
"def",
"operation",
"(",
"self",
",",
"path",
",",
"methods",
"=",
"Method",
".",
"GET",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"None",
",",
"middleware",
"=",
"None",
")",
":",
"# type: (UrlPath, Union[Method, Tuple[M... | :param path: A sub path that can be used as a action.
:param methods: HTTP method(s) this function responses to.
:param resource: Specify the resource that this function encodes/decodes,
default is the one specified on the ResourceAPI instance.
:param tags: Tags to be applied to oper... | [
":",
"param",
"path",
":",
"A",
"sub",
"path",
"that",
"can",
"be",
"used",
"as",
"a",
"action",
".",
":",
"param",
"methods",
":",
"HTTP",
"method",
"(",
"s",
")",
"this",
"function",
"responses",
"to",
".",
":",
"param",
"resource",
":",
"Specify",... | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L175-L191 |
python-odin/odinweb | odinweb/containers.py | ApiContainer.op_paths | def op_paths(self, path_base=None):
# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]
"""
Return all operations stored in containers.
"""
if path_base:
path_base += self.path_prefix
else:
path_base = self.path_prefix or UrlPath(... | python | def op_paths(self, path_base=None):
# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]
"""
Return all operations stored in containers.
"""
if path_base:
path_base += self.path_prefix
else:
path_base = self.path_prefix or UrlPath(... | [
"def",
"op_paths",
"(",
"self",
",",
"path_base",
"=",
"None",
")",
":",
"# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]",
"if",
"path_base",
":",
"path_base",
"+=",
"self",
".",
"path_prefix",
"else",
":",
"path_base",
"=",
"self",
".",
"path... | Return all operations stored in containers. | [
"Return",
"all",
"operations",
"stored",
"in",
"containers",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L193-L205 |
python-odin/odinweb | odinweb/containers.py | ApiInterfaceBase.handle_500 | def handle_500(self, request, exception):
# type: (BaseHttpRequest, BaseException) -> Resource
"""
Handle an *un-handled* exception.
"""
# Let middleware attempt to handle exception
try:
for middleware in self.middleware.handle_500:
resource = ... | python | def handle_500(self, request, exception):
# type: (BaseHttpRequest, BaseException) -> Resource
"""
Handle an *un-handled* exception.
"""
# Let middleware attempt to handle exception
try:
for middleware in self.middleware.handle_500:
resource = ... | [
"def",
"handle_500",
"(",
"self",
",",
"request",
",",
"exception",
")",
":",
"# type: (BaseHttpRequest, BaseException) -> Resource",
"# Let middleware attempt to handle exception",
"try",
":",
"for",
"middleware",
"in",
"self",
".",
"middleware",
".",
"handle_500",
":",
... | Handle an *un-handled* exception. | [
"Handle",
"an",
"*",
"un",
"-",
"handled",
"*",
"exception",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L275-L296 |
python-odin/odinweb | odinweb/containers.py | ApiInterfaceBase.dispatch_operation | def dispatch_operation(self, operation, request, path_args):
# type: (Operation, BaseHttpRequest, Dict[str, Any]) -> Tuple[Any, Optional[HTTPStatus], Optional[dict]]
"""
Dispatch and handle exceptions from operation.
"""
try:
# path_args is passed by ref so changes ca... | python | def dispatch_operation(self, operation, request, path_args):
# type: (Operation, BaseHttpRequest, Dict[str, Any]) -> Tuple[Any, Optional[HTTPStatus], Optional[dict]]
"""
Dispatch and handle exceptions from operation.
"""
try:
# path_args is passed by ref so changes ca... | [
"def",
"dispatch_operation",
"(",
"self",
",",
"operation",
",",
"request",
",",
"path_args",
")",
":",
"# type: (Operation, BaseHttpRequest, Dict[str, Any]) -> Tuple[Any, Optional[HTTPStatus], Optional[dict]]",
"try",
":",
"# path_args is passed by ref so changes can be made.",
"for... | Dispatch and handle exceptions from operation. | [
"Dispatch",
"and",
"handle",
"exceptions",
"from",
"operation",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L298-L345 |
python-odin/odinweb | odinweb/containers.py | ApiInterfaceBase._dispatch | def _dispatch(self, operation, request, path_args):
"""
Wrapped dispatch method, prepare request and generate a HTTP Response.
"""
# Determine the request and response types. Ensure API supports the requested types
request_type = resolve_content_type(self.request_type_resolvers, ... | python | def _dispatch(self, operation, request, path_args):
"""
Wrapped dispatch method, prepare request and generate a HTTP Response.
"""
# Determine the request and response types. Ensure API supports the requested types
request_type = resolve_content_type(self.request_type_resolvers, ... | [
"def",
"_dispatch",
"(",
"self",
",",
"operation",
",",
"request",
",",
"path_args",
")",
":",
"# Determine the request and response types. Ensure API supports the requested types",
"request_type",
"=",
"resolve_content_type",
"(",
"self",
".",
"request_type_resolvers",
",",
... | Wrapped dispatch method, prepare request and generate a HTTP Response. | [
"Wrapped",
"dispatch",
"method",
"prepare",
"request",
"and",
"generate",
"a",
"HTTP",
"Response",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L347-L384 |
python-odin/odinweb | odinweb/containers.py | ApiInterfaceBase.dispatch | def dispatch(self, operation, request, **path_args):
"""
Dispatch incoming request and capture top level exceptions.
"""
# Add current operation to the request (for convenience in middleware methods)
request.current_operation = operation
try:
for middleware i... | python | def dispatch(self, operation, request, **path_args):
"""
Dispatch incoming request and capture top level exceptions.
"""
# Add current operation to the request (for convenience in middleware methods)
request.current_operation = operation
try:
for middleware i... | [
"def",
"dispatch",
"(",
"self",
",",
"operation",
",",
"request",
",",
"*",
"*",
"path_args",
")",
":",
"# Add current operation to the request (for convenience in middleware methods)",
"request",
".",
"current_operation",
"=",
"operation",
"try",
":",
"for",
"middlewar... | Dispatch incoming request and capture top level exceptions. | [
"Dispatch",
"incoming",
"request",
"and",
"capture",
"top",
"level",
"exceptions",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L386-L415 |
python-odin/odinweb | odinweb/containers.py | ApiInterfaceBase.op_paths | def op_paths(self, path_base=None, collate_methods=False):
# type: (Union[str, UrlPath], bool) -> Union[Generator[Tuple[UrlPath, Operation]], Dict[UrlPath, Operation]]
"""
Return all operations stored in containers.
Use the `collate_methods` option to collate methods by path. This is re... | python | def op_paths(self, path_base=None, collate_methods=False):
# type: (Union[str, UrlPath], bool) -> Union[Generator[Tuple[UrlPath, Operation]], Dict[UrlPath, Operation]]
"""
Return all operations stored in containers.
Use the `collate_methods` option to collate methods by path. This is re... | [
"def",
"op_paths",
"(",
"self",
",",
"path_base",
"=",
"None",
",",
"collate_methods",
"=",
"False",
")",
":",
"# type: (Union[str, UrlPath], bool) -> Union[Generator[Tuple[UrlPath, Operation]], Dict[UrlPath, Operation]]",
"op_paths",
"=",
"super",
"(",
"ApiInterfaceBase",
",... | Return all operations stored in containers.
Use the `collate_methods` option to collate methods by path. This is required for
certain web frameworks (eg Django) where it is up the developer to handle routing
of request method. | [
"Return",
"all",
"operations",
"stored",
"in",
"containers",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L417-L439 |
rembish/cfb | cfb/directory/entry.py | Entry.sector_size | def sector_size(self):
"""
Property with current sector size. CFB file can store normal sectors
and smaller ones.
"""
header = self.source.header
return header.mini_sector_size if self._is_mini else header.sector_size | python | def sector_size(self):
"""
Property with current sector size. CFB file can store normal sectors
and smaller ones.
"""
header = self.source.header
return header.mini_sector_size if self._is_mini else header.sector_size | [
"def",
"sector_size",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"source",
".",
"header",
"return",
"header",
".",
"mini_sector_size",
"if",
"self",
".",
"_is_mini",
"else",
"header",
".",
"sector_size"
] | Property with current sector size. CFB file can store normal sectors
and smaller ones. | [
"Property",
"with",
"current",
"sector",
"size",
".",
"CFB",
"file",
"can",
"store",
"normal",
"sectors",
"and",
"smaller",
"ones",
"."
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L108-L114 |
rembish/cfb | cfb/directory/entry.py | Entry.sector_shift | def sector_shift(self):
"""
Property with current sector size shift. Actually sector size is
2 ** sector shift
"""
header = self.source.header
return header.mini_sector_shift if self._is_mini \
else header.sector_shift | python | def sector_shift(self):
"""
Property with current sector size shift. Actually sector size is
2 ** sector shift
"""
header = self.source.header
return header.mini_sector_shift if self._is_mini \
else header.sector_shift | [
"def",
"sector_shift",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"source",
".",
"header",
"return",
"header",
".",
"mini_sector_shift",
"if",
"self",
".",
"_is_mini",
"else",
"header",
".",
"sector_shift"
] | Property with current sector size shift. Actually sector size is
2 ** sector shift | [
"Property",
"with",
"current",
"sector",
"size",
"shift",
".",
"Actually",
"sector",
"size",
"is",
"2",
"**",
"sector",
"shift"
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L117-L124 |
rembish/cfb | cfb/directory/entry.py | Entry.left | def left(self):
"""
Entry is left sibling of current directory entry
"""
return self.source.directory[self.left_sibling_id] \
if self.left_sibling_id != NOSTREAM else None | python | def left(self):
"""
Entry is left sibling of current directory entry
"""
return self.source.directory[self.left_sibling_id] \
if self.left_sibling_id != NOSTREAM else None | [
"def",
"left",
"(",
"self",
")",
":",
"return",
"self",
".",
"source",
".",
"directory",
"[",
"self",
".",
"left_sibling_id",
"]",
"if",
"self",
".",
"left_sibling_id",
"!=",
"NOSTREAM",
"else",
"None"
] | Entry is left sibling of current directory entry | [
"Entry",
"is",
"left",
"sibling",
"of",
"current",
"directory",
"entry"
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L127-L132 |
rembish/cfb | cfb/directory/entry.py | Entry.right | def right(self):
"""
Entry is right sibling of current directory entry
"""
return self.source.directory[self.right_sibling_id] \
if self.right_sibling_id != NOSTREAM else None | python | def right(self):
"""
Entry is right sibling of current directory entry
"""
return self.source.directory[self.right_sibling_id] \
if self.right_sibling_id != NOSTREAM else None | [
"def",
"right",
"(",
"self",
")",
":",
"return",
"self",
".",
"source",
".",
"directory",
"[",
"self",
".",
"right_sibling_id",
"]",
"if",
"self",
".",
"right_sibling_id",
"!=",
"NOSTREAM",
"else",
"None"
] | Entry is right sibling of current directory entry | [
"Entry",
"is",
"right",
"sibling",
"of",
"current",
"directory",
"entry"
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L135-L140 |
rembish/cfb | cfb/directory/entry.py | Entry.read | def read(self, size=None):
"""
Reads `size` bytes from current directory entry. If `size` is empty,
it'll read all data till entry's end.
"""
if self._is_mini:
self.seek(self._position)
else:
self.source.seek(self._source_position)
if not s... | python | def read(self, size=None):
"""
Reads `size` bytes from current directory entry. If `size` is empty,
it'll read all data till entry's end.
"""
if self._is_mini:
self.seek(self._position)
else:
self.source.seek(self._source_position)
if not s... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_mini",
":",
"self",
".",
"seek",
"(",
"self",
".",
"_position",
")",
"else",
":",
"self",
".",
"source",
".",
"seek",
"(",
"self",
".",
"_source_position",
")",... | Reads `size` bytes from current directory entry. If `size` is empty,
it'll read all data till entry's end. | [
"Reads",
"size",
"bytes",
"from",
"current",
"directory",
"entry",
".",
"If",
"size",
"is",
"empty",
"it",
"ll",
"read",
"all",
"data",
"till",
"entry",
"s",
"end",
"."
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L151-L188 |
rembish/cfb | cfb/directory/entry.py | Entry.seek | def seek(self, offset, whence=SEEK_SET):
"""
Seeks to specified `offset` position in current directory entry
stream. `Whence` can be SEEK_SET - from entry's start, SEEK_CUR -
from current position and SEEK_END - from entry's end. Constants are
same with same stored `os` module.
... | python | def seek(self, offset, whence=SEEK_SET):
"""
Seeks to specified `offset` position in current directory entry
stream. `Whence` can be SEEK_SET - from entry's start, SEEK_CUR -
from current position and SEEK_END - from entry's end. Constants are
same with same stored `os` module.
... | [
"def",
"seek",
"(",
"self",
",",
"offset",
",",
"whence",
"=",
"SEEK_SET",
")",
":",
"if",
"whence",
"==",
"SEEK_CUR",
":",
"offset",
"+=",
"self",
".",
"tell",
"(",
")",
"elif",
"whence",
"==",
"SEEK_END",
":",
"offset",
"=",
"self",
".",
"size",
... | Seeks to specified `offset` position in current directory entry
stream. `Whence` can be SEEK_SET - from entry's start, SEEK_CUR -
from current position and SEEK_END - from entry's end. Constants are
same with same stored `os` module. | [
"Seeks",
"to",
"specified",
"offset",
"position",
"in",
"current",
"directory",
"entry",
"stream",
".",
"Whence",
"can",
"be",
"SEEK_SET",
"-",
"from",
"entry",
"s",
"start",
"SEEK_CUR",
"-",
"from",
"current",
"position",
"and",
"SEEK_END",
"-",
"from",
"en... | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L190-L219 |
rembish/cfb | cfb/directory/entry.py | RootEntry.child | def child(self):
"""
Root entry object has only one child entry and no siblings.
"""
return self.stream.directory[self.child_id] \
if self.child_id != NOSTREAM else None | python | def child(self):
"""
Root entry object has only one child entry and no siblings.
"""
return self.stream.directory[self.child_id] \
if self.child_id != NOSTREAM else None | [
"def",
"child",
"(",
"self",
")",
":",
"return",
"self",
".",
"stream",
".",
"directory",
"[",
"self",
".",
"child_id",
"]",
"if",
"self",
".",
"child_id",
"!=",
"NOSTREAM",
"else",
"None"
] | Root entry object has only one child entry and no siblings. | [
"Root",
"entry",
"object",
"has",
"only",
"one",
"child",
"entry",
"and",
"no",
"siblings",
"."
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/entry.py#L234-L239 |
danvk/pyjsonselect | cli.py | apply_filter | def apply_filter(objs, selector, mode):
'''Apply selector to transform each object in objs.
This operates in-place on objs. Empty objects are removed from the list.
Args:
mode: either KEEP (to keep selected items & their ancestors) or DELETE
(to delete selected items and their childr... | python | def apply_filter(objs, selector, mode):
'''Apply selector to transform each object in objs.
This operates in-place on objs. Empty objects are removed from the list.
Args:
mode: either KEEP (to keep selected items & their ancestors) or DELETE
(to delete selected items and their childr... | [
"def",
"apply_filter",
"(",
"objs",
",",
"selector",
",",
"mode",
")",
":",
"indices_to_delete",
"=",
"[",
"]",
"presumption",
"=",
"DELETE",
"if",
"mode",
"==",
"KEEP",
"else",
"KEEP",
"for",
"i",
",",
"obj",
"in",
"enumerate",
"(",
"objs",
")",
":",
... | Apply selector to transform each object in objs.
This operates in-place on objs. Empty objects are removed from the list.
Args:
mode: either KEEP (to keep selected items & their ancestors) or DELETE
(to delete selected items and their children). | [
"Apply",
"selector",
"to",
"transform",
"each",
"object",
"in",
"objs",
"."
] | train | https://github.com/danvk/pyjsonselect/blob/b700e9293f93b5a0b958714c7ecc421bb49267f8/cli.py#L98-L120 |
danvk/pyjsonselect | cli.py | apply_selector | def apply_selector(objs, selector):
'''Returns a list of objects which match the selector in any of objs.'''
out = []
for obj in objs:
timer.log('Applying selector: %s' % selector)
out += list(jsonselect.match(selector, objs))
timer.log('done applying selector')
return out | python | def apply_selector(objs, selector):
'''Returns a list of objects which match the selector in any of objs.'''
out = []
for obj in objs:
timer.log('Applying selector: %s' % selector)
out += list(jsonselect.match(selector, objs))
timer.log('done applying selector')
return out | [
"def",
"apply_selector",
"(",
"objs",
",",
"selector",
")",
":",
"out",
"=",
"[",
"]",
"for",
"obj",
"in",
"objs",
":",
"timer",
".",
"log",
"(",
"'Applying selector: %s'",
"%",
"selector",
")",
"out",
"+=",
"list",
"(",
"jsonselect",
".",
"match",
"("... | Returns a list of objects which match the selector in any of objs. | [
"Returns",
"a",
"list",
"of",
"objects",
"which",
"match",
"the",
"selector",
"in",
"any",
"of",
"objs",
"."
] | train | https://github.com/danvk/pyjsonselect/blob/b700e9293f93b5a0b958714c7ecc421bb49267f8/cli.py#L123-L130 |
danvk/pyjsonselect | cli.py | Timer.log | def log(self, statement):
'''Write statement to stderr with timing info in DEBUG mode.'''
global DEBUG
time_ms = 1000 * time.time()
if DEBUG:
total_time_ms = time_ms - self._start_time_ms_
lap_time_ms = time_ms - self._last_time_ms_
sys.stderr.write('%... | python | def log(self, statement):
'''Write statement to stderr with timing info in DEBUG mode.'''
global DEBUG
time_ms = 1000 * time.time()
if DEBUG:
total_time_ms = time_ms - self._start_time_ms_
lap_time_ms = time_ms - self._last_time_ms_
sys.stderr.write('%... | [
"def",
"log",
"(",
"self",
",",
"statement",
")",
":",
"global",
"DEBUG",
"time_ms",
"=",
"1000",
"*",
"time",
".",
"time",
"(",
")",
"if",
"DEBUG",
":",
"total_time_ms",
"=",
"time_ms",
"-",
"self",
".",
"_start_time_ms_",
"lap_time_ms",
"=",
"time_ms",... | Write statement to stderr with timing info in DEBUG mode. | [
"Write",
"statement",
"to",
"stderr",
"with",
"timing",
"info",
"in",
"DEBUG",
"mode",
"."
] | train | https://github.com/danvk/pyjsonselect/blob/b700e9293f93b5a0b958714c7ecc421bb49267f8/cli.py#L79-L88 |
mitsei/dlkit | dlkit/aws_adapter/repository/objects.py | AssetContent.get_data | def get_data(self):
"""Gets the asset content data.
return: (osid.transport.DataInputStream) - the length of the
content data
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
# gets you a file-like ... | python | def get_data(self):
"""Gets the asset content data.
return: (osid.transport.DataInputStream) - the length of the
content data
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
# gets you a file-like ... | [
"def",
"get_data",
"(",
"self",
")",
":",
"remote_url",
"=",
"self",
".",
"get_url",
"(",
")",
"filename",
"=",
"remote_url",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]",
".",
"split",
"(",
"'?'",
")",
"[",
"0",
"]",
"req",
"=",
"requests",... | Gets the asset content data.
return: (osid.transport.DataInputStream) - the length of the
content data
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
# gets you a file-like object...not sure if it will be... | [
"Gets",
"the",
"asset",
"content",
"data",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/objects.py#L1166-L1183 |
mitsei/dlkit | dlkit/aws_adapter/repository/objects.py | AssetContent.get_object_map | def get_object_map(self):
"""stub"""
obj_map = self._payload.get_object_map()
obj_map.update({'url': self.get_url()})
obj_map['recordTypeIds'].append(str(AWS_ASSET_CONTENT_RECORD_TYPE))
return obj_map | python | def get_object_map(self):
"""stub"""
obj_map = self._payload.get_object_map()
obj_map.update({'url': self.get_url()})
obj_map['recordTypeIds'].append(str(AWS_ASSET_CONTENT_RECORD_TYPE))
return obj_map | [
"def",
"get_object_map",
"(",
"self",
")",
":",
"obj_map",
"=",
"self",
".",
"_payload",
".",
"get_object_map",
"(",
")",
"obj_map",
".",
"update",
"(",
"{",
"'url'",
":",
"self",
".",
"get_url",
"(",
")",
"}",
")",
"obj_map",
"[",
"'recordTypeIds'",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/objects.py#L1233-L1238 |
mitsei/dlkit | dlkit/aws_adapter/repository/objects.py | AssetContentForm.set_data | def set_data(self, data=None):
"""Sets the content data.
arg: data (osid.transport.DataInputStream): the content data
raise: InvalidArgument - ``data`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``data`` is ``null``
*co... | python | def set_data(self, data=None):
"""Sets the content data.
arg: data (osid.transport.DataInputStream): the content data
raise: InvalidArgument - ``data`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``data`` is ``null``
*co... | [
"def",
"set_data",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"# cjshaw, Jan 7, 2015",
"# Testing this with AWS -- set data + set_url (to save the S3 URL)",
"# Uses:",
"# 1) AWS repository-put user key pair",
"# 2) S3 bucket for odl-repository",
"#",
"# For now, follow a ... | Sets the content data.
arg: data (osid.transport.DataInputStream): the content data
raise: InvalidArgument - ``data`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``data`` is ``null``
*compliance: mandatory -- This method must be... | [
"Sets",
"the",
"content",
"data",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/objects.py#L1331-L1378 |
mitsei/dlkit | dlkit/aws_adapter/repository/objects.py | AssetContentForm.clear_data | def clear_data(self):
"""Removes the content data.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# cjshaw@mit.edu, Jan 9, 2015
# Removes t... | python | def clear_data(self):
"""Removes the content data.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# cjshaw@mit.edu, Jan 9, 2015
# Removes t... | [
"def",
"clear_data",
"(",
"self",
")",
":",
"# cjshaw@mit.edu, Jan 9, 2015",
"# Removes the item from AWS S3 and resets URL to ''",
"odl_repo",
",",
"url",
"=",
"get_aws_s3_handle",
"(",
"self",
".",
"_config_map",
")",
"existing_url",
"=",
"self",
".",
"_payload",
".",... | Removes the content data.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Removes",
"the",
"content",
"data",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/objects.py#L1380-L1402 |
mitsei/dlkit | dlkit/aws_adapter/repository/objects.py | AssetContentList.get_next_asset_contents | def get_next_asset_contents(self, n=None):
"""Gets the next set of ``AssetContents`` in this list which must be
less than or equal to the return from ``available()``.
arg: n (cardinal): the number of ``AssetContent`` elements
requested which must be less than or equal to
... | python | def get_next_asset_contents(self, n=None):
"""Gets the next set of ``AssetContents`` in this list which must be
less than or equal to the return from ``available()``.
arg: n (cardinal): the number of ``AssetContent`` elements
requested which must be less than or equal to
... | [
"def",
"get_next_asset_contents",
"(",
"self",
",",
"n",
"=",
"None",
")",
":",
"if",
"n",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"not",
"isinstance",
"(",
"n",
",",
"int",
")",
":",
"raise",
"InvalidArgument",
"(",
")",
"provider_... | Gets the next set of ``AssetContents`` in this list which must be
less than or equal to the return from ``available()``.
arg: n (cardinal): the number of ``AssetContent`` elements
requested which must be less than or equal to
``available()``
return: (osid.repo... | [
"Gets",
"the",
"next",
"set",
"of",
"AssetContents",
"in",
"this",
"list",
"which",
"must",
"be",
"less",
"than",
"or",
"equal",
"to",
"the",
"return",
"from",
"available",
"()",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/objects.py#L1508-L1534 |
python-odin/odinweb | odinweb/helpers.py | resolve_content_type | def resolve_content_type(type_resolvers, request):
# type: (Iterable[Callable[[Any], str]], Any) -> Optional[str]
"""
Resolve content types from a request.
"""
for resolver in type_resolvers:
content_type = parse_content_type(resolver(request))
if content_type:
return con... | python | def resolve_content_type(type_resolvers, request):
# type: (Iterable[Callable[[Any], str]], Any) -> Optional[str]
"""
Resolve content types from a request.
"""
for resolver in type_resolvers:
content_type = parse_content_type(resolver(request))
if content_type:
return con... | [
"def",
"resolve_content_type",
"(",
"type_resolvers",
",",
"request",
")",
":",
"# type: (Iterable[Callable[[Any], str]], Any) -> Optional[str]",
"for",
"resolver",
"in",
"type_resolvers",
":",
"content_type",
"=",
"parse_content_type",
"(",
"resolver",
"(",
"request",
")",... | Resolve content types from a request. | [
"Resolve",
"content",
"types",
"from",
"a",
"request",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/helpers.py#L27-L35 |
python-odin/odinweb | odinweb/helpers.py | get_resource | def get_resource(request, resource, allow_multiple=False, full_clean=True, default_to_not_supplied=False):
"""
Get a resource instance from ``request.body``.
Note error code 98 is returned in multiple places, this is to prevent leakage of details of defined resources.
"""
# Decode the request body... | python | def get_resource(request, resource, allow_multiple=False, full_clean=True, default_to_not_supplied=False):
"""
Get a resource instance from ``request.body``.
Note error code 98 is returned in multiple places, this is to prevent leakage of details of defined resources.
"""
# Decode the request body... | [
"def",
"get_resource",
"(",
"request",
",",
"resource",
",",
"allow_multiple",
"=",
"False",
",",
"full_clean",
"=",
"True",
",",
"default_to_not_supplied",
"=",
"False",
")",
":",
"# Decode the request body.",
"body",
"=",
"request",
".",
"body",
"if",
"isinsta... | Get a resource instance from ``request.body``.
Note error code 98 is returned in multiple places, this is to prevent leakage of details of defined resources. | [
"Get",
"a",
"resource",
"instance",
"from",
"request",
".",
"body",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/helpers.py#L38-L75 |
python-odin/odinweb | odinweb/helpers.py | create_response | def create_response(request, body=None, status=None, headers=None):
# type: (BaseHttpRequest, Any, HTTPStatus, dict) -> HttpResponse
"""
Generate a HttpResponse.
:param request: Request object
:param body: Body of the response
:param status: HTTP status code
:param headers: Any headers.
... | python | def create_response(request, body=None, status=None, headers=None):
# type: (BaseHttpRequest, Any, HTTPStatus, dict) -> HttpResponse
"""
Generate a HttpResponse.
:param request: Request object
:param body: Body of the response
:param status: HTTP status code
:param headers: Any headers.
... | [
"def",
"create_response",
"(",
"request",
",",
"body",
"=",
"None",
",",
"status",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"# type: (BaseHttpRequest, Any, HTTPStatus, dict) -> HttpResponse",
"if",
"body",
"is",
"None",
":",
"return",
"HttpResponse",
"(... | Generate a HttpResponse.
:param request: Request object
:param body: Body of the response
:param status: HTTP status code
:param headers: Any headers. | [
"Generate",
"a",
"HttpResponse",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/helpers.py#L78-L95 |
rembish/cfb | cfb/directory/__init__.py | Directory.read | def read(self):
"""
This module is lazy-loaded by default. You can read all internal
structure by calling this method.
"""
stack = [self[0].child]
while stack:
current = stack.pop()
if current.right:
stack.append(current.right)
... | python | def read(self):
"""
This module is lazy-loaded by default. You can read all internal
structure by calling this method.
"""
stack = [self[0].child]
while stack:
current = stack.pop()
if current.right:
stack.append(current.right)
... | [
"def",
"read",
"(",
"self",
")",
":",
"stack",
"=",
"[",
"self",
"[",
"0",
"]",
".",
"child",
"]",
"while",
"stack",
":",
"current",
"=",
"stack",
".",
"pop",
"(",
")",
"if",
"current",
".",
"right",
":",
"stack",
".",
"append",
"(",
"current",
... | This module is lazy-loaded by default. You can read all internal
structure by calling this method. | [
"This",
"module",
"is",
"lazy",
"-",
"loaded",
"by",
"default",
".",
"You",
"can",
"read",
"all",
"internal",
"structure",
"by",
"calling",
"this",
"method",
"."
] | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/__init__.py#L25-L38 |
rembish/cfb | cfb/directory/__init__.py | Directory.by_name | def by_name(self, name):
"""
In many cases you want to access directory not by it's ID, but by
it's name. This method implements red-black search method, which
internally uses CFB format. Also this method has internal name cache
to speed up 2nd+ named accesses.
"""
... | python | def by_name(self, name):
"""
In many cases you want to access directory not by it's ID, but by
it's name. This method implements red-black search method, which
internally uses CFB format. Also this method has internal name cache
to speed up 2nd+ named accesses.
"""
... | [
"def",
"by_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_name_cache",
":",
"return",
"self",
"[",
"self",
".",
"_name_cache",
"[",
"name",
"]",
"]",
"if",
"self",
".",
"source",
".",
"root",
".",
"name",
"==",
"name"... | In many cases you want to access directory not by it's ID, but by
it's name. This method implements red-black search method, which
internally uses CFB format. Also this method has internal name cache
to speed up 2nd+ named accesses. | [
"In",
"many",
"cases",
"you",
"want",
"to",
"access",
"directory",
"not",
"by",
"it",
"s",
"ID",
"but",
"by",
"it",
"s",
"name",
".",
"This",
"method",
"implements",
"red",
"-",
"black",
"search",
"method",
"which",
"internally",
"uses",
"CFB",
"format",... | train | https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/directory/__init__.py#L78-L104 |
mitsei/dlkit | dlkit/primordium/mapping/coordinate_primitives.py | BasicCoordinate._compare | def _compare(self, other, method):
"""see https://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/"""
# This needs to be updated to take uncertainty into account:
if isinstance(other, abc_mapping_primitives.Coordinate):
if self.get_dimensions() !=... | python | def _compare(self, other, method):
"""see https://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/"""
# This needs to be updated to take uncertainty into account:
if isinstance(other, abc_mapping_primitives.Coordinate):
if self.get_dimensions() !=... | [
"def",
"_compare",
"(",
"self",
",",
"other",
",",
"method",
")",
":",
"# This needs to be updated to take uncertainty into account:",
"if",
"isinstance",
"(",
"other",
",",
"abc_mapping_primitives",
".",
"Coordinate",
")",
":",
"if",
"self",
".",
"get_dimensions",
... | see https://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/ | [
"see",
"https",
":",
"//",
"regebro",
".",
"wordpress",
".",
"com",
"/",
"2010",
"/",
"12",
"/",
"13",
"/",
"python",
"-",
"implementing",
"-",
"rich",
"-",
"comparison",
"-",
"the",
"-",
"correct",
"-",
"way",
"/"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/primordium/mapping/coordinate_primitives.py#L59-L70 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager._set_vault_view | def _set_vault_view(self, session):
"""Sets the underlying vault view to match current view"""
if self._vault_view == COMPARATIVE:
try:
session.use_comparative_vault_view()
except AttributeError:
pass
else:
try:
... | python | def _set_vault_view(self, session):
"""Sets the underlying vault view to match current view"""
if self._vault_view == COMPARATIVE:
try:
session.use_comparative_vault_view()
except AttributeError:
pass
else:
try:
... | [
"def",
"_set_vault_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_vault_view",
"==",
"COMPARATIVE",
":",
"try",
":",
"session",
".",
"use_comparative_vault_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",... | Sets the underlying vault view to match current view | [
"Sets",
"the",
"underlying",
"vault",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L192-L203 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.use_comparative_vault_view | def use_comparative_vault_view(self):
"""Pass through to provider AuthorizationVaultSession.use_comparative_vault_view"""
self._vault_view = COMPARATIVE
# self._get_provider_session('authorization_vault_session') # To make sure the session is tracked
for session in self._get_provider_ses... | python | def use_comparative_vault_view(self):
"""Pass through to provider AuthorizationVaultSession.use_comparative_vault_view"""
self._vault_view = COMPARATIVE
# self._get_provider_session('authorization_vault_session') # To make sure the session is tracked
for session in self._get_provider_ses... | [
"def",
"use_comparative_vault_view",
"(",
"self",
")",
":",
"self",
".",
"_vault_view",
"=",
"COMPARATIVE",
"# self._get_provider_session('authorization_vault_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
"... | Pass through to provider AuthorizationVaultSession.use_comparative_vault_view | [
"Pass",
"through",
"to",
"provider",
"AuthorizationVaultSession",
".",
"use_comparative_vault_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L430-L438 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.use_plenary_vault_view | def use_plenary_vault_view(self):
"""Pass through to provider AuthorizationVaultSession.use_plenary_vault_view"""
self._vault_view = PLENARY
# self._get_provider_session('authorization_vault_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_plenary_vault_view(self):
"""Pass through to provider AuthorizationVaultSession.use_plenary_vault_view"""
self._vault_view = PLENARY
# self._get_provider_session('authorization_vault_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_plenary_vault_view",
"(",
"self",
")",
":",
"self",
".",
"_vault_view",
"=",
"PLENARY",
"# self._get_provider_session('authorization_vault_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":... | Pass through to provider AuthorizationVaultSession.use_plenary_vault_view | [
"Pass",
"through",
"to",
"provider",
"AuthorizationVaultSession",
".",
"use_plenary_vault_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L440-L448 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.get_vaults_by_ids | def get_vaults_by_ids(self, *args, **kwargs):
"""Pass through to provider VaultLookupSession.get_vaults_by_ids"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_by_ids
catalogs = self._get_provider_session('vault_lookup_session').get_vaults_by_ids(*ar... | python | def get_vaults_by_ids(self, *args, **kwargs):
"""Pass through to provider VaultLookupSession.get_vaults_by_ids"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_by_ids
catalogs = self._get_provider_session('vault_lookup_session').get_vaults_by_ids(*ar... | [
"def",
"get_vaults_by_ids",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bins_by_ids",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'vault_lookup_session'... | Pass through to provider VaultLookupSession.get_vaults_by_ids | [
"Pass",
"through",
"to",
"provider",
"VaultLookupSession",
".",
"get_vaults_by_ids"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L544-L552 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.get_vaults | def get_vaults(self):
"""Pass through to provider VaultLookupSession.get_vaults"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('vault_lookup_session').get_vaults()
cat_list = []
for cat... | python | def get_vaults(self):
"""Pass through to provider VaultLookupSession.get_vaults"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('vault_lookup_session').get_vaults()
cat_list = []
for cat... | [
"def",
"get_vaults",
"(",
"self",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bins_template",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'vault_lookup_session'",
")",
".",
"get_vaults",
"(",
")",
"cat_list",
... | Pass through to provider VaultLookupSession.get_vaults | [
"Pass",
"through",
"to",
"provider",
"VaultLookupSession",
".",
"get_vaults"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L594-L602 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.create_vault | def create_vault(self, *args, **kwargs):
"""Pass through to provider VaultAdminSession.create_vault"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.create_bin
return Vault(
self._provider_manager,
self._get_provider_session('vault_admi... | python | def create_vault(self, *args, **kwargs):
"""Pass through to provider VaultAdminSession.create_vault"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.create_bin
return Vault(
self._provider_manager,
self._get_provider_session('vault_admi... | [
"def",
"create_vault",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.create_bin",
"return",
"Vault",
"(",
"self",
".",
"_provider_manager",
",",
"self",
".",
"_get_provid... | Pass through to provider VaultAdminSession.create_vault | [
"Pass",
"through",
"to",
"provider",
"VaultAdminSession",
".",
"create_vault"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L648-L656 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.get_vault_form | def get_vault_form(self, *args, **kwargs):
"""Pass through to provider VaultAdminSession.get_vault_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.
i... | python | def get_vault_form(self, *args, **kwargs):
"""Pass through to provider VaultAdminSession.get_vault_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.
i... | [
"def",
"get_vault_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 VaultAdminSession.get_vault_form_for_update | [
"Pass",
"through",
"to",
"provider",
"VaultAdminSession",
".",
"get_vault_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L670-L678 |
mitsei/dlkit | dlkit/services/authorization.py | AuthorizationManager.save_vault | def save_vault(self, vault_form, *args, **kwargs):
"""Pass through to provider VaultAdminSession.update_vault"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if vault_form.is_for_update():
return self.update_vault(vault_form, *args, **k... | python | def save_vault(self, vault_form, *args, **kwargs):
"""Pass through to provider VaultAdminSession.update_vault"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if vault_form.is_for_update():
return self.update_vault(vault_form, *args, **k... | [
"def",
"save_vault",
"(",
"self",
",",
"vault_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.update_bin",
"if",
"vault_form",
".",
"is_for_update",
"(",
")",
":",
"return",
"s... | Pass through to provider VaultAdminSession.update_vault | [
"Pass",
"through",
"to",
"provider",
"VaultAdminSession",
".",
"update_vault"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L691-L698 |
mitsei/dlkit | dlkit/services/authorization.py | Vault._set_vault_view | def _set_vault_view(self, session):
"""Sets the underlying vault view to match current view"""
if self._vault_view == FEDERATED:
try:
session.use_federated_vault_view()
except AttributeError:
pass
else:
try:
sess... | python | def _set_vault_view(self, session):
"""Sets the underlying vault view to match current view"""
if self._vault_view == FEDERATED:
try:
session.use_federated_vault_view()
except AttributeError:
pass
else:
try:
sess... | [
"def",
"_set_vault_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_vault_view",
"==",
"FEDERATED",
":",
"try",
":",
"session",
".",
"use_federated_vault_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
"... | Sets the underlying vault view to match current view | [
"Sets",
"the",
"underlying",
"vault",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L992-L1003 |
mitsei/dlkit | dlkit/services/authorization.py | Vault.use_comparative_authorization_view | def use_comparative_authorization_view(self):
"""Pass through to provider AuthorizationLookupSession.use_comparative_authorization_view"""
self._object_views['authorization'] = COMPARATIVE
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
... | python | def use_comparative_authorization_view(self):
"""Pass through to provider AuthorizationLookupSession.use_comparative_authorization_view"""
self._object_views['authorization'] = COMPARATIVE
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
... | [
"def",
"use_comparative_authorization_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'authorization'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",... | Pass through to provider AuthorizationLookupSession.use_comparative_authorization_view | [
"Pass",
"through",
"to",
"provider",
"AuthorizationLookupSession",
".",
"use_comparative_authorization_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1145-L1153 |
mitsei/dlkit | dlkit/services/authorization.py | Vault.use_plenary_authorization_view | def use_plenary_authorization_view(self):
"""Pass through to provider AuthorizationLookupSession.use_plenary_authorization_view"""
self._object_views['authorization'] = PLENARY
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
for session ... | python | def use_plenary_authorization_view(self):
"""Pass through to provider AuthorizationLookupSession.use_plenary_authorization_view"""
self._object_views['authorization'] = PLENARY
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
for session ... | [
"def",
"use_plenary_authorization_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'authorization'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
... | Pass through to provider AuthorizationLookupSession.use_plenary_authorization_view | [
"Pass",
"through",
"to",
"provider",
"AuthorizationLookupSession",
".",
"use_plenary_authorization_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1155-L1163 |
mitsei/dlkit | dlkit/services/authorization.py | Vault.use_federated_vault_view | def use_federated_vault_view(self):
"""Pass through to provider AuthorizationLookupSession.use_federated_vault_view"""
self._vault_view = FEDERATED
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
for session in self._get_provider_session... | python | def use_federated_vault_view(self):
"""Pass through to provider AuthorizationLookupSession.use_federated_vault_view"""
self._vault_view = FEDERATED
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
for session in self._get_provider_session... | [
"def",
"use_federated_vault_view",
"(",
"self",
")",
":",
"self",
".",
"_vault_view",
"=",
"FEDERATED",
"# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",... | Pass through to provider AuthorizationLookupSession.use_federated_vault_view | [
"Pass",
"through",
"to",
"provider",
"AuthorizationLookupSession",
".",
"use_federated_vault_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1165-L1173 |
mitsei/dlkit | dlkit/services/authorization.py | Vault.use_isolated_vault_view | def use_isolated_vault_view(self):
"""Pass through to provider AuthorizationLookupSession.use_isolated_vault_view"""
self._vault_view = ISOLATED
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions()... | python | def use_isolated_vault_view(self):
"""Pass through to provider AuthorizationLookupSession.use_isolated_vault_view"""
self._vault_view = ISOLATED
# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions()... | [
"def",
"use_isolated_vault_view",
"(",
"self",
")",
":",
"self",
".",
"_vault_view",
"=",
"ISOLATED",
"# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
... | Pass through to provider AuthorizationLookupSession.use_isolated_vault_view | [
"Pass",
"through",
"to",
"provider",
"AuthorizationLookupSession",
".",
"use_isolated_vault_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1175-L1183 |
mitsei/dlkit | dlkit/services/authorization.py | Vault.get_authorization_form | def get_authorization_form(self, *args, **kwargs):
"""Pass through to provider AuthorizationAdminSession.get_authorization_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. ... | python | def get_authorization_form(self, *args, **kwargs):
"""Pass through to provider AuthorizationAdminSession.get_authorization_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. ... | [
"def",
"get_authorization_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",
"isins... | Pass through to provider AuthorizationAdminSession.get_authorization_form_for_update | [
"Pass",
"through",
"to",
"provider",
"AuthorizationAdminSession",
".",
"get_authorization_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1359-L1367 |
mitsei/dlkit | dlkit/services/authorization.py | Vault.save_authorization | def save_authorization(self, authorization_form, *args, **kwargs):
"""Pass through to provider AuthorizationAdminSession.update_authorization"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if authorization_form.is_for_update():
... | python | def save_authorization(self, authorization_form, *args, **kwargs):
"""Pass through to provider AuthorizationAdminSession.update_authorization"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if authorization_form.is_for_update():
... | [
"def",
"save_authorization",
"(",
"self",
",",
"authorization_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.update_resource",
"if",
"authorization_form",
".",
"is_for_update",
"... | Pass through to provider AuthorizationAdminSession.update_authorization | [
"Pass",
"through",
"to",
"provider",
"AuthorizationAdminSession",
".",
"update_authorization"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1381-L1388 |
mitsei/dlkit | dlkit/json_/grading/objects.py | Grade.get_grade_system_id | def get_grade_system_id(self):
"""Gets the ``GradeSystem Id`` in which this grade belongs.
return: (osid.id.Id) - the grade system ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.Activity.get_objective_id
... | python | def get_grade_system_id(self):
"""Gets the ``GradeSystem Id`` in which this grade belongs.
return: (osid.id.Id) - the grade system ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.Activity.get_objective_id
... | [
"def",
"get_grade_system_id",
"(",
"self",
")",
":",
"# Implemented from template for osid.learning.Activity.get_objective_id",
"if",
"not",
"bool",
"(",
"self",
".",
"_my_map",
"[",
"'gradeSystemId'",
"]",
")",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'grad... | Gets the ``GradeSystem Id`` in which this grade belongs.
return: (osid.id.Id) - the grade system ``Id``
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"GradeSystem",
"Id",
"in",
"which",
"this",
"grade",
"belongs",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L51-L61 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm._init_metadata | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
self._output_score_default = self._mdata['output_score']['default_decimal_values'][0]
self._input_score_end_range_default = self._mdata['input_score_end_range']['... | python | def _init_metadata(self, **kwargs):
"""Initialize form metadata"""
osid_objects.OsidObjectForm._init_metadata(self, **kwargs)
self._output_score_default = self._mdata['output_score']['default_decimal_values'][0]
self._input_score_end_range_default = self._mdata['input_score_end_range']['... | [
"def",
"_init_metadata",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"osid_objects",
".",
"OsidObjectForm",
".",
"_init_metadata",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_output_score_default",
"=",
"self",
".",
"_mdata",
"[",
"'outpu... | Initialize form metadata | [
"Initialize",
"form",
"metadata"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L171-L176 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm._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['outputScore'] = self._output_score_default
self._my_map['gradeSystemId'] = str(kwargs['grade_system_id'])
self._my_map[... | 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['outputScore'] = self._output_score_default
self._my_map['gradeSystemId'] = str(kwargs['grade_system_id'])
self._my_map[... | [
"def",
"_init_map",
"(",
"self",
",",
"record_types",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"osid_objects",
".",
"OsidObjectForm",
".",
"_init_map",
"(",
"self",
",",
"record_types",
"=",
"record_types",
")",
"self",
".",
"_my_map",
"[",
"'output... | Initialize form map | [
"Initialize",
"form",
"map"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L178-L185 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.get_input_score_start_range_metadata | def get_input_score_start_range_metadata(self):
"""Gets the metadata for the input score start range.
return: (osid.Metadata) - metadata for the input score start
range
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template f... | python | def get_input_score_start_range_metadata(self):
"""Gets the metadata for the input score start range.
return: (osid.Metadata) - metadata for the input score start
range
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template f... | [
"def",
"get_input_score_start_range_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'input_score_start_range'",
"]",
")",
"metadata",
".",
"u... | Gets the metadata for the input score start range.
return: (osid.Metadata) - metadata for the input score start
range
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"input",
"score",
"start",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L187-L198 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.set_input_score_start_range | def set_input_score_start_range(self, score):
"""Sets the input score start range.
arg: score (decimal): the new start range
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``range`` cannot be modified
*compliance: mandatory -- This method must be implemente... | python | def set_input_score_start_range(self, score):
"""Sets the input score start range.
arg: score (decimal): the new start range
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``range`` cannot be modified
*compliance: mandatory -- This method must be implemente... | [
"def",
"set_input_score_start_range",
"(",
"self",
",",
"score",
")",
":",
"# Implemented from template for osid.grading.GradeSystemForm.set_lowest_numeric_score",
"if",
"self",
".",
"get_input_score_start_range_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise"... | Sets the input score start range.
arg: score (decimal): the new start range
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``range`` cannot be modified
*compliance: mandatory -- This method must be implemented.* | [
"Sets",
"the",
"input",
"score",
"start",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L203-L221 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.clear_input_score_start_range | def clear_input_score_start_range(self):
"""Clears the input score start.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.g... | python | def clear_input_score_start_range(self):
"""Clears the input score start.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.g... | [
"def",
"clear_input_score_start_range",
"(",
"self",
")",
":",
"# Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score",
"if",
"(",
"self",
".",
"get_input_score_start_range_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
"."... | Clears the input score start.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Clears",
"the",
"input",
"score",
"start",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L223-L235 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.get_input_score_end_range_metadata | def get_input_score_end_range_metadata(self):
"""Gets the metadata for the input score start range.
return: (osid.Metadata) - metadata for the input score start
range
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for... | python | def get_input_score_end_range_metadata(self):
"""Gets the metadata for the input score start range.
return: (osid.Metadata) - metadata for the input score start
range
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for... | [
"def",
"get_input_score_end_range_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'input_score_end_range'",
"]",
")",
"metadata",
".",
"updat... | Gets the metadata for the input score start range.
return: (osid.Metadata) - metadata for the input score start
range
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"input",
"score",
"start",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L239-L250 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.set_input_score_end_range | def set_input_score_end_range(self, score):
"""Sets the input score start range.
arg: score (decimal): the new start range
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``range`` cannot be modified
*compliance: mandatory -- This method must be implemented.... | python | def set_input_score_end_range(self, score):
"""Sets the input score start range.
arg: score (decimal): the new start range
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``range`` cannot be modified
*compliance: mandatory -- This method must be implemented.... | [
"def",
"set_input_score_end_range",
"(",
"self",
",",
"score",
")",
":",
"# Implemented from template for osid.grading.GradeSystemForm.set_lowest_numeric_score",
"if",
"self",
".",
"get_input_score_end_range_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
... | Sets the input score start range.
arg: score (decimal): the new start range
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``range`` cannot be modified
*compliance: mandatory -- This method must be implemented.* | [
"Sets",
"the",
"input",
"score",
"start",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L255-L273 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.clear_input_score_end_range | def clear_input_score_end_range(self):
"""Clears the input score start.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.gra... | python | def clear_input_score_end_range(self):
"""Clears the input score start.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.gra... | [
"def",
"clear_input_score_end_range",
"(",
"self",
")",
":",
"# Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score",
"if",
"(",
"self",
".",
"get_input_score_end_range_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
... | Clears the input score start.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Clears",
"the",
"input",
"score",
"start",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L275-L287 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.get_output_score_metadata | def get_output_score_metadata(self):
"""Gets the metadata for the output score start range.
return: (osid.Metadata) - metadata for the output score start
range
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.r... | python | def get_output_score_metadata(self):
"""Gets the metadata for the output score start range.
return: (osid.Metadata) - metadata for the output score start
range
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.r... | [
"def",
"get_output_score_metadata",
"(",
"self",
")",
":",
"# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_mdata",
"[",
"'output_score'",
"]",
")",
"metadata",
".",
"update",
"(",
"{",
... | Gets the metadata for the output score start range.
return: (osid.Metadata) - metadata for the output score start
range
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"output",
"score",
"start",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L291-L302 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.set_output_score | def set_output_score(self, score):
"""Sets the output score.
arg: score (decimal): the new output score
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``score`` cannot be modified
*compliance: mandatory -- This method must be implemented.*
"""
... | python | def set_output_score(self, score):
"""Sets the output score.
arg: score (decimal): the new output score
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``score`` cannot be modified
*compliance: mandatory -- This method must be implemented.*
"""
... | [
"def",
"set_output_score",
"(",
"self",
",",
"score",
")",
":",
"# Implemented from template for osid.grading.GradeSystemForm.set_lowest_numeric_score",
"if",
"self",
".",
"get_output_score_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"errors",
".",
... | Sets the output score.
arg: score (decimal): the new output score
raise: InvalidArgument - ``score`` is invalid
raise: NoAccess - ``score`` cannot be modified
*compliance: mandatory -- This method must be implemented.* | [
"Sets",
"the",
"output",
"score",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L307-L325 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeForm.clear_output_score | def clear_output_score(self):
"""Clears the output score.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.grading.GradeSyst... | python | def clear_output_score(self):
"""Clears the output score.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.grading.GradeSyst... | [
"def",
"clear_output_score",
"(",
"self",
")",
":",
"# Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score",
"if",
"(",
"self",
".",
"get_output_score_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_output_score_... | Clears the output score.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Clears",
"the",
"output",
"score",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L327-L339 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeSystem.get_grade_ids | def get_grade_ids(self):
"""Gets the grade ``Ids`` in this system ranked from highest to lowest.
return: (osid.id.IdList) - the list of grades ``Ids``
raise: IllegalState - ``is_based_on_grades()`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
... | python | def get_grade_ids(self):
"""Gets the grade ``Ids`` in this system ranked from highest to lowest.
return: (osid.id.IdList) - the list of grades ``Ids``
raise: IllegalState - ``is_based_on_grades()`` is ``false``
*compliance: mandatory -- This method must be implemented.*
"""
... | [
"def",
"get_grade_ids",
"(",
"self",
")",
":",
"# Implemented from template for osid.repository.Asset.get_asset_content_ids_template",
"id_list",
"=",
"[",
"]",
"for",
"grade",
"in",
"self",
".",
"get_grades",
"(",
")",
":",
"id_list",
".",
"append",
"(",
"grade",
"... | Gets the grade ``Ids`` in this system ranked from highest to lowest.
return: (osid.id.IdList) - the list of grades ``Ids``
raise: IllegalState - ``is_based_on_grades()`` is ``false``
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"grade",
"Ids",
"in",
"this",
"system",
"ranked",
"from",
"highest",
"to",
"lowest",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L436-L448 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeSystem.get_grades | def get_grades(self):
"""Gets the grades in this system ranked from highest to lowest.
return: (osid.grading.GradeList) - the list of grades
raise: IllegalState - ``is_based_on_grades()`` is ``false``
raise: OperationFailed - unable to complete request
*compliance: mandatory -... | python | def get_grades(self):
"""Gets the grades in this system ranked from highest to lowest.
return: (osid.grading.GradeList) - the list of grades
raise: IllegalState - ``is_based_on_grades()`` is ``false``
raise: OperationFailed - unable to complete request
*compliance: mandatory -... | [
"def",
"get_grades",
"(",
"self",
")",
":",
"# Implemented from template for osid.repository.Asset.get_asset_contents_template",
"return",
"GradeList",
"(",
"self",
".",
"_my_map",
"[",
"'grades'",
"]",
",",
"runtime",
"=",
"self",
".",
"_runtime",
",",
"proxy",
"=",
... | Gets the grades in this system ranked from highest to lowest.
return: (osid.grading.GradeList) - the list of grades
raise: IllegalState - ``is_based_on_grades()`` is ``false``
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented... | [
"Gets",
"the",
"grades",
"in",
"this",
"system",
"ranked",
"from",
"highest",
"to",
"lowest",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L452-L465 |
mitsei/dlkit | dlkit/json_/grading/objects.py | GradeSystem.get_lowest_numeric_score | def get_lowest_numeric_score(self):
"""Gets the lowest number in a numeric grading system.
return: (decimal) - the lowest number
raise: IllegalState - ``is_based_on_grades()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if self.is_based_... | python | def get_lowest_numeric_score(self):
"""Gets the lowest number in a numeric grading system.
return: (decimal) - the lowest number
raise: IllegalState - ``is_based_on_grades()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if self.is_based_... | [
"def",
"get_lowest_numeric_score",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_based_on_grades",
"(",
")",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'This GradeSystem is based on grades'",
")",
"if",
"self",
".",
"_my_map",
"[",
"'lowestNumericScore'",
... | Gets the lowest number in a numeric grading system.
return: (decimal) - the lowest number
raise: IllegalState - ``is_based_on_grades()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"lowest",
"number",
"in",
"a",
"numeric",
"grading",
"system",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L474-L487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.