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/osid/base_records.py | DecimalValuesFormRecord.clear_decimal_values | def clear_decimal_values(self):
"""stub"""
if self._decimal_values_metadata['required'] or \
self._decimal_values_metadata['read_only']:
raise NoAccess()
self.my_osid_object_form._my_map['decimalValues'] = \
dict(self._decimal_values_metadata['default_obje... | python | def clear_decimal_values(self):
"""stub"""
if self._decimal_values_metadata['required'] or \
self._decimal_values_metadata['read_only']:
raise NoAccess()
self.my_osid_object_form._my_map['decimalValues'] = \
dict(self._decimal_values_metadata['default_obje... | [
"def",
"clear_decimal_values",
"(",
"self",
")",
":",
"if",
"self",
".",
"_decimal_values_metadata",
"[",
"'required'",
"]",
"or",
"self",
".",
"_decimal_values_metadata",
"[",
"'read_only'",
"]",
":",
"raise",
"NoAccess",
"(",
")",
"self",
".",
"my_osid_object_... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1293-L1299 |
mitsei/dlkit | dlkit/records/osid/base_records.py | edXBaseFormRecord._init_map | def _init_map(self):
"""stub"""
self.my_osid_object_form._my_map['attempts'] = \
int(self._attempts_metadata['default_object_values'][0])
self.my_osid_object_form._my_map['weight'] = \
float(self._weight_metadata['default_object_values'][0])
# self.my_osid_object_... | python | def _init_map(self):
"""stub"""
self.my_osid_object_form._my_map['attempts'] = \
int(self._attempts_metadata['default_object_values'][0])
self.my_osid_object_form._my_map['weight'] = \
float(self._weight_metadata['default_object_values'][0])
# self.my_osid_object_... | [
"def",
"_init_map",
"(",
"self",
")",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'attempts'",
"]",
"=",
"int",
"(",
"self",
".",
"_attempts_metadata",
"[",
"'default_object_values'",
"]",
"[",
"0",
"]",
")",
"self",
".",
"my_osid_object_f... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1373-L1384 |
mitsei/dlkit | dlkit/records/osid/base_records.py | edXBaseFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._attempts_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'attempts'),
'element_label': 'Attempts',
'instruction... | python | def _init_metadata(self):
"""stub"""
self._attempts_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'attempts'),
'element_label': 'Attempts',
'instruction... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_attempts_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
"_authority",
",",
"self",
".",
"my_osid_object_form",
".",
"_namespace",
",",
"'attempts'",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1386-L1470 |
mitsei/dlkit | dlkit/records/osid/base_records.py | edXBaseFormRecord.add_attempts | def add_attempts(self, attempts):
"""stub"""
if attempts is None:
raise NullArgument('attempts cannot be None')
if not self.my_osid_object_form._is_valid_integer(
attempts, self.get_attempts_metadata()):
raise InvalidArgument('attempts')
self.my_os... | python | def add_attempts(self, attempts):
"""stub"""
if attempts is None:
raise NullArgument('attempts cannot be None')
if not self.my_osid_object_form._is_valid_integer(
attempts, self.get_attempts_metadata()):
raise InvalidArgument('attempts')
self.my_os... | [
"def",
"add_attempts",
"(",
"self",
",",
"attempts",
")",
":",
"if",
"attempts",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'attempts cannot be None'",
")",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_integer",
"(",
"attempts",
",",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1492-L1499 |
mitsei/dlkit | dlkit/records/osid/base_records.py | edXBaseFormRecord.add_weight | def add_weight(self, weight):
"""stub"""
if weight is None:
raise NullArgument('weight cannot be None')
if not self.my_osid_object_form._is_valid_decimal(
weight, self.get_weight_metadata()):
raise InvalidArgument('weight')
self.my_osid_object_form... | python | def add_weight(self, weight):
"""stub"""
if weight is None:
raise NullArgument('weight cannot be None')
if not self.my_osid_object_form._is_valid_decimal(
weight, self.get_weight_metadata()):
raise InvalidArgument('weight')
self.my_osid_object_form... | [
"def",
"add_weight",
"(",
"self",
",",
"weight",
")",
":",
"if",
"weight",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'weight cannot be None'",
")",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_decimal",
"(",
"weight",
",",
"self",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1506-L1513 |
mitsei/dlkit | dlkit/records/osid/base_records.py | edXBaseFormRecord.add_showanswer | def add_showanswer(self, showanswer):
"""stub"""
if showanswer is None:
raise NullArgument('showanswer cannot be None')
if not self.my_osid_object_form._is_valid_string(
showanswer, self.get_showanswer_metadata()):
raise InvalidArgument('showanswer')
... | python | def add_showanswer(self, showanswer):
"""stub"""
if showanswer is None:
raise NullArgument('showanswer cannot be None')
if not self.my_osid_object_form._is_valid_string(
showanswer, self.get_showanswer_metadata()):
raise InvalidArgument('showanswer')
... | [
"def",
"add_showanswer",
"(",
"self",
",",
"showanswer",
")",
":",
"if",
"showanswer",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'showanswer cannot be None'",
")",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_string",
"(",
"showanswer",... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1532-L1539 |
mitsei/dlkit | dlkit/records/osid/base_records.py | edXBaseFormRecord.add_markdown | def add_markdown(self, markdown):
"""stub"""
if markdown is None:
raise NullArgument('markdown cannot be None')
if not self.my_osid_object_form._is_valid_string(
markdown, self.get_markdown_metadata()):
raise InvalidArgument('markdown')
self.my_osi... | python | def add_markdown(self, markdown):
"""stub"""
if markdown is None:
raise NullArgument('markdown cannot be None')
if not self.my_osid_object_form._is_valid_string(
markdown, self.get_markdown_metadata()):
raise InvalidArgument('markdown')
self.my_osi... | [
"def",
"add_markdown",
"(",
"self",
",",
"markdown",
")",
":",
"if",
"markdown",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'markdown cannot be None'",
")",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_string",
"(",
"markdown",
",",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1546-L1553 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TimeValueRecord.get_time_as_string | def get_time_as_string(self):
"""stub"""
if self.has_time():
return (str(self.time['hours']).zfill(2) + ':' +
str(self.time['minutes']).zfill(2) + ':' +
str(self.time['seconds']).zfill(2))
raise IllegalState() | python | def get_time_as_string(self):
"""stub"""
if self.has_time():
return (str(self.time['hours']).zfill(2) + ':' +
str(self.time['minutes']).zfill(2) + ':' +
str(self.time['seconds']).zfill(2))
raise IllegalState() | [
"def",
"get_time_as_string",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_time",
"(",
")",
":",
"return",
"(",
"str",
"(",
"self",
".",
"time",
"[",
"'hours'",
"]",
")",
".",
"zfill",
"(",
"2",
")",
"+",
"':'",
"+",
"str",
"(",
"self",
".",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1574-L1580 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TimeValueFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._min_time_value = None
self._max_time_value = None
self._time_value_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'tim... | python | def _init_metadata(self):
"""stub"""
self._min_time_value = None
self._max_time_value = None
self._time_value_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'tim... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_min_time_value",
"=",
"None",
"self",
".",
"_max_time_value",
"=",
"None",
"self",
".",
"_time_value_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1602-L1624 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TimeValueFormRecord._convert_duration_to_hhmmss | def _convert_duration_to_hhmmss(self, duration):
"""stub"""
time_secs = duration.seconds
min_, sec = divmod(time_secs, 60)
hour, min_ = divmod(min_, 60)
results = {
'hours': hour,
'minutes': min_,
'seconds': sec
}
return result... | python | def _convert_duration_to_hhmmss(self, duration):
"""stub"""
time_secs = duration.seconds
min_, sec = divmod(time_secs, 60)
hour, min_ = divmod(min_, 60)
results = {
'hours': hour,
'minutes': min_,
'seconds': sec
}
return result... | [
"def",
"_convert_duration_to_hhmmss",
"(",
"self",
",",
"duration",
")",
":",
"time_secs",
"=",
"duration",
".",
"seconds",
"min_",
",",
"sec",
"=",
"divmod",
"(",
"time_secs",
",",
"60",
")",
"hour",
",",
"min_",
"=",
"divmod",
"(",
"min_",
",",
"60",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1626-L1637 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TimeValueFormRecord._convert_string_to_hhmmss | def _convert_string_to_hhmmss(self, string):
"""stub"""
# assume input string is 'hh:mm:ss'
components = string.split(':')
if len(components) != 3:
raise InvalidArgument('time input string must be hh:mm:ss format')
return {
'hours': int(components[0]),
... | python | def _convert_string_to_hhmmss(self, string):
"""stub"""
# assume input string is 'hh:mm:ss'
components = string.split(':')
if len(components) != 3:
raise InvalidArgument('time input string must be hh:mm:ss format')
return {
'hours': int(components[0]),
... | [
"def",
"_convert_string_to_hhmmss",
"(",
"self",
",",
"string",
")",
":",
"# assume input string is 'hh:mm:ss'",
"components",
"=",
"string",
".",
"split",
"(",
"':'",
")",
"if",
"len",
"(",
"components",
")",
"!=",
"3",
":",
"raise",
"InvalidArgument",
"(",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1639-L1649 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TimeValueFormRecord.set_time_value | def set_time_value(self, value=None):
"""stub"""
if value is None:
raise NullArgument()
if self.get_time_value_metadata().is_read_only():
raise NoAccess()
if self.my_osid_object_form._is_valid_duration(
value,
self.get_time_value_me... | python | def set_time_value(self, value=None):
"""stub"""
if value is None:
raise NullArgument()
if self.get_time_value_metadata().is_read_only():
raise NoAccess()
if self.my_osid_object_form._is_valid_duration(
value,
self.get_time_value_me... | [
"def",
"set_time_value",
"(",
"self",
",",
"value",
"=",
"None",
")",
":",
"if",
"value",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"self",
".",
"get_time_value_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"NoAccess... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1655-L1675 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TimeValueFormRecord.clear_time_value | def clear_time_value(self):
"""stub"""
if (self.get_time_value_metadata().is_read_only() or
self.get_time_value_metadata().is_required()):
raise NoAccess()
self.my_osid_object_form._my_map['timeValue'] = \
dict(self.get_time_value_metadata().get_default_du... | python | def clear_time_value(self):
"""stub"""
if (self.get_time_value_metadata().is_read_only() or
self.get_time_value_metadata().is_required()):
raise NoAccess()
self.my_osid_object_form._my_map['timeValue'] = \
dict(self.get_time_value_metadata().get_default_du... | [
"def",
"clear_time_value",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_time_value_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_time_value_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
":",
"raise",
"NoAccess... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1677-L1683 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.has_files | def has_files(self):
"""stub"""
# I had to add the following check because file record types
# don't seem to be implemented
# correctly for raw edx Question objects
if 'fileIds' not in self.my_osid_object._my_map:
return False
return bool(self.my_osid_object._... | python | def has_files(self):
"""stub"""
# I had to add the following check because file record types
# don't seem to be implemented
# correctly for raw edx Question objects
if 'fileIds' not in self.my_osid_object._my_map:
return False
return bool(self.my_osid_object._... | [
"def",
"has_files",
"(",
"self",
")",
":",
"# I had to add the following check because file record types",
"# don't seem to be implemented",
"# correctly for raw edx Question objects",
"if",
"'fileIds'",
"not",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
":",
"return",... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1691-L1698 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_files_map | def get_files_map(self):
"""stub"""
files_map = {}
if self.has_files():
for label in self.my_osid_object._my_map['fileIds']:
asset_content = self._get_asset_content(
Id(self.my_osid_object._my_map['fileIds'][label]['assetId']),
... | python | def get_files_map(self):
"""stub"""
files_map = {}
if self.has_files():
for label in self.my_osid_object._my_map['fileIds']:
asset_content = self._get_asset_content(
Id(self.my_osid_object._my_map['fileIds'][label]['assetId']),
... | [
"def",
"get_files_map",
"(",
"self",
")",
":",
"files_map",
"=",
"{",
"}",
"if",
"self",
".",
"has_files",
"(",
")",
":",
"for",
"label",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileIds'",
"]",
":",
"asset_content",
"=",
"self",
"."... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1702-L1715 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_file_urls_map | def get_file_urls_map(self):
"""stub"""
file_urls_map = {}
if self.has_files():
for label in self.my_osid_object._my_map['fileIds']:
label_map = self.my_osid_object._my_map['fileIds'][label]
if 'assetContentId' in label_map and bool(label_map['assetCon... | python | def get_file_urls_map(self):
"""stub"""
file_urls_map = {}
if self.has_files():
for label in self.my_osid_object._my_map['fileIds']:
label_map = self.my_osid_object._my_map['fileIds'][label]
if 'assetContentId' in label_map and bool(label_map['assetCon... | [
"def",
"get_file_urls_map",
"(",
"self",
")",
":",
"file_urls_map",
"=",
"{",
"}",
"if",
"self",
".",
"has_files",
"(",
")",
":",
"for",
"label",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileIds'",
"]",
":",
"label_map",
"=",
"self",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1719-L1735 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_asset_ids | def get_asset_ids(self):
"""stub"""
asset_ids = []
for f in self.my_osid_object._my_map['fileIds']:
asset_ids.append(Id(self.my_osid_object._my_map['fileIds'][f]['assetId']))
return IdList(asset_ids) | python | def get_asset_ids(self):
"""stub"""
asset_ids = []
for f in self.my_osid_object._my_map['fileIds']:
asset_ids.append(Id(self.my_osid_object._my_map['fileIds'][f]['assetId']))
return IdList(asset_ids) | [
"def",
"get_asset_ids",
"(",
"self",
")",
":",
"asset_ids",
"=",
"[",
"]",
"for",
"f",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileIds'",
"]",
":",
"asset_ids",
".",
"append",
"(",
"Id",
"(",
"self",
".",
"my_osid_object",
".",
"_my... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1752-L1757 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_asset_ids_map | def get_asset_ids_map(self):
"""stub"""
asset_ids_map = {}
for label, asset_obj in self.my_osid_object._my_map['fileIds'].items():
asset_ids_map[label] = asset_obj
return asset_ids_map | python | def get_asset_ids_map(self):
"""stub"""
asset_ids_map = {}
for label, asset_obj in self.my_osid_object._my_map['fileIds'].items():
asset_ids_map[label] = asset_obj
return asset_ids_map | [
"def",
"get_asset_ids_map",
"(",
"self",
")",
":",
"asset_ids_map",
"=",
"{",
"}",
"for",
"label",
",",
"asset_obj",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileIds'",
"]",
".",
"items",
"(",
")",
":",
"asset_ids_map",
"[",
"label",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1759-L1764 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_asset_id_by_label | def get_asset_id_by_label(self, label):
"""stub"""
if self.has_file(label):
return Id(self.my_osid_object._my_map['fileIds'][label]['assetId'])
raise IllegalState() | python | def get_asset_id_by_label(self, label):
"""stub"""
if self.has_file(label):
return Id(self.my_osid_object._my_map['fileIds'][label]['assetId'])
raise IllegalState() | [
"def",
"get_asset_id_by_label",
"(",
"self",
",",
"label",
")",
":",
"if",
"self",
".",
"has_file",
"(",
"label",
")",
":",
"return",
"Id",
"(",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileIds'",
"]",
"[",
"label",
"]",
"[",
"'assetId'",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1766-L1770 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_file_by_label | def get_file_by_label(self, label, asset_content_type=None):
"""stub"""
return self._get_asset_content(self.get_asset_id_by_label(label), asset_content_type).get_data() | python | def get_file_by_label(self, label, asset_content_type=None):
"""stub"""
return self._get_asset_content(self.get_asset_id_by_label(label), asset_content_type).get_data() | [
"def",
"get_file_by_label",
"(",
"self",
",",
"label",
",",
"asset_content_type",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get_asset_content",
"(",
"self",
".",
"get_asset_id_by_label",
"(",
"label",
")",
",",
"asset_content_type",
")",
".",
"get_data",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1772-L1774 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord.get_url_by_label | def get_url_by_label(self, label, asset_content_type=None):
"""stub"""
return self._get_asset_content(self.get_asset_id_by_label(label)).get_url() | python | def get_url_by_label(self, label, asset_content_type=None):
"""stub"""
return self._get_asset_content(self.get_asset_id_by_label(label)).get_url() | [
"def",
"get_url_by_label",
"(",
"self",
",",
"label",
",",
"asset_content_type",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get_asset_content",
"(",
"self",
".",
"get_asset_id_by_label",
"(",
"label",
")",
")",
".",
"get_url",
"(",
")"
] | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1776-L1778 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesRecord._update_object_map | def _update_object_map(self, obj_map):
"""loop through all the keys in self.my_osid_object._my_map, and
see if any of them contain text like "AssetContent:<label>"
If so, assume it is markup (?), replace the string with asset_content.get_url()"""
# TODO: Look for <img> tags to add in alt... | python | def _update_object_map(self, obj_map):
"""loop through all the keys in self.my_osid_object._my_map, and
see if any of them contain text like "AssetContent:<label>"
If so, assume it is markup (?), replace the string with asset_content.get_url()"""
# TODO: Look for <img> tags to add in alt... | [
"def",
"_update_object_map",
"(",
"self",
",",
"obj_map",
")",
":",
"# TODO: Look for <img> tags to add in alt-text and description",
"# TODO: Look for <video> and <audio> tags to add in description, transcripts and vtt files?",
"try",
":",
"super",
"(",
"FilesRecord",
",",
"self",
... | loop through all the keys in self.my_osid_object._my_map, and
see if any of them contain text like "AssetContent:<label>"
If so, assume it is markup (?), replace the string with asset_content.get_url() | [
"loop",
"through",
"all",
"the",
"keys",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"and",
"see",
"if",
"any",
"of",
"them",
"contain",
"text",
"like",
"AssetContent",
":",
"<label",
">",
"If",
"so",
"assume",
"it",
"is",
"markup",
"(",
"?",
... | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1783-L1930 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._files_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'files'),
'element_label': 'Files',
'instructions': 'ente... | python | def _init_metadata(self):
"""stub"""
self._files_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'files'),
'element_label': 'Files',
'instructions': 'ente... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_files_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
"_authority",
",",
"self",
".",
"my_osid_object_form",
".",
"_namespace",
",",
"'files'",
")",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1949-L1994 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesFormRecord.add_asset | def add_asset(self, asset_id, asset_content_id=None, label=None, asset_content_type=None):
"""stub"""
if asset_id is None:
raise NullArgument('asset_id cannot be None')
if not isinstance(asset_id, Id):
raise InvalidArgument('asset_id must be an Id instance')
if as... | python | def add_asset(self, asset_id, asset_content_id=None, label=None, asset_content_type=None):
"""stub"""
if asset_id is None:
raise NullArgument('asset_id cannot be None')
if not isinstance(asset_id, Id):
raise InvalidArgument('asset_id must be an Id instance')
if as... | [
"def",
"add_asset",
"(",
"self",
",",
"asset_id",
",",
"asset_content_id",
"=",
"None",
",",
"label",
"=",
"None",
",",
"asset_content_type",
"=",
"None",
")",
":",
"if",
"asset_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'asset_id cannot be None'",... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2004-L2031 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesFormRecord.add_file | def add_file(self,
asset_data,
label=None,
asset_type=None,
asset_content_type=None,
asset_content_record_types=None,
asset_name='',
asset_description=''):
"""stub"""
if asset_data is N... | python | def add_file(self,
asset_data,
label=None,
asset_type=None,
asset_content_type=None,
asset_content_record_types=None,
asset_name='',
asset_description=''):
"""stub"""
if asset_data is N... | [
"def",
"add_file",
"(",
"self",
",",
"asset_data",
",",
"label",
"=",
"None",
",",
"asset_type",
"=",
"None",
",",
"asset_content_type",
"=",
"None",
",",
"asset_content_record_types",
"=",
"None",
",",
"asset_name",
"=",
"''",
",",
"asset_description",
"=",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2033-L2073 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesFormRecord.clear_file | def clear_file(self, label):
"""stub"""
rm = self.my_osid_object_form._get_provider_manager('REPOSITORY')
catalog_id_str = ''
if 'assignedBankIds' in self.my_osid_object_form._my_map:
catalog_id_str = self.my_osid_object_form._my_map['assignedBankIds'][0]
elif 'assi... | python | def clear_file(self, label):
"""stub"""
rm = self.my_osid_object_form._get_provider_manager('REPOSITORY')
catalog_id_str = ''
if 'assignedBankIds' in self.my_osid_object_form._my_map:
catalog_id_str = self.my_osid_object_form._my_map['assignedBankIds'][0]
elif 'assi... | [
"def",
"clear_file",
"(",
"self",
",",
"label",
")",
":",
"rm",
"=",
"self",
".",
"my_osid_object_form",
".",
"_get_provider_manager",
"(",
"'REPOSITORY'",
")",
"catalog_id_str",
"=",
"''",
"if",
"'assignedBankIds'",
"in",
"self",
".",
"my_osid_object_form",
"."... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2075-L2106 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FilesFormRecord.clear_files | def clear_files(self):
"""stub"""
# This could also be implemented by iterating over self.clear_file()
if self._files_metadata['required'] or self._files_metadata['read_only']:
raise NoAccess()
rm = self.my_osid_object_form._get_provider_manager('REPOSITORY')
catalog... | python | def clear_files(self):
"""stub"""
# This could also be implemented by iterating over self.clear_file()
if self._files_metadata['required'] or self._files_metadata['read_only']:
raise NoAccess()
rm = self.my_osid_object_form._get_provider_manager('REPOSITORY')
catalog... | [
"def",
"clear_files",
"(",
"self",
")",
":",
"# This could also be implemented by iterating over self.clear_file()",
"if",
"self",
".",
"_files_metadata",
"[",
"'required'",
"]",
"or",
"self",
".",
"_files_metadata",
"[",
"'read_only'",
"]",
":",
"raise",
"NoAccess",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2108-L2141 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileRecord.has_file_url | def has_file_url(self):
"""stub"""
return bool(self._get_asset_content(
Id(self.my_osid_object._my_map['fileId']['assetId']),
self.my_osid_object._my_map['fileId']['assetContentTypeId']).has_url()) | python | def has_file_url(self):
"""stub"""
return bool(self._get_asset_content(
Id(self.my_osid_object._my_map['fileId']['assetId']),
self.my_osid_object._my_map['fileId']['assetContentTypeId']).has_url()) | [
"def",
"has_file_url",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"_get_asset_content",
"(",
"Id",
"(",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileId'",
"]",
"[",
"'assetId'",
"]",
")",
",",
"self",
".",
"my_osid_object",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2151-L2155 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileRecord.get_file_url | def get_file_url(self):
"""stub"""
if self.has_file_url():
return self._get_asset_content(
Id(self.my_osid_object._my_map['fileId']['assetId']),
self.my_osid_object._my_map['fileId']['assetContentTypeId']).get_url()
raise IllegalState() | python | def get_file_url(self):
"""stub"""
if self.has_file_url():
return self._get_asset_content(
Id(self.my_osid_object._my_map['fileId']['assetId']),
self.my_osid_object._my_map['fileId']['assetContentTypeId']).get_url()
raise IllegalState() | [
"def",
"get_file_url",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_file_url",
"(",
")",
":",
"return",
"self",
".",
"_get_asset_content",
"(",
"Id",
"(",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileId'",
"]",
"[",
"'assetId'",
"]",
")",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2163-L2169 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileRecord.get_file | def get_file(self):
"""stub"""
if self.has_file_asset():
return self._get_asset_content(
Id(self.my_osid_object._my_map['fileId']['assetId']),
self.my_osid_object._my_map['fileId']['assetContentTypeId']).get_data()
raise IllegalState() | python | def get_file(self):
"""stub"""
if self.has_file_asset():
return self._get_asset_content(
Id(self.my_osid_object._my_map['fileId']['assetId']),
self.my_osid_object._my_map['fileId']['assetContentTypeId']).get_data()
raise IllegalState() | [
"def",
"get_file",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_file_asset",
"(",
")",
":",
"return",
"self",
".",
"_get_asset_content",
"(",
"Id",
"(",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'fileId'",
"]",
"[",
"'assetId'",
"]",
")",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2171-L2177 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._file_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'file'),
'element_label': 'File',
'instructions': 'accepts... | python | def _init_metadata(self):
"""stub"""
self._file_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'file'),
'element_label': 'File',
'instructions': 'accepts... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_file_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
"_authority",
",",
"self",
".",
"my_osid_object_form",
".",
"_namespace",
",",
"'file'",
")",
",... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2200-L2215 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileFormRecord.set_file | def set_file(self,
asset_data=None,
asset_type=None,
asset_content_type=None,
asset_name='',
asset_description=''):
"""stub"""
if asset_data is None:
raise NullArgument()
if not isinstance(asset_data... | python | def set_file(self,
asset_data=None,
asset_type=None,
asset_content_type=None,
asset_name='',
asset_description=''):
"""stub"""
if asset_data is None:
raise NullArgument()
if not isinstance(asset_data... | [
"def",
"set_file",
"(",
"self",
",",
"asset_data",
"=",
"None",
",",
"asset_type",
"=",
"None",
",",
"asset_content_type",
"=",
"None",
",",
"asset_name",
"=",
"''",
",",
"asset_description",
"=",
"''",
")",
":",
"if",
"asset_data",
"is",
"None",
":",
"r... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2221-L2243 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileFormRecord.set_asset | def set_asset(self, asset_id, asset_content_type=None):
"""stub"""
if asset_id is None:
raise NullArgument('asset_id cannot be None')
if not isinstance(asset_id, Id):
raise InvalidArgument('asset_id must be an instance of Id')
if asset_content_type is not None and... | python | def set_asset(self, asset_id, asset_content_type=None):
"""stub"""
if asset_id is None:
raise NullArgument('asset_id cannot be None')
if not isinstance(asset_id, Id):
raise InvalidArgument('asset_id must be an instance of Id')
if asset_content_type is not None and... | [
"def",
"set_asset",
"(",
"self",
",",
"asset_id",
",",
"asset_content_type",
"=",
"None",
")",
":",
"if",
"asset_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'asset_id cannot be None'",
")",
"if",
"not",
"isinstance",
"(",
"asset_id",
",",
"Id",
")... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2245-L2258 |
mitsei/dlkit | dlkit/records/osid/base_records.py | FileFormRecord.clear_file | def clear_file(self):
"""stub"""
if (self.get_file_metadata().is_read_only() or
self.get_file_metadata().is_required()):
raise NoAccess()
if 'assetId' in self.my_osid_object_form._my_map['fileId']:
rm = self.my_osid_object_form._get_provider_manager('REPOS... | python | def clear_file(self):
"""stub"""
if (self.get_file_metadata().is_read_only() or
self.get_file_metadata().is_required()):
raise NoAccess()
if 'assetId' in self.my_osid_object_form._my_map['fileId']:
rm = self.my_osid_object_form._get_provider_manager('REPOS... | [
"def",
"clear_file",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_file_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_file_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
":",
"raise",
"NoAccess",
"(",
")",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2260-L2295 |
mitsei/dlkit | dlkit/records/osid/base_records.py | ColorCoordinateRecord.get_color_coordinate | def get_color_coordinate(self):
"""stub"""
if self.has_color_coordinate():
color_dict = self.my_osid_object._my_map['colorCoordinate']
return RGBColorCoordinate(values=color_dict['values'],
uncertainty_minus=color_dict['uncertaintyMinus'],
... | python | def get_color_coordinate(self):
"""stub"""
if self.has_color_coordinate():
color_dict = self.my_osid_object._my_map['colorCoordinate']
return RGBColorCoordinate(values=color_dict['values'],
uncertainty_minus=color_dict['uncertaintyMinus'],
... | [
"def",
"get_color_coordinate",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_color_coordinate",
"(",
")",
":",
"color_dict",
"=",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'colorCoordinate'",
"]",
"return",
"RGBColorCoordinate",
"(",
"values",
"=",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2307-L2314 |
mitsei/dlkit | dlkit/records/osid/base_records.py | ColorCoordinateRecord._update_object_map | def _update_object_map(self, obj_map):
"""stub"""
if self.has_color_coordinate() and \
self.get_color_coordinate().get_coordinate_type() == RGB_COLOR_COORDINATE:
obj_map['colorCoordinate']['hexValue'] = str(self.get_color_coordinate())
try:
super(ColorCoor... | python | def _update_object_map(self, obj_map):
"""stub"""
if self.has_color_coordinate() and \
self.get_color_coordinate().get_coordinate_type() == RGB_COLOR_COORDINATE:
obj_map['colorCoordinate']['hexValue'] = str(self.get_color_coordinate())
try:
super(ColorCoor... | [
"def",
"_update_object_map",
"(",
"self",
",",
"obj_map",
")",
":",
"if",
"self",
".",
"has_color_coordinate",
"(",
")",
"and",
"self",
".",
"get_color_coordinate",
"(",
")",
".",
"get_coordinate_type",
"(",
")",
"==",
"RGB_COLOR_COORDINATE",
":",
"obj_map",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2318-L2326 |
mitsei/dlkit | dlkit/records/osid/base_records.py | ColorCoordinateFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._min_decimal_value = None
self._max_decimal_value = None
self._color_coordinate_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
... | python | def _init_metadata(self):
"""stub"""
self._min_decimal_value = None
self._max_decimal_value = None
self._color_coordinate_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_min_decimal_value",
"=",
"None",
"self",
".",
"_max_decimal_value",
"=",
"None",
"self",
".",
"_color_coordinate_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2345-L2362 |
mitsei/dlkit | dlkit/records/osid/base_records.py | ColorCoordinateFormRecord.set_color_coordinate | def set_color_coordinate(self, coordinate=None):
"""stub"""
if coordinate is None:
raise NullArgument()
if self.get_color_coordinate_metadata().is_read_only():
raise NoAccess()
if not isinstance(coordinate, RGBColorCoordinate):
raise InvalidArgument('c... | python | def set_color_coordinate(self, coordinate=None):
"""stub"""
if coordinate is None:
raise NullArgument()
if self.get_color_coordinate_metadata().is_read_only():
raise NoAccess()
if not isinstance(coordinate, RGBColorCoordinate):
raise InvalidArgument('c... | [
"def",
"set_color_coordinate",
"(",
"self",
",",
"coordinate",
"=",
"None",
")",
":",
"if",
"coordinate",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"self",
".",
"get_color_coordinate_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2368-L2381 |
mitsei/dlkit | dlkit/records/osid/base_records.py | ColorCoordinateFormRecord.clear_color_coordinate | def clear_color_coordinate(self):
"""stub"""
if (self.get_color_coordinate_metadata().is_read_only() or
self.get_color_coordinate_metadata().is_required()):
raise NoAccess()
self.my_osid_object_form._my_map['colorCoordinate'] = \
dict(self.get_color_coordi... | python | def clear_color_coordinate(self):
"""stub"""
if (self.get_color_coordinate_metadata().is_read_only() or
self.get_color_coordinate_metadata().is_required()):
raise NoAccess()
self.my_osid_object_form._my_map['colorCoordinate'] = \
dict(self.get_color_coordi... | [
"def",
"clear_color_coordinate",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_color_coordinate_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_color_coordinate_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
":",
"r... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2383-L2389 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalFormRecord.get_start_date_metadata | def get_start_date_metadata(self):
"""Gets the metadata for a start date.
return: (osid.Metadata) - metadata for the date
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._start_date_metadata)
metadata.update({'existing_date_time_valu... | python | def get_start_date_metadata(self):
"""Gets the metadata for a start date.
return: (osid.Metadata) - metadata for the date
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._start_date_metadata)
metadata.update({'existing_date_time_valu... | [
"def",
"get_start_date_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_start_date_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_date_time_values'",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'s... | Gets the metadata for a start date.
return: (osid.Metadata) - metadata for the date
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"a",
"start",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2444-L2453 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalFormRecord.set_start_date | def set_start_date(self, date):
"""Sets the start date.
arg: date (osid.calendaring.DateTime): the new date
raise: InvalidArgument - ``date`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``date`` is ``null``
*compliance: ... | python | def set_start_date(self, date):
"""Sets the start date.
arg: date (osid.calendaring.DateTime): the new date
raise: InvalidArgument - ``date`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``date`` is ``null``
*compliance: ... | [
"def",
"set_start_date",
"(",
"self",
",",
"date",
")",
":",
"if",
"date",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'date cannot be None'",
")",
"if",
"self",
".",
"get_start_date_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"... | Sets the start date.
arg: date (osid.calendaring.DateTime): the new date
raise: InvalidArgument - ``date`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``date`` is ``null``
*compliance: mandatory -- This method must be implemente... | [
"Sets",
"the",
"start",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2458-L2474 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalFormRecord.clear_start_date | def clear_start_date(self):
"""Clears the start date.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_start_date_metadata().is_read_only() or
... | python | def clear_start_date(self):
"""Clears the start date.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_start_date_metadata().is_read_only() or
... | [
"def",
"clear_start_date",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_start_date_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_start_date_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
":",
"raise",
"NoAccess... | Clears the start date.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Clears",
"the",
"start",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2476-L2494 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalFormRecord.get_end_date_metadata | def get_end_date_metadata(self):
"""Gets the metadata for an end date.
return: (osid.Metadata) - metadata for the date
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._end_date_metadata)
metadata.update({'existing_date_time_values': ... | python | def get_end_date_metadata(self):
"""Gets the metadata for an end date.
return: (osid.Metadata) - metadata for the date
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._end_date_metadata)
metadata.update({'existing_date_time_values': ... | [
"def",
"get_end_date_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_end_date_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_date_time_values'",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'endDa... | Gets the metadata for an end date.
return: (osid.Metadata) - metadata for the date
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"an",
"end",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2498-L2507 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalFormRecord.set_end_date | def set_end_date(self, date):
"""Sets the end date.
arg: date (osid.calendaring.DateTime): the new date
raise: InvalidArgument - ``date`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``date`` is ``null``
*compliance: mand... | python | def set_end_date(self, date):
"""Sets the end date.
arg: date (osid.calendaring.DateTime): the new date
raise: InvalidArgument - ``date`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``date`` is ``null``
*compliance: mand... | [
"def",
"set_end_date",
"(",
"self",
",",
"date",
")",
":",
"if",
"date",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'date cannot be None'",
")",
"if",
"self",
".",
"get_end_date_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"NoAc... | Sets the end date.
arg: date (osid.calendaring.DateTime): the new date
raise: InvalidArgument - ``date`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``date`` is ``null``
*compliance: mandatory -- This method must be implemented.... | [
"Sets",
"the",
"end",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2512-L2528 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalFormRecord.clear_end_date | def clear_end_date(self):
"""Clears the end date.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_end_date_metadata().is_read_only() or
... | python | def clear_end_date(self):
"""Clears the end date.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_end_date_metadata().is_read_only() or
... | [
"def",
"clear_end_date",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_end_date_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_end_date_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
":",
"raise",
"NoAccess",
"... | Clears the end date.
raise: NoAccess - ``Metadata.isRequired()`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Clears",
"the",
"end",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2530-L2542 |
mitsei/dlkit | dlkit/records/osid/base_records.py | TemporalRecord.get_end_date | def get_end_date(self):
"""Gets the end date.
return: (osid.calendaring.DateTime) - the end date
*compliance: mandatory -- This method must be implemented.*
"""
edate = self.my_osid_object._my_map['endDate']
return DateTime(
edate.year,
edate.mon... | python | def get_end_date(self):
"""Gets the end date.
return: (osid.calendaring.DateTime) - the end date
*compliance: mandatory -- This method must be implemented.*
"""
edate = self.my_osid_object._my_map['endDate']
return DateTime(
edate.year,
edate.mon... | [
"def",
"get_end_date",
"(",
"self",
")",
":",
"edate",
"=",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'endDate'",
"]",
"return",
"DateTime",
"(",
"edate",
".",
"year",
",",
"edate",
".",
"month",
",",
"edate",
".",
"day",
",",
"edate",
".",
... | Gets the end date.
return: (osid.calendaring.DateTime) - the end date
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"end",
"date",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2580-L2595 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.get_provider_metadata | def get_provider_metadata(self):
"""Gets the metadata for a provider.
return: (osid.Metadata) - metadata for the provider
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._provider_metadata)
metadata.update({'existing_id_values': self... | python | def get_provider_metadata(self):
"""Gets the metadata for a provider.
return: (osid.Metadata) - metadata for the provider
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._provider_metadata)
metadata.update({'existing_id_values': self... | [
"def",
"get_provider_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_provider_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_id_values'",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'providerId'"... | Gets the metadata for a provider.
return: (osid.Metadata) - metadata for the provider
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"a",
"provider",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2675-L2684 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.set_provider | def set_provider(self, provider_id):
"""Sets a provider.
arg: provider_id (osid.id.Id): the new provider
raise: InvalidArgument - ``provider_id`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``provider_id`` is ``null``
*c... | python | def set_provider(self, provider_id):
"""Sets a provider.
arg: provider_id (osid.id.Id): the new provider
raise: InvalidArgument - ``provider_id`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``provider_id`` is ``null``
*c... | [
"def",
"set_provider",
"(",
"self",
",",
"provider_id",
")",
":",
"if",
"provider_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'provider_id cannot be None'",
")",
"if",
"self",
".",
"get_provider_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":... | Sets a provider.
arg: provider_id (osid.id.Id): the new provider
raise: InvalidArgument - ``provider_id`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``provider_id`` is ``null``
*compliance: mandatory -- This method must be impl... | [
"Sets",
"a",
"provider",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2689-L2705 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.get_branding_metadata | def get_branding_metadata(self):
"""Gets the metadata for the asset branding.
return: (osid.Metadata) - metadata for the asset branding.
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._branding_metadata)
metadata.update({'existing_i... | python | def get_branding_metadata(self):
"""Gets the metadata for the asset branding.
return: (osid.Metadata) - metadata for the asset branding.
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._branding_metadata)
metadata.update({'existing_i... | [
"def",
"get_branding_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_branding_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_id_values'",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'brandingIds'... | Gets the metadata for the asset branding.
return: (osid.Metadata) - metadata for the asset branding.
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"asset",
"branding",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2722-L2731 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.set_branding | def set_branding(self, asset_ids):
"""Sets the branding.
arg: asset_ids (osid.id.Id[]): the new assets
raise: InvalidArgument - ``asset_ids`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``asset_ids`` is ``null``
*complia... | python | def set_branding(self, asset_ids):
"""Sets the branding.
arg: asset_ids (osid.id.Id[]): the new assets
raise: InvalidArgument - ``asset_ids`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``asset_ids`` is ``null``
*complia... | [
"def",
"set_branding",
"(",
"self",
",",
"asset_ids",
")",
":",
"if",
"asset_ids",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'asset_ids cannot be None'",
")",
"if",
"self",
".",
"get_branding_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"... | Sets the branding.
arg: asset_ids (osid.id.Id[]): the new assets
raise: InvalidArgument - ``asset_ids`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``asset_ids`` is ``null``
*compliance: mandatory -- This method must be implemen... | [
"Sets",
"the",
"branding",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2736-L2759 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.clear_branding | def clear_branding(self):
"""Removes the branding.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_branding_metadata().is_read_only() o... | python | def clear_branding(self):
"""Removes the branding.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if (self.get_branding_metadata().is_read_only() o... | [
"def",
"clear_branding",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_branding_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
"or",
"self",
".",
"get_branding_metadata",
"(",
")",
".",
"is_required",
"(",
")",
")",
":",
"raise",
"NoAccess",
"... | Removes the branding.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Removes",
"the",
"branding",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2761-L2772 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.get_license_metadata | def get_license_metadata(self):
"""Gets the metadata for the license.
return: (osid.Metadata) - metadata for the license
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._license_metadata)
metadata.update({'existing_string_values': se... | python | def get_license_metadata(self):
"""Gets the metadata for the license.
return: (osid.Metadata) - metadata for the license
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._license_metadata)
metadata.update({'existing_string_values': se... | [
"def",
"get_license_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_license_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_string_values'",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'license'",... | Gets the metadata for the license.
return: (osid.Metadata) - metadata for the license
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"the",
"license",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2776-L2785 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableFormRecord.set_license | def set_license(self, license_):
"""Sets the license.
arg: license (string): the new license
raise: InvalidArgument - ``license`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``license`` is ``null``
*compliance: mandatory... | python | def set_license(self, license_):
"""Sets the license.
arg: license (string): the new license
raise: InvalidArgument - ``license`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``license`` is ``null``
*compliance: mandatory... | [
"def",
"set_license",
"(",
"self",
",",
"license_",
")",
":",
"if",
"license_",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'license cannot be None'",
")",
"if",
"not",
"utilities",
".",
"is_string",
"(",
"license_",
")",
":",
"raise",
"InvalidArgument",... | Sets the license.
arg: license (string): the new license
raise: InvalidArgument - ``license`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``license`` is ``null``
*compliance: mandatory -- This method must be implemented.* | [
"Sets",
"the",
"license",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2790-L2808 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableRecord.get_provider_id | def get_provider_id(self):
"""Gets the ``Id`` of the provider.
return: (osid.id.Id) - the provider ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
if ('providerId' not in self.my_osid_object._my_map or
not self.my_osid_object._my_map['prov... | python | def get_provider_id(self):
"""Gets the ``Id`` of the provider.
return: (osid.id.Id) - the provider ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
if ('providerId' not in self.my_osid_object._my_map or
not self.my_osid_object._my_map['prov... | [
"def",
"get_provider_id",
"(",
"self",
")",
":",
"if",
"(",
"'providerId'",
"not",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
"or",
"not",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'providerId'",
"]",
")",
":",
"raise",
"IllegalState",
... | Gets the ``Id`` of the provider.
return: (osid.id.Id) - the provider ``Id``
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"Id",
"of",
"the",
"provider",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2830-L2840 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableRecord.get_branding_ids | def get_branding_ids(self):
"""Gets the branding asset ``Ids``.
return: (osid.id.IdList) - a list of asset ``Ids``
*compliance: mandatory -- This method must be implemented.*
"""
if 'brandingIds' not in self.my_osid_object._my_map:
return IdList([])
id_list ... | python | def get_branding_ids(self):
"""Gets the branding asset ``Ids``.
return: (osid.id.IdList) - a list of asset ``Ids``
*compliance: mandatory -- This method must be implemented.*
"""
if 'brandingIds' not in self.my_osid_object._my_map:
return IdList([])
id_list ... | [
"def",
"get_branding_ids",
"(",
"self",
")",
":",
"if",
"'brandingIds'",
"not",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
":",
"return",
"IdList",
"(",
"[",
"]",
")",
"id_list",
"=",
"[",
"]",
"for",
"idstr",
"in",
"self",
".",
"my_osid_object... | Gets the branding asset ``Ids``.
return: (osid.id.IdList) - a list of asset ``Ids``
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"branding",
"asset",
"Ids",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2862-L2874 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableRecord.get_branding | def get_branding(self):
"""Gets a branding, such as an image or logo, expressed using the ``Asset`` interface.
return: (osid.repository.AssetList) - a list of assets
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
... | python | def get_branding(self):
"""Gets a branding, such as an image or logo, expressed using the ``Asset`` interface.
return: (osid.repository.AssetList) - a list of assets
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.*
... | [
"def",
"get_branding",
"(",
"self",
")",
":",
"mgr",
"=",
"self",
".",
"my_osid_object",
".",
"_get_provider_manager",
"(",
"'REPOSITORY'",
")",
"lookup_session",
"=",
"mgr",
".",
"get_asset_lookup_session",
"(",
")",
"lookup_session",
".",
"use_federated_repository... | Gets a branding, such as an image or logo, expressed using the ``Asset`` interface.
return: (osid.repository.AssetList) - a list of assets
raise: OperationFailed - unable to complete request
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"a",
"branding",
"such",
"as",
"an",
"image",
"or",
"logo",
"expressed",
"using",
"the",
"Asset",
"interface",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2878-L2889 |
mitsei/dlkit | dlkit/records/osid/base_records.py | SourceableRecord.get_license | def get_license(self):
"""Gets the terms of usage.
An empty license means the terms are unknown.
return: (osid.locale.DisplayText) - the license
*compliance: mandatory -- This method must be implemented.*
"""
if 'license' in self.my_osid_object._my_map:
lic... | python | def get_license(self):
"""Gets the terms of usage.
An empty license means the terms are unknown.
return: (osid.locale.DisplayText) - the license
*compliance: mandatory -- This method must be implemented.*
"""
if 'license' in self.my_osid_object._my_map:
lic... | [
"def",
"get_license",
"(",
"self",
")",
":",
"if",
"'license'",
"in",
"self",
".",
"my_osid_object",
".",
"_my_map",
":",
"license_text",
"=",
"self",
".",
"my_osid_object",
".",
"_my_map",
"[",
"'license'",
"]",
"return",
"DisplayText",
"(",
"display_text_map... | Gets the terms of usage.
An empty license means the terms are unknown.
return: (osid.locale.DisplayText) - the license
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"terms",
"of",
"usage",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2893-L2908 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageFormRecord.get_display_names_metadata | def get_display_names_metadata(self):
"""Gets the metadata for all display_names.
return: (osid.Metadata) - metadata for the display_names
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._display_names_metadata)
metadata.update({'exi... | python | def get_display_names_metadata(self):
"""Gets the metadata for all display_names.
return: (osid.Metadata) - metadata for the display_names
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._display_names_metadata)
metadata.update({'exi... | [
"def",
"get_display_names_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_display_names_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_string_values'",
":",
"[",
"t",
"[",
"'text'",
"]",
"for",
"t",
"in",
"self... | Gets the metadata for all display_names.
return: (osid.Metadata) - metadata for the display_names
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"all",
"display_names",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2961-L2970 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageFormRecord.get_descriptions_metadata | def get_descriptions_metadata(self):
"""Gets the metadata for all descriptions.
return: (osid.Metadata) - metadata for the descriptions
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._descriptions_metadata)
metadata.update({'existin... | python | def get_descriptions_metadata(self):
"""Gets the metadata for all descriptions.
return: (osid.Metadata) - metadata for the descriptions
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._descriptions_metadata)
metadata.update({'existin... | [
"def",
"get_descriptions_metadata",
"(",
"self",
")",
":",
"metadata",
"=",
"dict",
"(",
"self",
".",
"_descriptions_metadata",
")",
"metadata",
".",
"update",
"(",
"{",
"'existing_string_values'",
":",
"[",
"t",
"[",
"'text'",
"]",
"for",
"t",
"in",
"self",... | Gets the metadata for all descriptions.
return: (osid.Metadata) - metadata for the descriptions
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"metadata",
"for",
"all",
"descriptions",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2974-L2983 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageFormRecord.add_display_name | def add_display_name(self, display_name):
"""Adds a display_name.
arg: display_name (displayText): the new display name
raise: InvalidArgument - ``display_name`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``display_name`` is ``... | python | def add_display_name(self, display_name):
"""Adds a display_name.
arg: display_name (displayText): the new display name
raise: InvalidArgument - ``display_name`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``display_name`` is ``... | [
"def",
"add_display_name",
"(",
"self",
",",
"display_name",
")",
":",
"if",
"self",
".",
"get_display_names_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"NoAccess",
"(",
")",
"if",
"not",
"isinstance",
"(",
"display_name",
",",
"Display... | Adds a display_name.
arg: display_name (displayText): the new display name
raise: InvalidArgument - ``display_name`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``display_name`` is ``null``
*compliance: mandatory -- This method ... | [
"Adds",
"a",
"display_name",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L2988-L3002 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageFormRecord.remove_display_name_by_language | def remove_display_name_by_language(self, language_type):
"""Removes the specified display_name.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if ... | python | def remove_display_name_by_language(self, language_type):
"""Removes the specified display_name.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if ... | [
"def",
"remove_display_name_by_language",
"(",
"self",
",",
"language_type",
")",
":",
"if",
"self",
".",
"get_display_names_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"NoAccess",
"(",
")",
"if",
"not",
"isinstance",
"(",
"language_type",
... | Removes the specified display_name.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Removes",
"the",
"specified",
"display_name",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L3017-L3031 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageFormRecord.add_description | def add_description(self, description):
"""Adds a description.
arg: description (displayText): the new description
raise: InvalidArgument - ``description`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``description`` is ``null``
... | python | def add_description(self, description):
"""Adds a description.
arg: description (displayText): the new description
raise: InvalidArgument - ``description`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``description`` is ``null``
... | [
"def",
"add_description",
"(",
"self",
",",
"description",
")",
":",
"if",
"self",
".",
"get_descriptions_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"NoAccess",
"(",
")",
"if",
"not",
"isinstance",
"(",
"description",
",",
"DisplayText... | Adds a description.
arg: description (displayText): the new description
raise: InvalidArgument - ``description`` is invalid
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
raise: NullArgument - ``description`` is ``null``
*compliance: mandatory -- This method must ... | [
"Adds",
"a",
"description",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L3049-L3063 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageFormRecord.remove_description_by_language | def remove_description_by_language(self, language_type):
"""Removes the specified description.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if se... | python | def remove_description_by_language(self, language_type):
"""Removes the specified description.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
if se... | [
"def",
"remove_description_by_language",
"(",
"self",
",",
"language_type",
")",
":",
"if",
"self",
".",
"get_descriptions_metadata",
"(",
")",
".",
"is_read_only",
"(",
")",
":",
"raise",
"NoAccess",
"(",
")",
"if",
"not",
"isinstance",
"(",
"language_type",
... | Removes the specified description.
raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or
``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.* | [
"Removes",
"the",
"specified",
"description",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L3078-L3092 |
mitsei/dlkit | dlkit/records/osid/base_records.py | MultiLanguageQueryRecord.match_display_names | def match_display_names(self, value, match):
"""stub"""
if value is None:
raise NullArgument('value must not be None')
if not utilities.is_string(value):
raise InvalidArgument('value must be a string')
if match is None:
raise NullArgument('match must n... | python | def match_display_names(self, value, match):
"""stub"""
if value is None:
raise NullArgument('value must not be None')
if not utilities.is_string(value):
raise InvalidArgument('value must be a string')
if match is None:
raise NullArgument('match must n... | [
"def",
"match_display_names",
"(",
"self",
",",
"value",
",",
"match",
")",
":",
"if",
"value",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
"'value must not be None'",
")",
"if",
"not",
"utilities",
".",
"is_string",
"(",
"value",
")",
":",
"raise",
"... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L3142-L3152 |
jason-weirather/py-seq-tools | seqtools/range/locus.py | Locus.add_member | def add_member(self,grange):
"""Add a genomic range to the locus
:param grange:
:type grange: GenomicRange
"""
if self.use_direction and not grange.direction:
sys.stderr.write("ERROR if using direction then direction of input members must be set\n")
sys.exit()
# Get range set proper... | python | def add_member(self,grange):
"""Add a genomic range to the locus
:param grange:
:type grange: GenomicRange
"""
if self.use_direction and not grange.direction:
sys.stderr.write("ERROR if using direction then direction of input members must be set\n")
sys.exit()
# Get range set proper... | [
"def",
"add_member",
"(",
"self",
",",
"grange",
")",
":",
"if",
"self",
".",
"use_direction",
"and",
"not",
"grange",
".",
"direction",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"ERROR if using direction then direction of input members must be set\\n\"",
")",... | Add a genomic range to the locus
:param grange:
:type grange: GenomicRange | [
"Add",
"a",
"genomic",
"range",
"to",
"the",
"locus"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/range/locus.py#L21-L44 |
jason-weirather/py-seq-tools | seqtools/range/locus.py | Loci.add_locus | def add_locus(self,inlocus):
""" Adds a locus to our loci, but does not go through an update our locus sets yet"""
if self.use_direction == True and inlocus.use_direction == False:
sys.stderr.write("ERROR if using the direction in Loci, then every locus added needs use_direction to be True\n")
sys.e... | python | def add_locus(self,inlocus):
""" Adds a locus to our loci, but does not go through an update our locus sets yet"""
if self.use_direction == True and inlocus.use_direction == False:
sys.stderr.write("ERROR if using the direction in Loci, then every locus added needs use_direction to be True\n")
sys.e... | [
"def",
"add_locus",
"(",
"self",
",",
"inlocus",
")",
":",
"if",
"self",
".",
"use_direction",
"==",
"True",
"and",
"inlocus",
".",
"use_direction",
"==",
"False",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"ERROR if using the direction in Loci, then every ... | Adds a locus to our loci, but does not go through an update our locus sets yet | [
"Adds",
"a",
"locus",
"to",
"our",
"loci",
"but",
"does",
"not",
"go",
"through",
"an",
"update",
"our",
"locus",
"sets",
"yet"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/range/locus.py#L61-L67 |
jason-weirather/py-seq-tools | seqtools/range/locus.py | Loci.update_loci | def update_loci(self):
"""Goes through and combines loci until we have one set meeting our overlap definition"""
# Create sub-loci for each chromosome
lbc = {}
chroms = sorted([x.range.chr for x in self.loci])
for chrom in chroms: lbc[chrom] = Loci()
for x in self.loci: lbc[x.range.chr].add_locu... | python | def update_loci(self):
"""Goes through and combines loci until we have one set meeting our overlap definition"""
# Create sub-loci for each chromosome
lbc = {}
chroms = sorted([x.range.chr for x in self.loci])
for chrom in chroms: lbc[chrom] = Loci()
for x in self.loci: lbc[x.range.chr].add_locu... | [
"def",
"update_loci",
"(",
"self",
")",
":",
"# Create sub-loci for each chromosome",
"lbc",
"=",
"{",
"}",
"chroms",
"=",
"sorted",
"(",
"[",
"x",
".",
"range",
".",
"chr",
"for",
"x",
"in",
"self",
".",
"loci",
"]",
")",
"for",
"chrom",
"in",
"chroms... | Goes through and combines loci until we have one set meeting our overlap definition | [
"Goes",
"through",
"and",
"combines",
"loci",
"until",
"we",
"have",
"one",
"set",
"meeting",
"our",
"overlap",
"definition"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/range/locus.py#L68-L84 |
jason-weirather/py-seq-tools | seqtools/range/locus.py | Loci.merge_down_loci | def merge_down_loci(self):
"""Called internally to make loci overlapping into one set"""
old_locus_size = -1
z = 0
while len(self.loci) != old_locus_size:
z+=1
old_locus_size = len(self.loci)
locus_size = len(self.loci)
if self.verbose:
sys.stderr.write(str(locus_size)+" ... | python | def merge_down_loci(self):
"""Called internally to make loci overlapping into one set"""
old_locus_size = -1
z = 0
while len(self.loci) != old_locus_size:
z+=1
old_locus_size = len(self.loci)
locus_size = len(self.loci)
if self.verbose:
sys.stderr.write(str(locus_size)+" ... | [
"def",
"merge_down_loci",
"(",
"self",
")",
":",
"old_locus_size",
"=",
"-",
"1",
"z",
"=",
"0",
"while",
"len",
"(",
"self",
".",
"loci",
")",
"!=",
"old_locus_size",
":",
"z",
"+=",
"1",
"old_locus_size",
"=",
"len",
"(",
"self",
".",
"loci",
")",
... | Called internally to make loci overlapping into one set | [
"Called",
"internally",
"to",
"make",
"loci",
"overlapping",
"into",
"one",
"set"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/range/locus.py#L85-L112 |
delfick/harpoon | harpoon/actions.py | push | def push(collector, image, **kwargs):
"""Push an image"""
if not image.image_index:
raise BadOption("The chosen image does not have a image_index configuration", wanted=image.name)
tag = kwargs["artifact"]
if tag is NotSpecified:
tag = collector.configuration["harpoon"].tag
if tag is... | python | def push(collector, image, **kwargs):
"""Push an image"""
if not image.image_index:
raise BadOption("The chosen image does not have a image_index configuration", wanted=image.name)
tag = kwargs["artifact"]
if tag is NotSpecified:
tag = collector.configuration["harpoon"].tag
if tag is... | [
"def",
"push",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"image",
".",
"image_index",
":",
"raise",
"BadOption",
"(",
"\"The chosen image does not have a image_index configuration\"",
",",
"wanted",
"=",
"image",
".",
"name"... | Push an image | [
"Push",
"an",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L47-L57 |
delfick/harpoon | harpoon/actions.py | push_all | def push_all(collector, **kwargs):
"""Push all the images"""
configuration = collector.configuration
configuration["harpoon"].do_push = True
configuration["harpoon"].only_pushable = True
make_all(collector, **kwargs) | python | def push_all(collector, **kwargs):
"""Push all the images"""
configuration = collector.configuration
configuration["harpoon"].do_push = True
configuration["harpoon"].only_pushable = True
make_all(collector, **kwargs) | [
"def",
"push_all",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"configuration",
"=",
"collector",
".",
"configuration",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"do_push",
"=",
"True",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"only_pushabl... | Push all the images | [
"Push",
"all",
"the",
"images"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L60-L65 |
delfick/harpoon | harpoon/actions.py | pull_arbitrary | def pull_arbitrary(collector, image, **kwargs):
"""Pull an arbitrary image"""
image_index_of = lambda image: urlparse("https://{0}".format(image)).netloc
if image.startswith("file://"):
parsed = urlparse(image)
filename = parsed.netloc + parsed.path
if not os.path.exists(filename):
... | python | def pull_arbitrary(collector, image, **kwargs):
"""Pull an arbitrary image"""
image_index_of = lambda image: urlparse("https://{0}".format(image)).netloc
if image.startswith("file://"):
parsed = urlparse(image)
filename = parsed.netloc + parsed.path
if not os.path.exists(filename):
... | [
"def",
"pull_arbitrary",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"image_index_of",
"=",
"lambda",
"image",
":",
"urlparse",
"(",
"\"https://{0}\"",
".",
"format",
"(",
"image",
")",
")",
".",
"netloc",
"if",
"image",
".",
"star... | Pull an arbitrary image | [
"Pull",
"an",
"arbitrary",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L68-L99 |
delfick/harpoon | harpoon/actions.py | pull | def pull(collector, image, **kwargs):
"""Pull an image"""
if not image.image_index:
raise BadOption("The chosen image does not have a image_index configuration", wanted=image.name)
tag = kwargs["artifact"]
if tag is NotSpecified:
collector.configuration["harpoon"].tag
if tag is not N... | python | def pull(collector, image, **kwargs):
"""Pull an image"""
if not image.image_index:
raise BadOption("The chosen image does not have a image_index configuration", wanted=image.name)
tag = kwargs["artifact"]
if tag is NotSpecified:
collector.configuration["harpoon"].tag
if tag is not N... | [
"def",
"pull",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"image",
".",
"image_index",
":",
"raise",
"BadOption",
"(",
"\"The chosen image does not have a image_index configuration\"",
",",
"wanted",
"=",
"image",
".",
"name"... | Pull an image | [
"Pull",
"an",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L102-L112 |
delfick/harpoon | harpoon/actions.py | pull_dependencies | def pull_dependencies(collector, image, **kwargs):
"""Pull an image's dependent images"""
for dep in image.commands.dependent_images:
kwargs["image"] = dep
pull_arbitrary(collector, **kwargs) | python | def pull_dependencies(collector, image, **kwargs):
"""Pull an image's dependent images"""
for dep in image.commands.dependent_images:
kwargs["image"] = dep
pull_arbitrary(collector, **kwargs) | [
"def",
"pull_dependencies",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"dep",
"in",
"image",
".",
"commands",
".",
"dependent_images",
":",
"kwargs",
"[",
"\"image\"",
"]",
"=",
"dep",
"pull_arbitrary",
"(",
"collector",
",",... | Pull an image's dependent images | [
"Pull",
"an",
"image",
"s",
"dependent",
"images"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L115-L119 |
delfick/harpoon | harpoon/actions.py | pull_parent | def pull_parent(collector, image, **kwargs):
"""DEPRECATED - use pull_dependencies instead"""
log.warning("DEPRECATED - use pull_dependencies instead")
pull_dependencies(collector, image, **kwargs) | python | def pull_parent(collector, image, **kwargs):
"""DEPRECATED - use pull_dependencies instead"""
log.warning("DEPRECATED - use pull_dependencies instead")
pull_dependencies(collector, image, **kwargs) | [
"def",
"pull_parent",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"warning",
"(",
"\"DEPRECATED - use pull_dependencies instead\"",
")",
"pull_dependencies",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")"
] | DEPRECATED - use pull_dependencies instead | [
"DEPRECATED",
"-",
"use",
"pull_dependencies",
"instead"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L122-L125 |
delfick/harpoon | harpoon/actions.py | pull_all | def pull_all(collector, image, **kwargs):
"""Pull all the images"""
images = collector.configuration["images"]
for layer in Builder().layered(images, only_pushable=True):
for image_name, image in layer:
log.info("Pulling %s", image_name)
pull(collector, image, **kwargs) | python | def pull_all(collector, image, **kwargs):
"""Pull all the images"""
images = collector.configuration["images"]
for layer in Builder().layered(images, only_pushable=True):
for image_name, image in layer:
log.info("Pulling %s", image_name)
pull(collector, image, **kwargs) | [
"def",
"pull_all",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"images",
"=",
"collector",
".",
"configuration",
"[",
"\"images\"",
"]",
"for",
"layer",
"in",
"Builder",
"(",
")",
".",
"layered",
"(",
"images",
",",
"only_pushable"... | Pull all the images | [
"Pull",
"all",
"the",
"images"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L128-L135 |
delfick/harpoon | harpoon/actions.py | pull_all_external | def pull_all_external(collector, **kwargs):
"""Pull all the external dependencies of all the images"""
deps = set()
images = collector.configuration["images"]
for layer in Builder().layered(images):
for image_name, image in layer:
for dep in image.commands.external_dependencies:
... | python | def pull_all_external(collector, **kwargs):
"""Pull all the external dependencies of all the images"""
deps = set()
images = collector.configuration["images"]
for layer in Builder().layered(images):
for image_name, image in layer:
for dep in image.commands.external_dependencies:
... | [
"def",
"pull_all_external",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"deps",
"=",
"set",
"(",
")",
"images",
"=",
"collector",
".",
"configuration",
"[",
"\"images\"",
"]",
"for",
"layer",
"in",
"Builder",
"(",
")",
".",
"layered",
"(",
"im... | Pull all the external dependencies of all the images | [
"Pull",
"all",
"the",
"external",
"dependencies",
"of",
"all",
"the",
"images"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L138-L150 |
delfick/harpoon | harpoon/actions.py | make | def make(collector, image, **kwargs):
"""Just create an image"""
tag = kwargs.get("artifact", NotSpecified)
if tag is NotSpecified:
tag = collector.configuration["harpoon"].tag
if tag is not NotSpecified:
image.tag = tag
Builder().make_image(image, collector.configuration["images"]... | python | def make(collector, image, **kwargs):
"""Just create an image"""
tag = kwargs.get("artifact", NotSpecified)
if tag is NotSpecified:
tag = collector.configuration["harpoon"].tag
if tag is not NotSpecified:
image.tag = tag
Builder().make_image(image, collector.configuration["images"]... | [
"def",
"make",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"tag",
"=",
"kwargs",
".",
"get",
"(",
"\"artifact\"",
",",
"NotSpecified",
")",
"if",
"tag",
"is",
"NotSpecified",
":",
"tag",
"=",
"collector",
".",
"configuration",
"[... | Just create an image | [
"Just",
"create",
"an",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L159-L169 |
delfick/harpoon | harpoon/actions.py | make_all | def make_all(collector, **kwargs):
"""Creates all the images in layered order"""
configuration = collector.configuration
push = configuration["harpoon"].do_push
only_pushable = configuration["harpoon"].only_pushable
if push:
only_pushable = True
tag = kwargs.get("artifact", NotSpecified... | python | def make_all(collector, **kwargs):
"""Creates all the images in layered order"""
configuration = collector.configuration
push = configuration["harpoon"].do_push
only_pushable = configuration["harpoon"].only_pushable
if push:
only_pushable = True
tag = kwargs.get("artifact", NotSpecified... | [
"def",
"make_all",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"configuration",
"=",
"collector",
".",
"configuration",
"push",
"=",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"do_push",
"only_pushable",
"=",
"configuration",
"[",
"\"harpoon\"",
"... | Creates all the images in layered order | [
"Creates",
"all",
"the",
"images",
"in",
"layered",
"order"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L172-L192 |
delfick/harpoon | harpoon/actions.py | make_pushable | def make_pushable(collector, **kwargs):
"""Make only the pushable images and their dependencies"""
configuration = collector.configuration
configuration["harpoon"].do_push = True
configuration["harpoon"].only_pushable = True
make_all(collector, **kwargs) | python | def make_pushable(collector, **kwargs):
"""Make only the pushable images and their dependencies"""
configuration = collector.configuration
configuration["harpoon"].do_push = True
configuration["harpoon"].only_pushable = True
make_all(collector, **kwargs) | [
"def",
"make_pushable",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"configuration",
"=",
"collector",
".",
"configuration",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"do_push",
"=",
"True",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"only_pu... | Make only the pushable images and their dependencies | [
"Make",
"only",
"the",
"pushable",
"images",
"and",
"their",
"dependencies"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L195-L200 |
delfick/harpoon | harpoon/actions.py | list_tasks | def list_tasks(collector, tasks, **kwargs):
"""List the available_tasks"""
print("Available tasks to choose from are:")
print("Use the --task option to choose one")
print("")
keygetter = lambda item: item[1].label
tasks = sorted(tasks.items(), key=keygetter)
for label, items in itertools.gro... | python | def list_tasks(collector, tasks, **kwargs):
"""List the available_tasks"""
print("Available tasks to choose from are:")
print("Use the --task option to choose one")
print("")
keygetter = lambda item: item[1].label
tasks = sorted(tasks.items(), key=keygetter)
for label, items in itertools.gro... | [
"def",
"list_tasks",
"(",
"collector",
",",
"tasks",
",",
"*",
"*",
"kwargs",
")",
":",
"print",
"(",
"\"Available tasks to choose from are:\"",
")",
"print",
"(",
"\"Use the --task option to choose one\"",
")",
"print",
"(",
"\"\"",
")",
"keygetter",
"=",
"lambda... | List the available_tasks | [
"List",
"the",
"available_tasks"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L208-L223 |
delfick/harpoon | harpoon/actions.py | delete_untagged | def delete_untagged(collector, **kwargs):
"""Find the untagged images and remove them"""
configuration = collector.configuration
docker_api = configuration["harpoon"].docker_api
images = docker_api.images()
found = False
for image in images:
if image["RepoTags"] == ["<none>:<none>"]:
... | python | def delete_untagged(collector, **kwargs):
"""Find the untagged images and remove them"""
configuration = collector.configuration
docker_api = configuration["harpoon"].docker_api
images = docker_api.images()
found = False
for image in images:
if image["RepoTags"] == ["<none>:<none>"]:
... | [
"def",
"delete_untagged",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"configuration",
"=",
"collector",
".",
"configuration",
"docker_api",
"=",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"docker_api",
"images",
"=",
"docker_api",
".",
"images",
... | Find the untagged images and remove them | [
"Find",
"the",
"untagged",
"images",
"and",
"remove",
"them"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L226-L243 |
delfick/harpoon | harpoon/actions.py | show | def show(collector, **kwargs):
"""Show what images we have"""
configuration = collector.configuration
flat = configuration.get("harpoon.flat", False)
only_pushable = configuration.get("harpoon.only_pushable", False)
for index, layer in enumerate(Builder().layered(configuration["images"], only_pusha... | python | def show(collector, **kwargs):
"""Show what images we have"""
configuration = collector.configuration
flat = configuration.get("harpoon.flat", False)
only_pushable = configuration.get("harpoon.only_pushable", False)
for index, layer in enumerate(Builder().layered(configuration["images"], only_pusha... | [
"def",
"show",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"configuration",
"=",
"collector",
".",
"configuration",
"flat",
"=",
"configuration",
".",
"get",
"(",
"\"harpoon.flat\"",
",",
"False",
")",
"only_pushable",
"=",
"configuration",
".",
"ge... | Show what images we have | [
"Show",
"what",
"images",
"we",
"have"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L246-L260 |
delfick/harpoon | harpoon/actions.py | show_pushable | def show_pushable(collector, **kwargs):
"""Show what images we have"""
collector.configuration['harpoon'].only_pushable = True
show(collector, **kwargs) | python | def show_pushable(collector, **kwargs):
"""Show what images we have"""
collector.configuration['harpoon'].only_pushable = True
show(collector, **kwargs) | [
"def",
"show_pushable",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"collector",
".",
"configuration",
"[",
"'harpoon'",
"]",
".",
"only_pushable",
"=",
"True",
"show",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")"
] | Show what images we have | [
"Show",
"what",
"images",
"we",
"have"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L263-L266 |
delfick/harpoon | harpoon/actions.py | print_all_dockerfiles | def print_all_dockerfiles(collector, **kwargs):
"""Print all the dockerfiles"""
for name, image in collector.configuration["images"].items():
print("{0}".format(name))
print("-" * len(name))
kwargs["image"] = image
print_dockerfile(collector, **kwargs) | python | def print_all_dockerfiles(collector, **kwargs):
"""Print all the dockerfiles"""
for name, image in collector.configuration["images"].items():
print("{0}".format(name))
print("-" * len(name))
kwargs["image"] = image
print_dockerfile(collector, **kwargs) | [
"def",
"print_all_dockerfiles",
"(",
"collector",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"image",
"in",
"collector",
".",
"configuration",
"[",
"\"images\"",
"]",
".",
"items",
"(",
")",
":",
"print",
"(",
"\"{0}\"",
".",
"format",
"(",
... | Print all the dockerfiles | [
"Print",
"all",
"the",
"dockerfiles"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L274-L280 |
delfick/harpoon | harpoon/actions.py | read_login | def read_login(collector, image, **kwargs):
"""Login to a docker registry with read permissions"""
docker_api = collector.configuration["harpoon"].docker_api
collector.configuration["authentication"].login(docker_api, image, is_pushing=False, global_docker=True) | python | def read_login(collector, image, **kwargs):
"""Login to a docker registry with read permissions"""
docker_api = collector.configuration["harpoon"].docker_api
collector.configuration["authentication"].login(docker_api, image, is_pushing=False, global_docker=True) | [
"def",
"read_login",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"docker_api",
"=",
"collector",
".",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"docker_api",
"collector",
".",
"configuration",
"[",
"\"authentication\"",
"]",
".",
... | Login to a docker registry with read permissions | [
"Login",
"to",
"a",
"docker",
"registry",
"with",
"read",
"permissions"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L283-L286 |
delfick/harpoon | harpoon/actions.py | write_login | def write_login(collector, image, **kwargs):
"""Login to a docker registry with write permissions"""
docker_api = collector.configuration["harpoon"].docker_api
collector.configuration["authentication"].login(docker_api, image, is_pushing=True, global_docker=True) | python | def write_login(collector, image, **kwargs):
"""Login to a docker registry with write permissions"""
docker_api = collector.configuration["harpoon"].docker_api
collector.configuration["authentication"].login(docker_api, image, is_pushing=True, global_docker=True) | [
"def",
"write_login",
"(",
"collector",
",",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"docker_api",
"=",
"collector",
".",
"configuration",
"[",
"\"harpoon\"",
"]",
".",
"docker_api",
"collector",
".",
"configuration",
"[",
"\"authentication\"",
"]",
".",
... | Login to a docker registry with write permissions | [
"Login",
"to",
"a",
"docker",
"registry",
"with",
"write",
"permissions"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L289-L292 |
delfick/harpoon | harpoon/actions.py | untag | def untag(collector, image, artifact, **kwargs):
"""Tag an image!"""
if artifact in (None, "", NotSpecified):
artifact = collector.configuration["harpoon"].tag
if artifact is NotSpecified:
raise BadOption("Please specify a tag using the artifact or tag options")
image.tag = artifact
... | python | def untag(collector, image, artifact, **kwargs):
"""Tag an image!"""
if artifact in (None, "", NotSpecified):
artifact = collector.configuration["harpoon"].tag
if artifact is NotSpecified:
raise BadOption("Please specify a tag using the artifact or tag options")
image.tag = artifact
... | [
"def",
"untag",
"(",
"collector",
",",
"image",
",",
"artifact",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"artifact",
"in",
"(",
"None",
",",
"\"\"",
",",
"NotSpecified",
")",
":",
"artifact",
"=",
"collector",
".",
"configuration",
"[",
"\"harpoon\"",
... | Tag an image! | [
"Tag",
"an",
"image!"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L295-L310 |
delfick/harpoon | harpoon/actions.py | tag | def tag(collector, image, artifact, **kwargs):
"""Tag an image!"""
if artifact in (None, "", NotSpecified):
raise BadOption("Please specify a tag using the artifact option")
if image.image_index in (None, "", NotSpecified):
raise BadOption("Please specify an image with an image_index option... | python | def tag(collector, image, artifact, **kwargs):
"""Tag an image!"""
if artifact in (None, "", NotSpecified):
raise BadOption("Please specify a tag using the artifact option")
if image.image_index in (None, "", NotSpecified):
raise BadOption("Please specify an image with an image_index option... | [
"def",
"tag",
"(",
"collector",
",",
"image",
",",
"artifact",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"artifact",
"in",
"(",
"None",
",",
"\"\"",
",",
"NotSpecified",
")",
":",
"raise",
"BadOption",
"(",
"\"Please specify a tag using the artifact option\"",
... | Tag an image! | [
"Tag",
"an",
"image!"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L313-L342 |
delfick/harpoon | harpoon/actions.py | retrieve | def retrieve(collector, image, artifact, **kwargs):
"""Retrieve a file/folder from an image"""
if artifact in (None, "", NotSpecified):
raise BadOption("Please specify what to retrieve using the artifact option")
if collector.configuration["harpoon"].tag is not NotSpecified:
image.tag = col... | python | def retrieve(collector, image, artifact, **kwargs):
"""Retrieve a file/folder from an image"""
if artifact in (None, "", NotSpecified):
raise BadOption("Please specify what to retrieve using the artifact option")
if collector.configuration["harpoon"].tag is not NotSpecified:
image.tag = col... | [
"def",
"retrieve",
"(",
"collector",
",",
"image",
",",
"artifact",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"artifact",
"in",
"(",
"None",
",",
"\"\"",
",",
"NotSpecified",
")",
":",
"raise",
"BadOption",
"(",
"\"Please specify what to retrieve using the arti... | Retrieve a file/folder from an image | [
"Retrieve",
"a",
"file",
"/",
"folder",
"from",
"an",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L345-L367 |
discontinue/django-secure-js-login | secure_js_login/views.py | get_salt | def get_salt(request):
"""
return the user password salt.
If the user doesn't exist return a pseudo salt.
"""
try:
username = request.POST["username"]
except KeyError:
# log.error("No 'username' in POST data?!?")
return HttpResponseBadRequest()
try:
request.s... | python | def get_salt(request):
"""
return the user password salt.
If the user doesn't exist return a pseudo salt.
"""
try:
username = request.POST["username"]
except KeyError:
# log.error("No 'username' in POST data?!?")
return HttpResponseBadRequest()
try:
request.s... | [
"def",
"get_salt",
"(",
"request",
")",
":",
"try",
":",
"username",
"=",
"request",
".",
"POST",
"[",
"\"username\"",
"]",
"except",
"KeyError",
":",
"# log.error(\"No 'username' in POST data?!?\")",
"return",
"HttpResponseBadRequest",
"(",
")",
"try",
":",
"requ... | return the user password salt.
If the user doesn't exist return a pseudo salt. | [
"return",
"the",
"user",
"password",
"salt",
".",
"If",
"the",
"user",
"doesn",
"t",
"exist",
"return",
"a",
"pseudo",
"salt",
"."
] | train | https://github.com/discontinue/django-secure-js-login/blob/4bfc592c48f381de115e592e721f31d2eb915968/secure_js_login/views.py#L41-L87 |
discontinue/django-secure-js-login | secure_js_login/views.py | display_login_info | def display_login_info(sender, user, request, **kwargs):
"""
Create a message, after login.
Because this signal receiver will be called **after** auth.models.update_last_login(), the
user.last_login information was updated before!
As a work-a-round, we add **user.previous_login** in forms.SecureLo... | python | def display_login_info(sender, user, request, **kwargs):
"""
Create a message, after login.
Because this signal receiver will be called **after** auth.models.update_last_login(), the
user.last_login information was updated before!
As a work-a-round, we add **user.previous_login** in forms.SecureLo... | [
"def",
"display_login_info",
"(",
"sender",
",",
"user",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"user",
",",
"\"previous_login\"",
")",
":",
"# e.g. normal django admin login page was used",
"return",
"message",
"=",
"ren... | Create a message, after login.
Because this signal receiver will be called **after** auth.models.update_last_login(), the
user.last_login information was updated before!
As a work-a-round, we add **user.previous_login** in forms.SecureLoginForm.clean() | [
"Create",
"a",
"message",
"after",
"login",
"."
] | train | https://github.com/discontinue/django-secure-js-login/blob/4bfc592c48f381de115e592e721f31d2eb915968/secure_js_login/views.py#L90-L103 |
theosysbio/means | src/means/approximation/mea/closure_gamma.py | GammaClosure._get_parameter_symbols | def _get_parameter_symbols(self, n_counter, k_counter):
r"""
Calculates parameters Y expressions and beta coefficients in
:math:`X = {A(\beta_0,\beta_1\ldots \beta_n) \cdot Y}`
:param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments
:ty... | python | def _get_parameter_symbols(self, n_counter, k_counter):
r"""
Calculates parameters Y expressions and beta coefficients in
:math:`X = {A(\beta_0,\beta_1\ldots \beta_n) \cdot Y}`
:param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments
:ty... | [
"def",
"_get_parameter_symbols",
"(",
"self",
",",
"n_counter",
",",
"k_counter",
")",
":",
"n_moment",
"=",
"self",
".",
"max_order",
"+",
"1",
"expectation_symbols",
"=",
"sp",
".",
"Matrix",
"(",
"[",
"n",
".",
"symbol",
"for",
"n",
"in",
"k_counter",
... | r"""
Calculates parameters Y expressions and beta coefficients in
:math:`X = {A(\beta_0,\beta_1\ldots \beta_n) \cdot Y}`
:param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments
:type n_counter: list[:class:`~means.core.descriptors.Moment`]
... | [
"r",
"Calculates",
"parameters",
"Y",
"expressions",
"and",
"beta",
"coefficients",
"in",
":",
"math",
":",
"X",
"=",
"{",
"A",
"(",
"\\",
"beta_0",
"\\",
"beta_1",
"\\",
"ldots",
"\\",
"beta_n",
")",
"\\",
"cdot",
"Y",
"}"
] | train | https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_gamma.py#L36-L119 |
theosysbio/means | src/means/approximation/mea/closure_gamma.py | GammaClosure._compute_raw_moments | def _compute_raw_moments(self, n_counter, k_counter):
r"""
Compute :math:`X_i`
Gamma type 1: :math:`X_i = \frac {\beta_i}{\beta_0}Y_0 + Y_i`
Gamma type 2: :math:`X_i = \sum_{k=0}^{i} \frac {\beta_i}{\beta_k}Y_k`
:param n_counter: a list of :class:`~means.core.descriptors.Moment... | python | def _compute_raw_moments(self, n_counter, k_counter):
r"""
Compute :math:`X_i`
Gamma type 1: :math:`X_i = \frac {\beta_i}{\beta_0}Y_0 + Y_i`
Gamma type 2: :math:`X_i = \sum_{k=0}^{i} \frac {\beta_i}{\beta_k}Y_k`
:param n_counter: a list of :class:`~means.core.descriptors.Moment... | [
"def",
"_compute_raw_moments",
"(",
"self",
",",
"n_counter",
",",
"k_counter",
")",
":",
"alpha_multipliers",
",",
"beta_multipliers",
"=",
"self",
".",
"_get_parameter_symbols",
"(",
"n_counter",
",",
"k_counter",
")",
"out_mat",
"=",
"sp",
".",
"Matrix",
"(",... | r"""
Compute :math:`X_i`
Gamma type 1: :math:`X_i = \frac {\beta_i}{\beta_0}Y_0 + Y_i`
Gamma type 2: :math:`X_i = \sum_{k=0}^{i} \frac {\beta_i}{\beta_k}Y_k`
:param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments
:type n_counter: list... | [
"r",
"Compute",
":",
"math",
":",
"X_i",
"Gamma",
"type",
"1",
":",
":",
"math",
":",
"X_i",
"=",
"\\",
"frac",
"{",
"\\",
"beta_i",
"}",
"{",
"\\",
"beta_0",
"}",
"Y_0",
"+",
"Y_i",
"Gamma",
"type",
"2",
":",
":",
"math",
":",
"X_i",
"=",
"\... | train | https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_gamma.py#L121-L138 |
theosysbio/means | src/means/approximation/mea/closure_gamma.py | GammaClosure._gamma_factorial | def _gamma_factorial(self, expr, n):
r"""
Compute :math:`\frac {(\alpha)_m = (\alpha + m - 1)!}{(\alpha - 1)!}`
See Eq. 3 in Gamma moment closure Lakatos 2014 unpublished
:param expr: a symbolic expression
:type expr:
:param n:
:type n: `int`
:return: a ... | python | def _gamma_factorial(self, expr, n):
r"""
Compute :math:`\frac {(\alpha)_m = (\alpha + m - 1)!}{(\alpha - 1)!}`
See Eq. 3 in Gamma moment closure Lakatos 2014 unpublished
:param expr: a symbolic expression
:type expr:
:param n:
:type n: `int`
:return: a ... | [
"def",
"_gamma_factorial",
"(",
"self",
",",
"expr",
",",
"n",
")",
":",
"if",
"n",
"==",
"0",
":",
"return",
"1",
"return",
"product",
"(",
"[",
"expr",
"+",
"i",
"for",
"i",
"in",
"range",
"(",
"n",
")",
"]",
")"
] | r"""
Compute :math:`\frac {(\alpha)_m = (\alpha + m - 1)!}{(\alpha - 1)!}`
See Eq. 3 in Gamma moment closure Lakatos 2014 unpublished
:param expr: a symbolic expression
:type expr:
:param n:
:type n: `int`
:return: a symbolic expression | [
"r",
"Compute",
":",
"math",
":",
"\\",
"frac",
"{",
"(",
"\\",
"alpha",
")",
"_m",
"=",
"(",
"\\",
"alpha",
"+",
"m",
"-",
"1",
")",
"!",
"}",
"{",
"(",
"\\",
"alpha",
"-",
"1",
")",
"!",
"}",
"See",
"Eq",
".",
"3",
"in",
"Gamma",
"momen... | train | https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_gamma.py#L141-L155 |
theosysbio/means | src/means/approximation/mea/closure_gamma.py | GammaClosure._get_covariance_symbol | def _get_covariance_symbol(self, q_counter, sp1_idx, sp2_idx):
r"""
Compute second order moments i.e. variances and covariances
Covariances equal to 0 in univariate case
:param q_counter: moment matrix
:param sp1_idx: index of one species
:param sp2_idx: index of another... | python | def _get_covariance_symbol(self, q_counter, sp1_idx, sp2_idx):
r"""
Compute second order moments i.e. variances and covariances
Covariances equal to 0 in univariate case
:param q_counter: moment matrix
:param sp1_idx: index of one species
:param sp2_idx: index of another... | [
"def",
"_get_covariance_symbol",
"(",
"self",
",",
"q_counter",
",",
"sp1_idx",
",",
"sp2_idx",
")",
":",
"# The diagonal positions in the matrix are the variances",
"if",
"sp1_idx",
"==",
"sp2_idx",
":",
"return",
"[",
"q",
".",
"symbol",
"for",
"q",
"in",
"q_cou... | r"""
Compute second order moments i.e. variances and covariances
Covariances equal to 0 in univariate case
:param q_counter: moment matrix
:param sp1_idx: index of one species
:param sp2_idx: index of another species
:return: second order moments matrix of size n_species... | [
"r",
"Compute",
"second",
"order",
"moments",
"i",
".",
"e",
".",
"variances",
"and",
"covariances",
"Covariances",
"equal",
"to",
"0",
"in",
"univariate",
"case"
] | train | https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_gamma.py#L157-L171 |
chop-dbhi/varify | varify/accounts/utils.py | throttle_login | def throttle_login(request):
"""Throttles a client by keeping track of the number of failed login
attempts. If the user succeeds at a login before the max attempts has
been reached, the attempts are reset.
"""
email = request.POST['email']
password = request.POST['password']
# if the form i... | python | def throttle_login(request):
"""Throttles a client by keeping track of the number of failed login
attempts. If the user succeeds at a login before the max attempts has
been reached, the attempts are reset.
"""
email = request.POST['email']
password = request.POST['password']
# if the form i... | [
"def",
"throttle_login",
"(",
"request",
")",
":",
"email",
"=",
"request",
".",
"POST",
"[",
"'email'",
"]",
"password",
"=",
"request",
".",
"POST",
"[",
"'password'",
"]",
"# if the form is not filled out completely, pass along",
"if",
"not",
"(",
"email",
"a... | Throttles a client by keeping track of the number of failed login
attempts. If the user succeeds at a login before the max attempts has
been reached, the attempts are reset. | [
"Throttles",
"a",
"client",
"by",
"keeping",
"track",
"of",
"the",
"number",
"of",
"failed",
"login",
"attempts",
".",
"If",
"the",
"user",
"succeeds",
"at",
"a",
"login",
"before",
"the",
"max",
"attempts",
"has",
"been",
"reached",
"the",
"attempts",
"ar... | train | https://github.com/chop-dbhi/varify/blob/5dc721e49ed9bd3582f4b117785fdd1a8b6ba777/varify/accounts/utils.py#L29-L99 |
mdiener/grace | grace/py27/pyjsdoc.py | list_js_files | def list_js_files(dir):
"""
Generator for all JavaScript files in the directory, recursively
>>> 'examples/module.js' in list(list_js_files('examples'))
True
"""
for dirpath, dirnames, filenames in os.walk(dir):
for filename in filenames:
if is_js_file(filename):
... | python | def list_js_files(dir):
"""
Generator for all JavaScript files in the directory, recursively
>>> 'examples/module.js' in list(list_js_files('examples'))
True
"""
for dirpath, dirnames, filenames in os.walk(dir):
for filename in filenames:
if is_js_file(filename):
... | [
"def",
"list_js_files",
"(",
"dir",
")",
":",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"dir",
")",
":",
"for",
"filename",
"in",
"filenames",
":",
"if",
"is_js_file",
"(",
"filename",
")",
":",
"yield",
"os",
... | Generator for all JavaScript files in the directory, recursively
>>> 'examples/module.js' in list(list_js_files('examples'))
True | [
"Generator",
"for",
"all",
"JavaScript",
"files",
"in",
"the",
"directory",
"recursively"
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/pyjsdoc.py#L110-L121 |
mdiener/grace | grace/py27/pyjsdoc.py | save_file | def save_file(path, text):
"""
Save a string to a file. If the containing directory(ies) doesn't exist,
this creates it.
"""
dir = os.path.dirname(path)
if not os.path.exists(dir):
os.makedirs(dir)
fd = open(path, 'w')
try:
fd.write(text)
finally:
fd.close() | python | def save_file(path, text):
"""
Save a string to a file. If the containing directory(ies) doesn't exist,
this creates it.
"""
dir = os.path.dirname(path)
if not os.path.exists(dir):
os.makedirs(dir)
fd = open(path, 'w')
try:
fd.write(text)
finally:
fd.close() | [
"def",
"save_file",
"(",
"path",
",",
"text",
")",
":",
"dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dir",
")",
":",
"os",
".",
"makedirs",
"(",
"dir",
")",
"fd",
"=",
"... | Save a string to a file. If the containing directory(ies) doesn't exist,
this creates it. | [
"Save",
"a",
"string",
"to",
"a",
"file",
".",
"If",
"the",
"containing",
"directory",
"(",
"ies",
")",
"doesn",
"t",
"exist",
"this",
"creates",
"it",
"."
] | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/pyjsdoc.py#L140-L153 |
mdiener/grace | grace/py27/pyjsdoc.py | split_delimited | def split_delimited(delimiters, split_by, text):
"""
Generator that walks the ``text`` and splits it into an array on
``split_by``, being careful not to break inside a delimiter pair.
``delimiters`` should be an even-length string with each pair of matching
delimiters listed together, open first.
... | python | def split_delimited(delimiters, split_by, text):
"""
Generator that walks the ``text`` and splits it into an array on
``split_by``, being careful not to break inside a delimiter pair.
``delimiters`` should be an even-length string with each pair of matching
delimiters listed together, open first.
... | [
"def",
"split_delimited",
"(",
"delimiters",
",",
"split_by",
",",
"text",
")",
":",
"delims",
"=",
"[",
"0",
"]",
"*",
"(",
"old_div",
"(",
"len",
"(",
"delimiters",
")",
",",
"2",
")",
")",
"actions",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"... | Generator that walks the ``text`` and splits it into an array on
``split_by``, being careful not to break inside a delimiter pair.
``delimiters`` should be an even-length string with each pair of matching
delimiters listed together, open first.
>>> list(split_delimited('{}[]', ',', ''))
['']
>... | [
"Generator",
"that",
"walks",
"the",
"text",
"and",
"splits",
"it",
"into",
"an",
"array",
"on",
"split_by",
"being",
"careful",
"not",
"to",
"break",
"inside",
"a",
"delimiter",
"pair",
".",
"delimiters",
"should",
"be",
"an",
"even",
"-",
"length",
"stri... | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/pyjsdoc.py#L157-L210 |
mdiener/grace | grace/py27/pyjsdoc.py | get_doc_comments | def get_doc_comments(text):
r"""
Return a list of all documentation comments in the file text. Each
comment is a pair, with the first element being the comment text and
the second element being the line after it, which may be needed to
guess function & arguments.
>>> get_doc_comments(read_file... | python | def get_doc_comments(text):
r"""
Return a list of all documentation comments in the file text. Each
comment is a pair, with the first element being the comment text and
the second element being the line after it, which may be needed to
guess function & arguments.
>>> get_doc_comments(read_file... | [
"def",
"get_doc_comments",
"(",
"text",
")",
":",
"def",
"make_pair",
"(",
"match",
")",
":",
"comment",
"=",
"match",
".",
"group",
"(",
")",
"try",
":",
"end",
"=",
"text",
".",
"find",
"(",
"'\\n'",
",",
"match",
".",
"end",
"(",
"0",
")",
")"... | r"""
Return a list of all documentation comments in the file text. Each
comment is a pair, with the first element being the comment text and
the second element being the line after it, which may be needed to
guess function & arguments.
>>> get_doc_comments(read_file('examples/module.js'))[0][0][:4... | [
"r",
"Return",
"a",
"list",
"of",
"all",
"documentation",
"comments",
"in",
"the",
"file",
"text",
".",
"Each",
"comment",
"is",
"a",
"pair",
"with",
"the",
"first",
"element",
"being",
"the",
"comment",
"text",
"and",
"the",
"second",
"element",
"being",
... | train | https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/pyjsdoc.py#L212-L241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.