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/json_/authorization/managers.py | AuthorizationManager.get_authorization_vault_assignment_session | def get_authorization_vault_assignment_session(self):
"""Gets the session for assigning authorizations to vault mappings.
return: (osid.authorization.AuthorizationVaultAssignmentSession)
- a ``AuthorizationVaultAssignmentSession``
raise: OperationFailed - unable to complete req... | python | def get_authorization_vault_assignment_session(self):
"""Gets the session for assigning authorizations to vault mappings.
return: (osid.authorization.AuthorizationVaultAssignmentSession)
- a ``AuthorizationVaultAssignmentSession``
raise: OperationFailed - unable to complete req... | [
"def",
"get_authorization_vault_assignment_session",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supports_authorization_vault_assignment",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"# pylint: disable=no-member",
"return",
"sessions",
".",
... | Gets the session for assigning authorizations to vault mappings.
return: (osid.authorization.AuthorizationVaultAssignmentSession)
- a ``AuthorizationVaultAssignmentSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented -
``supports_a... | [
"Gets",
"the",
"session",
"for",
"assigning",
"authorizations",
"to",
"vault",
"mappings",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L605-L621 |
mitsei/dlkit | dlkit/json_/authorization/managers.py | AuthorizationManager.get_vault_lookup_session | def get_vault_lookup_session(self):
"""Gets the OsidSession associated with the vault lookup service.
return: (osid.authorization.VaultLookupSession) - a
``VaultLookupSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_... | python | def get_vault_lookup_session(self):
"""Gets the OsidSession associated with the vault lookup service.
return: (osid.authorization.VaultLookupSession) - a
``VaultLookupSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_... | [
"def",
"get_vault_lookup_session",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supports_vault_lookup",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"# pylint: disable=no-member",
"return",
"sessions",
".",
"VaultLookupSession",
"(",
"run... | Gets the OsidSession associated with the vault lookup service.
return: (osid.authorization.VaultLookupSession) - a
``VaultLookupSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_lookup() is false``
*compliance: option... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"vault",
"lookup",
"service",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L626-L640 |
mitsei/dlkit | dlkit/json_/authorization/managers.py | AuthorizationManager.get_vault_admin_session | def get_vault_admin_session(self):
"""Gets the OsidSession associated with the vault administration service.
return: (osid.authorization.VaultAdminSession) - a
``VaultAdminSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_v... | python | def get_vault_admin_session(self):
"""Gets the OsidSession associated with the vault administration service.
return: (osid.authorization.VaultAdminSession) - a
``VaultAdminSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_v... | [
"def",
"get_vault_admin_session",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supports_vault_admin",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"# pylint: disable=no-member",
"return",
"sessions",
".",
"VaultAdminSession",
"(",
"runtim... | Gets the OsidSession associated with the vault administration service.
return: (osid.authorization.VaultAdminSession) - a
``VaultAdminSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_admin() is false``
*compliance: o... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"vault",
"administration",
"service",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L664-L678 |
mitsei/dlkit | dlkit/json_/authorization/managers.py | AuthorizationManager.get_vault_hierarchy_session | def get_vault_hierarchy_session(self):
"""Gets the session traversing vault hierarchies.
return: (osid.authorization.VaultHierarchySession) - a
``VaultHierarchySession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_hierarc... | python | def get_vault_hierarchy_session(self):
"""Gets the session traversing vault hierarchies.
return: (osid.authorization.VaultHierarchySession) - a
``VaultHierarchySession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_hierarc... | [
"def",
"get_vault_hierarchy_session",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supports_vault_hierarchy",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"# pylint: disable=no-member",
"return",
"sessions",
".",
"VaultHierarchySession",
"(... | Gets the session traversing vault hierarchies.
return: (osid.authorization.VaultHierarchySession) - a
``VaultHierarchySession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_hierarchy() is false``
*compliance: optional -- T... | [
"Gets",
"the",
"session",
"traversing",
"vault",
"hierarchies",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L683-L697 |
mitsei/dlkit | dlkit/json_/authorization/managers.py | AuthorizationManager.get_vault_hierarchy_design_session | def get_vault_hierarchy_design_session(self):
"""Gets the session designing vault hierarchies.
return: (osid.authorization.VaultHierarchyDesignSession) - a
``VaultHierarchyDesignSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supp... | python | def get_vault_hierarchy_design_session(self):
"""Gets the session designing vault hierarchies.
return: (osid.authorization.VaultHierarchyDesignSession) - a
``VaultHierarchyDesignSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supp... | [
"def",
"get_vault_hierarchy_design_session",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supports_vault_hierarchy_design",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"# pylint: disable=no-member",
"return",
"sessions",
".",
"VaultHierarchy... | Gets the session designing vault hierarchies.
return: (osid.authorization.VaultHierarchyDesignSession) - a
``VaultHierarchyDesignSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_vault_hierarchy_design() is
false``
... | [
"Gets",
"the",
"session",
"designing",
"vault",
"hierarchies",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L702-L717 |
mitsei/dlkit | dlkit/json_/authorization/managers.py | AuthorizationProxyManager.get_authorization_lookup_session_for_vault | def get_authorization_lookup_session_for_vault(self, vault_id, proxy):
"""Gets the ``OsidSession`` associated with the authorization lookup service for the given vault.
arg: vault_id (osid.id.Id): the ``Id`` of the vault
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.authori... | python | def get_authorization_lookup_session_for_vault(self, vault_id, proxy):
"""Gets the ``OsidSession`` associated with the authorization lookup service for the given vault.
arg: vault_id (osid.id.Id): the ``Id`` of the vault
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.authori... | [
"def",
"get_authorization_lookup_session_for_vault",
"(",
"self",
",",
"vault_id",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_authorization_lookup",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"##",
"# Also include check to see... | Gets the ``OsidSession`` associated with the authorization lookup service for the given vault.
arg: vault_id (osid.id.Id): the ``Id`` of the vault
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.authorization.AuthorizationLookupSession) - ``an
_authorization_lookup_se... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"authorization",
"lookup",
"service",
"for",
"the",
"given",
"vault",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L892-L915 |
mitsei/dlkit | dlkit/json_/authorization/managers.py | AuthorizationProxyManager.get_vault_query_session | def get_vault_query_session(self, proxy):
"""Gets the OsidSession associated with the vault query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.authorization.VaultQuerySession) - a
``VaultQuerySession``
raise: NullArgument - ``proxy`` is ``null``
... | python | def get_vault_query_session(self, proxy):
"""Gets the OsidSession associated with the vault query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.authorization.VaultQuerySession) - a
``VaultQuerySession``
raise: NullArgument - ``proxy`` is ``null``
... | [
"def",
"get_vault_query_session",
"(",
"self",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_vault_query",
"(",
")",
":",
"raise",
"errors",
".",
"Unimplemented",
"(",
")",
"# pylint: disable=no-member",
"return",
"sessions",
".",
"VaultQuerySession"... | Gets the OsidSession associated with the vault query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.authorization.VaultQuerySession) - a
``VaultQuerySession``
raise: NullArgument - ``proxy`` is ``null``
raise: OperationFailed - unable to complete requ... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"vault",
"query",
"service",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L1070-L1086 |
discontinue/django-secure-js-login | secure_js_login/admin.py | TOTPDeviceAdmin2._qr_code | def _qr_code(self, instance):
"""
return generate html code with "otpauth://..." link and QR-code
"""
request = self.request # FIXME
try:
user = instance.user
except ObjectDoesNotExist:
return _("Please save first!")
current_site = get_cur... | python | def _qr_code(self, instance):
"""
return generate html code with "otpauth://..." link and QR-code
"""
request = self.request # FIXME
try:
user = instance.user
except ObjectDoesNotExist:
return _("Please save first!")
current_site = get_cur... | [
"def",
"_qr_code",
"(",
"self",
",",
"instance",
")",
":",
"request",
"=",
"self",
".",
"request",
"# FIXME",
"try",
":",
"user",
"=",
"instance",
".",
"user",
"except",
"ObjectDoesNotExist",
":",
"return",
"_",
"(",
"\"Please save first!\"",
")",
"current_s... | return generate html code with "otpauth://..." link and QR-code | [
"return",
"generate",
"html",
"code",
"with",
"otpauth",
":",
"//",
"...",
"link",
"and",
"QR",
"-",
"code"
] | train | https://github.com/discontinue/django-secure-js-login/blob/4bfc592c48f381de115e592e721f31d2eb915968/secure_js_login/admin.py#L53-L76 |
discontinue/django-secure-js-login | secure_js_login/admin.py | TOTPDeviceAdmin2.qr_code | def qr_code(self, instance):
"""
Display picture of QR-code from used secret
"""
try:
return self._qr_code(instance)
except Exception as err:
if settings.DEBUG:
import traceback
return "<pre>%s</pre>" % traceback.format_exc(... | python | def qr_code(self, instance):
"""
Display picture of QR-code from used secret
"""
try:
return self._qr_code(instance)
except Exception as err:
if settings.DEBUG:
import traceback
return "<pre>%s</pre>" % traceback.format_exc(... | [
"def",
"qr_code",
"(",
"self",
",",
"instance",
")",
":",
"try",
":",
"return",
"self",
".",
"_qr_code",
"(",
"instance",
")",
"except",
"Exception",
"as",
"err",
":",
"if",
"settings",
".",
"DEBUG",
":",
"import",
"traceback",
"return",
"\"<pre>%s</pre>\"... | Display picture of QR-code from used secret | [
"Display",
"picture",
"of",
"QR",
"-",
"code",
"from",
"used",
"secret"
] | train | https://github.com/discontinue/django-secure-js-login/blob/4bfc592c48f381de115e592e721f31d2eb915968/secure_js_login/admin.py#L78-L87 |
discontinue/django-secure-js-login | secure_js_login/admin.py | TOTPDeviceAdmin2.tokens | def tokens(self, instance):
"""
Just display current acceptable TOTP tokens
"""
if not instance.pk:
# e.g.: Use will create a new TOTP entry
return "-"
totp = TOTP(instance.bin_key, instance.step, instance.t0, instance.digits)
tokens = []
... | python | def tokens(self, instance):
"""
Just display current acceptable TOTP tokens
"""
if not instance.pk:
# e.g.: Use will create a new TOTP entry
return "-"
totp = TOTP(instance.bin_key, instance.step, instance.t0, instance.digits)
tokens = []
... | [
"def",
"tokens",
"(",
"self",
",",
"instance",
")",
":",
"if",
"not",
"instance",
".",
"pk",
":",
"# e.g.: Use will create a new TOTP entry",
"return",
"\"-\"",
"totp",
"=",
"TOTP",
"(",
"instance",
".",
"bin_key",
",",
"instance",
".",
"step",
",",
"instanc... | Just display current acceptable TOTP tokens | [
"Just",
"display",
"current",
"acceptable",
"TOTP",
"tokens"
] | train | https://github.com/discontinue/django-secure-js-login/blob/4bfc592c48f381de115e592e721f31d2eb915968/secure_js_login/admin.py#L91-L106 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | parse | def parse(text, showToc=True):
"""Returns HTML from MediaWiki markup"""
p = Parser(show_toc=showToc)
return p.parse(text) | python | def parse(text, showToc=True):
"""Returns HTML from MediaWiki markup"""
p = Parser(show_toc=showToc)
return p.parse(text) | [
"def",
"parse",
"(",
"text",
",",
"showToc",
"=",
"True",
")",
":",
"p",
"=",
"Parser",
"(",
"show_toc",
"=",
"showToc",
")",
"return",
"p",
".",
"parse",
"(",
"text",
")"
] | Returns HTML from MediaWiki markup | [
"Returns",
"HTML",
"from",
"MediaWiki",
"markup"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L2011-L2014 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | to_unicode | def to_unicode(text, charset=None):
"""Convert a `str` object to an `unicode` object.
If `charset` is given, we simply assume that encoding for the text,
but we'll use the "replace" mode so that the decoding will always
succeed.
If `charset` is ''not'' specified, we'll make some guesses, first
trying the UTF-8 e... | python | def to_unicode(text, charset=None):
"""Convert a `str` object to an `unicode` object.
If `charset` is given, we simply assume that encoding for the text,
but we'll use the "replace" mode so that the decoding will always
succeed.
If `charset` is ''not'' specified, we'll make some guesses, first
trying the UTF-8 e... | [
"def",
"to_unicode",
"(",
"text",
",",
"charset",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"if",
"isinstance",
"(",
"text",
",",
"Exception",
")",
":",
"# two possibilities for storing unicode strings in exception data... | Convert a `str` object to an `unicode` object.
If `charset` is given, we simply assume that encoding for the text,
but we'll use the "replace" mode so that the decoding will always
succeed.
If `charset` is ''not'' specified, we'll make some guesses, first
trying the UTF-8 encoding, then trying the locale preferre... | [
"Convert",
"a",
"str",
"object",
"to",
"an",
"unicode",
"object",
"."
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L2042-L2075 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | str2url | def str2url(str):
"""
Takes a UTF-8 string and replaces all characters with the equivalent in 7-bit
ASCII. It returns a plain ASCII string usable in URLs.
"""
try:
str = str.encode('utf-8')
except:
pass
mfrom = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîï"
to = "AAAAAAECEEEEIIIIDNOOOOOOUUUUYSaaaaaaaceee... | python | def str2url(str):
"""
Takes a UTF-8 string and replaces all characters with the equivalent in 7-bit
ASCII. It returns a plain ASCII string usable in URLs.
"""
try:
str = str.encode('utf-8')
except:
pass
mfrom = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîï"
to = "AAAAAAECEEEEIIIIDNOOOOOOUUUUYSaaaaaaaceee... | [
"def",
"str2url",
"(",
"str",
")",
":",
"try",
":",
"str",
"=",
"str",
".",
"encode",
"(",
"'utf-8'",
")",
"except",
":",
"pass",
"mfrom",
"=",
"\"ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîï\"",
"to",
"=",
"\"AAAAAAECEEEEIIIIDNOOOOOOUUUUYSaaaaaaaceeeeiiii\"",
"mf... | Takes a UTF-8 string and replaces all characters with the equivalent in 7-bit
ASCII. It returns a plain ASCII string usable in URLs. | [
"Takes",
"a",
"UTF",
"-",
"8",
"string",
"and",
"replaces",
"all",
"characters",
"with",
"the",
"equivalent",
"in",
"7",
"-",
"bit",
"ASCII",
".",
"It",
"returns",
"a",
"plain",
"ASCII",
"string",
"usable",
"in",
"URLs",
"."
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L2113-L2146 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.removeHtmlTags | def removeHtmlTags(self, text):
"""convert bad tags into HTML identities"""
sb = []
text = self.removeHtmlComments(text)
bits = text.split(u'<')
sb.append(bits.pop(0))
tagstack = []
tablestack = tagstack
for x in bits:
m = _tagPattern.match(x)
if not m:
continue
slash, t, params, brace, res... | python | def removeHtmlTags(self, text):
"""convert bad tags into HTML identities"""
sb = []
text = self.removeHtmlComments(text)
bits = text.split(u'<')
sb.append(bits.pop(0))
tagstack = []
tablestack = tagstack
for x in bits:
m = _tagPattern.match(x)
if not m:
continue
slash, t, params, brace, res... | [
"def",
"removeHtmlTags",
"(",
"self",
",",
"text",
")",
":",
"sb",
"=",
"[",
"]",
"text",
"=",
"self",
".",
"removeHtmlComments",
"(",
"text",
")",
"bits",
"=",
"text",
".",
"split",
"(",
"u'<'",
")",
"sb",
".",
"append",
"(",
"bits",
".",
"pop",
... | convert bad tags into HTML identities | [
"convert",
"bad",
"tags",
"into",
"HTML",
"identities"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L558-L658 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.removeHtmlComments | def removeHtmlComments(self, text):
"""remove <!-- text --> comments from given text"""
sb = []
start = text.find(u'<!--')
last = 0
while start != -1:
end = text.find(u'-->', start)
if end == -1:
break
end += 3
spaceStart = max(0, start-1)
spaceEnd = end
while text[spaceStart] == u' ' a... | python | def removeHtmlComments(self, text):
"""remove <!-- text --> comments from given text"""
sb = []
start = text.find(u'<!--')
last = 0
while start != -1:
end = text.find(u'-->', start)
if end == -1:
break
end += 3
spaceStart = max(0, start-1)
spaceEnd = end
while text[spaceStart] == u' ' a... | [
"def",
"removeHtmlComments",
"(",
"self",
",",
"text",
")",
":",
"sb",
"=",
"[",
"]",
"start",
"=",
"text",
".",
"find",
"(",
"u'<!--'",
")",
"last",
"=",
"0",
"while",
"start",
"!=",
"-",
"1",
":",
"end",
"=",
"text",
".",
"find",
"(",
"u'-->'",... | remove <!-- text --> comments from given text | [
"remove",
"<!",
"--",
"text",
"--",
">",
"comments",
"from",
"given",
"text"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L660-L688 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.decodeTagAttributes | def decodeTagAttributes(self, text):
"""docstring for decodeTagAttributes"""
attribs = {}
if text.strip() == u'':
return attribs
scanner = _attributePat.scanner(text)
match = scanner.search()
while match:
key, val1, val2, val3, val4 = match.groups()
value = val1 or val2 or val3 or val4
if value:... | python | def decodeTagAttributes(self, text):
"""docstring for decodeTagAttributes"""
attribs = {}
if text.strip() == u'':
return attribs
scanner = _attributePat.scanner(text)
match = scanner.search()
while match:
key, val1, val2, val3, val4 = match.groups()
value = val1 or val2 or val3 or val4
if value:... | [
"def",
"decodeTagAttributes",
"(",
"self",
",",
"text",
")",
":",
"attribs",
"=",
"{",
"}",
"if",
"text",
".",
"strip",
"(",
")",
"==",
"u''",
":",
"return",
"attribs",
"scanner",
"=",
"_attributePat",
".",
"scanner",
"(",
"text",
")",
"match",
"=",
... | docstring for decodeTagAttributes | [
"docstring",
"for",
"decodeTagAttributes"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L690-L707 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.validateTagAttributes | def validateTagAttributes(self, attribs, element):
"""docstring for validateTagAttributes"""
out = {}
if element not in _whitelist:
return out
whitelist = _whitelist[element]
for attribute in attribs:
value = attribs[attribute]
if attribute not in whitelist:
continue
# Strip javascript "expres... | python | def validateTagAttributes(self, attribs, element):
"""docstring for validateTagAttributes"""
out = {}
if element not in _whitelist:
return out
whitelist = _whitelist[element]
for attribute in attribs:
value = attribs[attribute]
if attribute not in whitelist:
continue
# Strip javascript "expres... | [
"def",
"validateTagAttributes",
"(",
"self",
",",
"attribs",
",",
"element",
")",
":",
"out",
"=",
"{",
"}",
"if",
"element",
"not",
"in",
"_whitelist",
":",
"return",
"out",
"whitelist",
"=",
"_whitelist",
"[",
"element",
"]",
"for",
"attribute",
"in",
... | docstring for validateTagAttributes | [
"docstring",
"for",
"validateTagAttributes"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L709-L730 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.safeEncodeAttribute | def safeEncodeAttribute(self, encValue):
"""docstring for safeEncodeAttribute"""
encValue = encValue.replace(u'&', u'&')
encValue = encValue.replace(u'<', u'<')
encValue = encValue.replace(u'>', u'>')
encValue = encValue.replace(u'"', u'"')
encValue = encValue.replace(u'{', u'{')
encVa... | python | def safeEncodeAttribute(self, encValue):
"""docstring for safeEncodeAttribute"""
encValue = encValue.replace(u'&', u'&')
encValue = encValue.replace(u'<', u'<')
encValue = encValue.replace(u'>', u'>')
encValue = encValue.replace(u'"', u'"')
encValue = encValue.replace(u'{', u'{')
encVa... | [
"def",
"safeEncodeAttribute",
"(",
"self",
",",
"encValue",
")",
":",
"encValue",
"=",
"encValue",
".",
"replace",
"(",
"u'&'",
",",
"u'&'",
")",
"encValue",
"=",
"encValue",
".",
"replace",
"(",
"u'<'",
",",
"u'<'",
")",
"encValue",
"=",
"encValue"... | docstring for safeEncodeAttribute | [
"docstring",
"for",
"safeEncodeAttribute"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L732-L749 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.checkCss | def checkCss(self, value):
"""docstring for checkCss"""
stripped = self.decodeCharReferences(value)
stripped = _cssCommentPat.sub(u'', stripped)
value = stripped
stripped = _toUTFPat.sub(self._convertToUtf8, stripped)
stripped.replace(u'\\', u'')
if _hackPat.search(stripped):
# someone is haxx0ring
... | python | def checkCss(self, value):
"""docstring for checkCss"""
stripped = self.decodeCharReferences(value)
stripped = _cssCommentPat.sub(u'', stripped)
value = stripped
stripped = _toUTFPat.sub(self._convertToUtf8, stripped)
stripped.replace(u'\\', u'')
if _hackPat.search(stripped):
# someone is haxx0ring
... | [
"def",
"checkCss",
"(",
"self",
",",
"value",
")",
":",
"stripped",
"=",
"self",
".",
"decodeCharReferences",
"(",
"value",
")",
"stripped",
"=",
"_cssCommentPat",
".",
"sub",
"(",
"u''",
",",
"stripped",
")",
"value",
"=",
"stripped",
"stripped",
"=",
"... | docstring for checkCss | [
"docstring",
"for",
"checkCss"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L844-L857 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.extractTagsAndParams | def extractTagsAndParams(self, elements, text, matches):
"""
Replaces all occurrences of HTML-style comments and the given tags
in the text with a random marker and returns teh next text. The output
parameter $matches will be an associative array filled with data in
the form:
'UNIQ-xxxxx' => array(
'e... | python | def extractTagsAndParams(self, elements, text, matches):
"""
Replaces all occurrences of HTML-style comments and the given tags
in the text with a random marker and returns teh next text. The output
parameter $matches will be an associative array filled with data in
the form:
'UNIQ-xxxxx' => array(
'e... | [
"def",
"extractTagsAndParams",
"(",
"self",
",",
"elements",
",",
"text",
",",
"matches",
")",
":",
"stripped",
"=",
"u''",
"taglist",
"=",
"u'|'",
".",
"join",
"(",
"elements",
")",
"if",
"taglist",
"not",
"in",
"_startRegexHash",
":",
"_startRegexHash",
... | Replaces all occurrences of HTML-style comments and the given tags
in the text with a random marker and returns teh next text. The output
parameter $matches will be an associative array filled with data in
the form:
'UNIQ-xxxxx' => array(
'element',
'tag content',
array( 'param' => 'x' ),
'<el... | [
"Replaces",
"all",
"occurrences",
"of",
"HTML",
"-",
"style",
"comments",
"and",
"the",
"given",
"tags",
"in",
"the",
"text",
"with",
"a",
"random",
"marker",
"and",
"returns",
"teh",
"next",
"text",
".",
"The",
"output",
"parameter",
"$matches",
"will",
"... | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L1187-L1255 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.fixtags | def fixtags(self, text):
"""Clean up special characters, only run once, next-to-last before doBlockLevels"""
# french spaces, last one Guillemet-left
# only if there is something before the space
text = _guillemetLeftPat.sub(ur'\1 \2', text)
# french spaces, Guillemet-right
text = _guillemetRightPat.su... | python | def fixtags(self, text):
"""Clean up special characters, only run once, next-to-last before doBlockLevels"""
# french spaces, last one Guillemet-left
# only if there is something before the space
text = _guillemetLeftPat.sub(ur'\1 \2', text)
# french spaces, Guillemet-right
text = _guillemetRightPat.su... | [
"def",
"fixtags",
"(",
"self",
",",
"text",
")",
":",
"# french spaces, last one Guillemet-left",
"# only if there is something before the space",
"text",
"=",
"_guillemetLeftPat",
".",
"sub",
"(",
"ur'\\1 \\2'",
",",
"text",
")",
"# french spaces, Guillemet-right",
"t... | Clean up special characters, only run once, next-to-last before doBlockLevels | [
"Clean",
"up",
"special",
"characters",
"only",
"run",
"once",
"next",
"-",
"to",
"-",
"last",
"before",
"doBlockLevels"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L1257-L1264 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.closeParagraph | def closeParagraph(self, mLastSection):
"""Used by doBlockLevels()"""
result = u''
if mLastSection != u'':
result = u'</' + mLastSection + u'>\n'
return result | python | def closeParagraph(self, mLastSection):
"""Used by doBlockLevels()"""
result = u''
if mLastSection != u'':
result = u'</' + mLastSection + u'>\n'
return result | [
"def",
"closeParagraph",
"(",
"self",
",",
"mLastSection",
")",
":",
"result",
"=",
"u''",
"if",
"mLastSection",
"!=",
"u''",
":",
"result",
"=",
"u'</'",
"+",
"mLastSection",
"+",
"u'>\\n'",
"return",
"result"
] | Used by doBlockLevels() | [
"Used",
"by",
"doBlockLevels",
"()"
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L1266-L1272 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.getCommon | def getCommon(self, st1, st2):
"""
getCommon() returns the length of the longest common substring
of both arguments, starting at the beginning of both.
"""
fl = len(st1)
shorter = len(st2)
if fl < shorter:
shorter = fl
i = 0
while i < shorter:
if st1[i] != st2[i]:
break
i += 1
return i | python | def getCommon(self, st1, st2):
"""
getCommon() returns the length of the longest common substring
of both arguments, starting at the beginning of both.
"""
fl = len(st1)
shorter = len(st2)
if fl < shorter:
shorter = fl
i = 0
while i < shorter:
if st1[i] != st2[i]:
break
i += 1
return i | [
"def",
"getCommon",
"(",
"self",
",",
"st1",
",",
"st2",
")",
":",
"fl",
"=",
"len",
"(",
"st1",
")",
"shorter",
"=",
"len",
"(",
"st2",
")",
"if",
"fl",
"<",
"shorter",
":",
"shorter",
"=",
"fl",
"i",
"=",
"0",
"while",
"i",
"<",
"shorter",
... | getCommon() returns the length of the longest common substring
of both arguments, starting at the beginning of both. | [
"getCommon",
"()",
"returns",
"the",
"length",
"of",
"the",
"longest",
"common",
"substring",
"of",
"both",
"arguments",
"starting",
"at",
"the",
"beginning",
"of",
"both",
"."
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L1274-L1289 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | BaseParser.openList | def openList(self, char, mLastSection):
"""
These next three functions open, continue, and close the list
element appropriate to the prefix character passed into them.
"""
result = self.closeParagraph(mLastSection)
mDTopen = False
if char == u'*':
result += u'<ul><li>'
elif char == u'#':
result +... | python | def openList(self, char, mLastSection):
"""
These next three functions open, continue, and close the list
element appropriate to the prefix character passed into them.
"""
result = self.closeParagraph(mLastSection)
mDTopen = False
if char == u'*':
result += u'<ul><li>'
elif char == u'#':
result +... | [
"def",
"openList",
"(",
"self",
",",
"char",
",",
"mLastSection",
")",
":",
"result",
"=",
"self",
".",
"closeParagraph",
"(",
"mLastSection",
")",
"mDTopen",
"=",
"False",
"if",
"char",
"==",
"u'*'",
":",
"result",
"+=",
"u'<ul><li>'",
"elif",
"char",
"... | These next three functions open, continue, and close the list
element appropriate to the prefix character passed into them. | [
"These",
"next",
"three",
"functions",
"open",
"continue",
"and",
"close",
"the",
"list",
"element",
"appropriate",
"to",
"the",
"prefix",
"character",
"passed",
"into",
"them",
"."
] | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L1291-L1311 |
zikzakmedia/python-mediawiki | mediawiki/wikimarkup/__init__.py | Parser.formatHeadings | def formatHeadings(self, text, isMain):
"""
This function accomplishes several tasks:
1) Auto-number headings if that option is enabled
2) Add an [edit] link to sections for logged in users who have enabled the option
3) Add a Table of contents on the top for users who have enabled the option
4) Auto-anchor... | python | def formatHeadings(self, text, isMain):
"""
This function accomplishes several tasks:
1) Auto-number headings if that option is enabled
2) Add an [edit] link to sections for logged in users who have enabled the option
3) Add a Table of contents on the top for users who have enabled the option
4) Auto-anchor... | [
"def",
"formatHeadings",
"(",
"self",
",",
"text",
",",
"isMain",
")",
":",
"doNumberHeadings",
"=",
"False",
"showEditLink",
"=",
"True",
"# Can User Edit",
"if",
"text",
".",
"find",
"(",
"u\"__NOEDITSECTION__\"",
")",
"!=",
"-",
"1",
":",
"showEditLink",
... | This function accomplishes several tasks:
1) Auto-number headings if that option is enabled
2) Add an [edit] link to sections for logged in users who have enabled the option
3) Add a Table of contents on the top for users who have enabled the option
4) Auto-anchor headings
It loops through all headlines, col... | [
"This",
"function",
"accomplishes",
"several",
"tasks",
":",
"1",
")",
"Auto",
"-",
"number",
"headings",
"if",
"that",
"option",
"is",
"enabled",
"2",
")",
"Add",
"an",
"[",
"edit",
"]",
"link",
"to",
"sections",
"for",
"logged",
"in",
"users",
"who",
... | train | https://github.com/zikzakmedia/python-mediawiki/blob/7c26732efa520e16c35350815ce98cd7610a0bcb/mediawiki/wikimarkup/__init__.py#L1777-L2009 |
MacHu-GWU/docfly-project | docfly/pkg/picage/helpers.py | is_valid_package_module_name | def is_valid_package_module_name(name):
"""
Test whether it's a valid package or module name.
- a-z, 0-9, and underline
- starts with underline or alpha letter
valid:
- ``a``
- ``a.b.c``
- ``_a``
- ``_a._b._c``
invalid:
- ``A``
- ``0``
- ``.a``
- ``a#b``
... | python | def is_valid_package_module_name(name):
"""
Test whether it's a valid package or module name.
- a-z, 0-9, and underline
- starts with underline or alpha letter
valid:
- ``a``
- ``a.b.c``
- ``_a``
- ``_a._b._c``
invalid:
- ``A``
- ``0``
- ``.a``
- ``a#b``
... | [
"def",
"is_valid_package_module_name",
"(",
"name",
")",
":",
"if",
"\".\"",
"in",
"name",
":",
"for",
"part",
"in",
"name",
".",
"split",
"(",
"\".\"",
")",
":",
"if",
"not",
"is_valid_package_module_name",
"(",
"part",
")",
":",
"return",
"False",
"elif"... | Test whether it's a valid package or module name.
- a-z, 0-9, and underline
- starts with underline or alpha letter
valid:
- ``a``
- ``a.b.c``
- ``_a``
- ``_a._b._c``
invalid:
- ``A``
- ``0``
- ``.a``
- ``a#b`` | [
"Test",
"whether",
"it",
"s",
"a",
"valid",
"package",
"or",
"module",
"name",
"."
] | train | https://github.com/MacHu-GWU/docfly-project/blob/46da8a9793211301c3ebc12d195228dbf79fdfec/docfly/pkg/picage/helpers.py#L29-L62 |
tommyod/streprogen | streprogen/program.py | Program._set_scalers | def _set_scalers(self):
"""
Set the variables self._scalers as given by self.scalers,
if self.scalers is None, then a default value is used.
"""
# Set default value for rep_scalers if None
if self.rep_scalers is None:
# Draw self-repellent numbers from domain... | python | def _set_scalers(self):
"""
Set the variables self._scalers as given by self.scalers,
if self.scalers is None, then a default value is used.
"""
# Set default value for rep_scalers if None
if self.rep_scalers is None:
# Draw self-repellent numbers from domain... | [
"def",
"_set_scalers",
"(",
"self",
")",
":",
"# Set default value for rep_scalers if None",
"if",
"self",
".",
"rep_scalers",
"is",
"None",
":",
"# Draw self-repellent numbers from domain",
"domain",
"=",
"[",
"0.8",
",",
"1",
",",
"1.2",
"]",
"gen",
"=",
"Repell... | Set the variables self._scalers as given by self.scalers,
if self.scalers is None, then a default value is used. | [
"Set",
"the",
"variables",
"self",
".",
"_scalers",
"as",
"given",
"by",
"self",
".",
"scalers",
"if",
"self",
".",
"scalers",
"is",
"None",
"then",
"a",
"default",
"value",
"is",
"used",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L188-L216 |
tommyod/streprogen | streprogen/program.py | Program._validate | def _validate(self):
"""
The purpose of this method is to verify that the user has set sensible
values for the training program before rendering. The user will still
be able to render, but error messages will be printed. This method:
* Validates that the average ... | python | def _validate(self):
"""
The purpose of this method is to verify that the user has set sensible
values for the training program before rendering. The user will still
be able to render, but error messages will be printed. This method:
* Validates that the average ... | [
"def",
"_validate",
"(",
"self",
")",
":",
"# Validate the intensity",
"if",
"max",
"(",
"[",
"s",
"*",
"self",
".",
"intensity",
"for",
"s",
"in",
"self",
".",
"_intensity_scalers",
"]",
")",
">",
"85",
":",
"warnings",
".",
"warn",
"(",
"'\\nWARNING: A... | The purpose of this method is to verify that the user has set sensible
values for the training program before rendering. The user will still
be able to render, but error messages will be printed. This method:
* Validates that the average intensity is in the range [65, 85].
... | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"verify",
"that",
"the",
"user",
"has",
"set",
"sensible",
"values",
"for",
"the",
"training",
"program",
"before",
"rendering",
".",
"The",
"user",
"will",
"still",
"be",
"able",
"to",
"render",
"but",... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L218-L268 |
tommyod/streprogen | streprogen/program.py | Program.add_days | def add_days(self, *days):
"""Add one or several days to the program.
Parameters
----------
*days
Unpacked tuple containing
:py:class:`streprogen.Day` instances.
Examples
-------
>>> program = Program('My training program')
... | python | def add_days(self, *days):
"""Add one or several days to the program.
Parameters
----------
*days
Unpacked tuple containing
:py:class:`streprogen.Day` instances.
Examples
-------
>>> program = Program('My training program')
... | [
"def",
"add_days",
"(",
"self",
",",
"*",
"days",
")",
":",
"for",
"day",
"in",
"list",
"(",
"days",
")",
":",
"self",
".",
"days",
".",
"append",
"(",
"day",
")"
] | Add one or several days to the program.
Parameters
----------
*days
Unpacked tuple containing
:py:class:`streprogen.Day` instances.
Examples
-------
>>> program = Program('My training program')
>>> day1, day2 = Day(), Day()
... | [
"Add",
"one",
"or",
"several",
"days",
"to",
"the",
"program",
".",
"Parameters",
"----------",
"*",
"days",
"Unpacked",
"tuple",
"containing",
":",
"py",
":",
"class",
":",
"streprogen",
".",
"Day",
"instances",
".",
"Examples",
"-------",
">>>",
"program",... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L270-L287 |
tommyod/streprogen | streprogen/program.py | Program.repstring_penalty | def repstring_penalty(reps, intensities, desired_reps, desired_intensity,
minimum_rep):
"""Penalty function which calculates how "bad" a set of
reps and intensities is, compared to the desired repetitions,
the desired intensity level and the minimum repetitions.
... | python | def repstring_penalty(reps, intensities, desired_reps, desired_intensity,
minimum_rep):
"""Penalty function which calculates how "bad" a set of
reps and intensities is, compared to the desired repetitions,
the desired intensity level and the minimum repetitions.
... | [
"def",
"repstring_penalty",
"(",
"reps",
",",
"intensities",
",",
"desired_reps",
",",
"desired_intensity",
",",
"minimum_rep",
")",
":",
"# Punish when the mean intensity is far from the desired one",
"desired",
"=",
"desired_intensity",
"error1",
"=",
"abs",
"(",
"stati... | Penalty function which calculates how "bad" a set of
reps and intensities is, compared to the desired repetitions,
the desired intensity level and the minimum repetitions.
Advanced users may substitute this function for their own version.
Parameters
----------
reps
... | [
"Penalty",
"function",
"which",
"calculates",
"how",
"bad",
"a",
"set",
"of",
"reps",
"and",
"intensities",
"is",
"compared",
"to",
"the",
"desired",
"repetitions",
"the",
"desired",
"intensity",
"level",
"and",
"the",
"minimum",
"repetitions",
".",
"Advanced",
... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L290-L346 |
tommyod/streprogen | streprogen/program.py | Program._render_dynamic | def _render_dynamic(self, dynamic_exercise, min_rep,
desired_reps, desired_intensity, validate):
"""
Render a single dynamic exercise.
This is done for each exercise every week.
"""
# --------------------------------
# Generate possible repstring ... | python | def _render_dynamic(self, dynamic_exercise, min_rep,
desired_reps, desired_intensity, validate):
"""
Render a single dynamic exercise.
This is done for each exercise every week.
"""
# --------------------------------
# Generate possible repstring ... | [
"def",
"_render_dynamic",
"(",
"self",
",",
"dynamic_exercise",
",",
"min_rep",
",",
"desired_reps",
",",
"desired_intensity",
",",
"validate",
")",
":",
"# --------------------------------",
"# Generate possible repstring and calculate penalties",
"# ----------------------------... | Render a single dynamic exercise.
This is done for each exercise every week. | [
"Render",
"a",
"single",
"dynamic",
"exercise",
".",
"This",
"is",
"done",
"for",
"each",
"exercise",
"every",
"week",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L348-L413 |
tommyod/streprogen | streprogen/program.py | Program._initialize_render_dictionary | def _initialize_render_dictionary(self):
"""Initialize a dictionary for rendered values.
Examples
-------
>>> program = Program('My training program')
>>> program._initialize_render_dictionary()
>>> program._rendered is False
False
"""
s... | python | def _initialize_render_dictionary(self):
"""Initialize a dictionary for rendered values.
Examples
-------
>>> program = Program('My training program')
>>> program._initialize_render_dictionary()
>>> program._rendered is False
False
"""
s... | [
"def",
"_initialize_render_dictionary",
"(",
"self",
")",
":",
"self",
".",
"_rendered",
"=",
"dict",
"(",
")",
"# Iterate over all weeks",
"for",
"week",
"in",
"range",
"(",
"1",
",",
"self",
".",
"duration",
"+",
"1",
")",
":",
"self",
".",
"_rendered",
... | Initialize a dictionary for rendered values.
Examples
-------
>>> program = Program('My training program')
>>> program._initialize_render_dictionary()
>>> program._rendered is False
False | [
"Initialize",
"a",
"dictionary",
"for",
"rendered",
"values",
".",
"Examples",
"-------",
">>>",
"program",
"=",
"Program",
"(",
"My",
"training",
"program",
")",
">>>",
"program",
".",
"_initialize_render_dictionary",
"()",
">>>",
"program",
".",
"_rendered",
"... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L415-L439 |
tommyod/streprogen | streprogen/program.py | Program._set_min_reps | def _set_min_reps(self):
"""Populate the _rendered dictionary with entries corresponding
to the minimum number of reps to go to for each exercise
and for the entire duration.
Examples
-------
>>> program = Program('My training program', duration = 2)
>>>... | python | def _set_min_reps(self):
"""Populate the _rendered dictionary with entries corresponding
to the minimum number of reps to go to for each exercise
and for the entire duration.
Examples
-------
>>> program = Program('My training program', duration = 2)
>>>... | [
"def",
"_set_min_reps",
"(",
"self",
")",
":",
"min_percent",
"=",
"self",
".",
"minimum_percentile",
"# --------------------------------",
"# If the mode is weekly, set minimum reps on a weekly basis",
"# --------------------------------",
"if",
"self",
".",
"_min_reps_consistency... | Populate the _rendered dictionary with entries corresponding
to the minimum number of reps to go to for each exercise
and for the entire duration.
Examples
-------
>>> program = Program('My training program', duration = 2)
>>> bench_press = DynamicExercise('Benc... | [
"Populate",
"the",
"_rendered",
"dictionary",
"with",
"entries",
"corresponding",
"to",
"the",
"minimum",
"number",
"of",
"reps",
"to",
"go",
"to",
"for",
"each",
"exercise",
"and",
"for",
"the",
"entire",
"duration",
".",
"Examples",
"-------",
">>>",
"progra... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L441-L523 |
tommyod/streprogen | streprogen/program.py | Program._yield_week_day_dynamic | def _yield_week_day_dynamic(self):
"""A helper function to reduce the number of nested loops.
Yields
-------
tuple
A tuple with (week, day, dynamic_ex).
"""
# Iterate over all weeks
for week in range(1, self.duration + 1):
# Iterate over ... | python | def _yield_week_day_dynamic(self):
"""A helper function to reduce the number of nested loops.
Yields
-------
tuple
A tuple with (week, day, dynamic_ex).
"""
# Iterate over all weeks
for week in range(1, self.duration + 1):
# Iterate over ... | [
"def",
"_yield_week_day_dynamic",
"(",
"self",
")",
":",
"# Iterate over all weeks",
"for",
"week",
"in",
"range",
"(",
"1",
",",
"self",
".",
"duration",
"+",
"1",
")",
":",
"# Iterate over all days",
"for",
"day",
"in",
"self",
".",
"days",
":",
"# Iterate... | A helper function to reduce the number of nested loops.
Yields
-------
tuple
A tuple with (week, day, dynamic_ex). | [
"A",
"helper",
"function",
"to",
"reduce",
"the",
"number",
"of",
"nested",
"loops",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L525-L540 |
tommyod/streprogen | streprogen/program.py | Program._yield_week_day | def _yield_week_day(self, enumeration=False):
"""A helper function to reduce the number of nested loops.
Parameters
----------
enumeration
Whether or not to wrap the days in enumerate().
Yields
-------
tuple
A tup... | python | def _yield_week_day(self, enumeration=False):
"""A helper function to reduce the number of nested loops.
Parameters
----------
enumeration
Whether or not to wrap the days in enumerate().
Yields
-------
tuple
A tup... | [
"def",
"_yield_week_day",
"(",
"self",
",",
"enumeration",
"=",
"False",
")",
":",
"if",
"enumeration",
":",
"# Iterate over all weeks",
"for",
"week",
"in",
"range",
"(",
"1",
",",
"self",
".",
"duration",
"+",
"1",
")",
":",
"# Iterate over all days",
"for... | A helper function to reduce the number of nested loops.
Parameters
----------
enumeration
Whether or not to wrap the days in enumerate().
Yields
-------
tuple
A tuple with (week, day_index, day) or (week, day),
... | [
"A",
"helper",
"function",
"to",
"reduce",
"the",
"number",
"of",
"nested",
"loops",
".",
"Parameters",
"----------",
"enumeration",
"Whether",
"or",
"not",
"to",
"wrap",
"the",
"days",
"in",
"enumerate",
"()",
".",
"Yields",
"-------",
"tuple",
"A",
"tuple"... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L542-L569 |
tommyod/streprogen | streprogen/program.py | Program._yield_exercises | def _yield_exercises(self):
"""A helper function to reduce the number of nested loops.
Yields
-------
(dynamic_ex) or (static_ex)
Yields the exercises in the program.
"""
for day in self.days:
for dynamic_ex in day.dynamic_exercises:
... | python | def _yield_exercises(self):
"""A helper function to reduce the number of nested loops.
Yields
-------
(dynamic_ex) or (static_ex)
Yields the exercises in the program.
"""
for day in self.days:
for dynamic_ex in day.dynamic_exercises:
... | [
"def",
"_yield_exercises",
"(",
"self",
")",
":",
"for",
"day",
"in",
"self",
".",
"days",
":",
"for",
"dynamic_ex",
"in",
"day",
".",
"dynamic_exercises",
":",
"yield",
"dynamic_ex",
"for",
"static_ex",
"in",
"day",
".",
"static_exercises",
":",
"yield",
... | A helper function to reduce the number of nested loops.
Yields
-------
(dynamic_ex) or (static_ex)
Yields the exercises in the program. | [
"A",
"helper",
"function",
"to",
"reduce",
"the",
"number",
"of",
"nested",
"loops",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L585-L599 |
tommyod/streprogen | streprogen/program.py | Program.render | def render(self, validate=True):
"""Render the training program to perform the calculations.
The program can be rendered several times to produce new
information given the same input parameters.
Parameters
----------
validate
Boolean that indicates whethe... | python | def render(self, validate=True):
"""Render the training program to perform the calculations.
The program can be rendered several times to produce new
information given the same input parameters.
Parameters
----------
validate
Boolean that indicates whethe... | [
"def",
"render",
"(",
"self",
",",
"validate",
"=",
"True",
")",
":",
"# --------------------------------",
"# Prepare for rendering the dynamic exercises",
"# --------------------------------",
"# Set the minimum repetitions consistency mode,",
"# which is either 'weekly', 'daily' or 'e... | Render the training program to perform the calculations.
The program can be rendered several times to produce new
information given the same input parameters.
Parameters
----------
validate
Boolean that indicates whether or not to run a validation
heu... | [
"Render",
"the",
"training",
"program",
"to",
"perform",
"the",
"calculations",
".",
"The",
"program",
"can",
"be",
"rendered",
"several",
"times",
"to",
"produce",
"new",
"information",
"given",
"the",
"same",
"input",
"parameters",
".",
"Parameters",
"--------... | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L601-L694 |
tommyod/streprogen | streprogen/program.py | Program._set_jinja2_enviroment | def _set_jinja2_enviroment(self):
"""
Set up the jinja2 environment.
"""
template_loader = FileSystemLoader(searchpath=self.TEMPLATE_DIR)
env = Environment(loader=template_loader, trim_blocks=True,
lstrip_blocks=True)
env.globals.update(chunker... | python | def _set_jinja2_enviroment(self):
"""
Set up the jinja2 environment.
"""
template_loader = FileSystemLoader(searchpath=self.TEMPLATE_DIR)
env = Environment(loader=template_loader, trim_blocks=True,
lstrip_blocks=True)
env.globals.update(chunker... | [
"def",
"_set_jinja2_enviroment",
"(",
"self",
")",
":",
"template_loader",
"=",
"FileSystemLoader",
"(",
"searchpath",
"=",
"self",
".",
"TEMPLATE_DIR",
")",
"env",
"=",
"Environment",
"(",
"loader",
"=",
"template_loader",
",",
"trim_blocks",
"=",
"True",
",",
... | Set up the jinja2 environment. | [
"Set",
"up",
"the",
"jinja2",
"environment",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L696-L712 |
tommyod/streprogen | streprogen/program.py | Program.to_html | def to_html(self, table_width=5):
"""Write the program information to HTML code, which can be saved,
printed and brought to the gym.
Parameters
----------
table_width
The table with of the HTML code.
Returns
-------
string
HTML co... | python | def to_html(self, table_width=5):
"""Write the program information to HTML code, which can be saved,
printed and brought to the gym.
Parameters
----------
table_width
The table with of the HTML code.
Returns
-------
string
HTML co... | [
"def",
"to_html",
"(",
"self",
",",
"table_width",
"=",
"5",
")",
":",
"env",
"=",
"self",
".",
"jinja2_environment",
"template",
"=",
"env",
".",
"get_template",
"(",
"self",
".",
"TEMPLATE_NAMES",
"[",
"'html'",
"]",
")",
"return",
"template",
".",
"re... | Write the program information to HTML code, which can be saved,
printed and brought to the gym.
Parameters
----------
table_width
The table with of the HTML code.
Returns
-------
string
HTML code. | [
"Write",
"the",
"program",
"information",
"to",
"HTML",
"code",
"which",
"can",
"be",
"saved",
"printed",
"and",
"brought",
"to",
"the",
"gym",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L715-L732 |
tommyod/streprogen | streprogen/program.py | Program.to_txt | def to_txt(self, verbose=False):
"""Write the program information to text,
which can be printed in a terminal.
Parameters
----------
verbose
If True, more information is shown.
Returns
-------
string
Program as text.
"""
... | python | def to_txt(self, verbose=False):
"""Write the program information to text,
which can be printed in a terminal.
Parameters
----------
verbose
If True, more information is shown.
Returns
-------
string
Program as text.
"""
... | [
"def",
"to_txt",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"# Get information related to formatting",
"exercises",
"=",
"list",
"(",
"self",
".",
"_yield_exercises",
"(",
")",
")",
"max_ex_name",
"=",
"0",
"if",
"len",
"(",
"exercises",
")",
"!=",... | Write the program information to text,
which can be printed in a terminal.
Parameters
----------
verbose
If True, more information is shown.
Returns
-------
string
Program as text. | [
"Write",
"the",
"program",
"information",
"to",
"text",
"which",
"can",
"be",
"printed",
"in",
"a",
"terminal",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L734-L766 |
tommyod/streprogen | streprogen/program.py | Program.to_tex | def to_tex(self, text_size='large', table_width=5, clear_pages = False):
"""
Write the program information to a .tex file, which can be
rendered to .pdf running pdflatex. The program can then be
printed and brought to the gym.
Parameters
----------
text_size
... | python | def to_tex(self, text_size='large', table_width=5, clear_pages = False):
"""
Write the program information to a .tex file, which can be
rendered to .pdf running pdflatex. The program can then be
printed and brought to the gym.
Parameters
----------
text_size
... | [
"def",
"to_tex",
"(",
"self",
",",
"text_size",
"=",
"'large'",
",",
"table_width",
"=",
"5",
",",
"clear_pages",
"=",
"False",
")",
":",
"# If rendered, find the length of the longest '6 x 75kg'-type string",
"max_ex_scheme",
"=",
"0",
"if",
"self",
".",
"_rendered... | Write the program information to a .tex file, which can be
rendered to .pdf running pdflatex. The program can then be
printed and brought to the gym.
Parameters
----------
text_size
The tex text size, e.g. '\small', 'normalsize', 'large', 'Large'
or 'LARG... | [
"Write",
"the",
"program",
"information",
"to",
"a",
".",
"tex",
"file",
"which",
"can",
"be",
"rendered",
"to",
".",
"pdf",
"running",
"pdflatex",
".",
"The",
"program",
"can",
"then",
"be",
"printed",
"and",
"brought",
"to",
"the",
"gym",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L768-L802 |
tommyod/streprogen | streprogen/program.py | Program._autoset_min_reps_consistency | def _autoset_min_reps_consistency(self):
"""
Sets the program mode to 'weekly', 'daily' or 'exercise'
by automatically iterating over all exercises.
"""
# -------------------------------------------
# Set automatically by investigating program
# -----------------... | python | def _autoset_min_reps_consistency(self):
"""
Sets the program mode to 'weekly', 'daily' or 'exercise'
by automatically iterating over all exercises.
"""
# -------------------------------------------
# Set automatically by investigating program
# -----------------... | [
"def",
"_autoset_min_reps_consistency",
"(",
"self",
")",
":",
"# -------------------------------------------",
"# Set automatically by investigating program",
"# -------------------------------------------",
"# Check whether the mode is WEEKLY",
"min_reps",
",",
"max_reps",
"=",
"[",
... | Sets the program mode to 'weekly', 'daily' or 'exercise'
by automatically iterating over all exercises. | [
"Sets",
"the",
"program",
"mode",
"to",
"weekly",
"daily",
"or",
"exercise",
"by",
"automatically",
"iterating",
"over",
"all",
"exercises",
"."
] | train | https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/program.py#L810-L858 |
mitsei/dlkit | dlkit/handcar/osid/queries.py | OsidQuery._add_match | def _add_match(self, match_key, match_value):
"""Adds a match key/value"""
if match_key is None:
raise errors.NullArgument()
self._query_terms[match_key] = str(match_key) + '=' + str(match_value) | python | def _add_match(self, match_key, match_value):
"""Adds a match key/value"""
if match_key is None:
raise errors.NullArgument()
self._query_terms[match_key] = str(match_key) + '=' + str(match_value) | [
"def",
"_add_match",
"(",
"self",
",",
"match_key",
",",
"match_value",
")",
":",
"if",
"match_key",
"is",
"None",
":",
"raise",
"errors",
".",
"NullArgument",
"(",
")",
"self",
".",
"_query_terms",
"[",
"match_key",
"]",
"=",
"str",
"(",
"match_key",
")... | Adds a match key/value | [
"Adds",
"a",
"match",
"key",
"/",
"value"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/osid/queries.py#L71-L75 |
mitsei/dlkit | dlkit/handcar/osid/queries.py | OsidExtensibleQuery._load_records | def _load_records(self, record_type_idstrs):
"""Loads query records"""
for record_type_idstr in record_type_idstrs:
try:
self._init_record(record_type_idstr)
except (ImportError, KeyError):
pass | python | def _load_records(self, record_type_idstrs):
"""Loads query records"""
for record_type_idstr in record_type_idstrs:
try:
self._init_record(record_type_idstr)
except (ImportError, KeyError):
pass | [
"def",
"_load_records",
"(",
"self",
",",
"record_type_idstrs",
")",
":",
"for",
"record_type_idstr",
"in",
"record_type_idstrs",
":",
"try",
":",
"self",
".",
"_init_record",
"(",
"record_type_idstr",
")",
"except",
"(",
"ImportError",
",",
"KeyError",
")",
":"... | Loads query records | [
"Loads",
"query",
"records"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/osid/queries.py#L225-L231 |
mitsei/dlkit | dlkit/handcar/osid/queries.py | OsidExtensibleQuery._init_record | def _init_record(self, record_type_idstr):
"""Initializes a query record"""
record_type_data = self._all_supported_record_type_data_sets[Id(record_type_idstr).get_identifier()]
module = importlib.import_module(record_type_data['module_path'])
record = getattr(module, record_type_data['qu... | python | def _init_record(self, record_type_idstr):
"""Initializes a query record"""
record_type_data = self._all_supported_record_type_data_sets[Id(record_type_idstr).get_identifier()]
module = importlib.import_module(record_type_data['module_path'])
record = getattr(module, record_type_data['qu... | [
"def",
"_init_record",
"(",
"self",
",",
"record_type_idstr",
")",
":",
"record_type_data",
"=",
"self",
".",
"_all_supported_record_type_data_sets",
"[",
"Id",
"(",
"record_type_idstr",
")",
".",
"get_identifier",
"(",
")",
"]",
"module",
"=",
"importlib",
".",
... | Initializes a query record | [
"Initializes",
"a",
"query",
"record"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/osid/queries.py#L233-L238 |
mitsei/dlkit | dlkit/handcar/osid/queries.py | OsidObjectQuery.match_display_name | def match_display_name(self, display_name=None, string_match_type=None, match=None):
"""Adds a display name to match.
Multiple display name matches can be added to perform a boolean
``OR`` among them.
arg: display_name (string): display name to match
arg: string_match_typ... | python | def match_display_name(self, display_name=None, string_match_type=None, match=None):
"""Adds a display name to match.
Multiple display name matches can be added to perform a boolean
``OR`` among them.
arg: display_name (string): display name to match
arg: string_match_typ... | [
"def",
"match_display_name",
"(",
"self",
",",
"display_name",
"=",
"None",
",",
"string_match_type",
"=",
"None",
",",
"match",
"=",
"None",
")",
":",
"self",
".",
"_match_display_text",
"(",
"'displayName'",
",",
"display_name",
",",
"string_match_type",
",",
... | Adds a display name to match.
Multiple display name matches can be added to perform a boolean
``OR`` among them.
arg: display_name (string): display name to match
arg: string_match_type (osid.type.Type): the string match
type
arg: match (boolean): ``tru... | [
"Adds",
"a",
"display",
"name",
"to",
"match",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/osid/queries.py#L348-L369 |
mitsei/dlkit | dlkit/handcar/osid/queries.py | OsidObjectQuery.match_description | def match_description(self, description=None, string_match_type=None, match=None):
"""Adds a description name to match.
Multiple description matches can be added to perform a boolean
``OR`` among them.
arg: description (string): description to match
arg: string_match_type... | python | def match_description(self, description=None, string_match_type=None, match=None):
"""Adds a description name to match.
Multiple description matches can be added to perform a boolean
``OR`` among them.
arg: description (string): description to match
arg: string_match_type... | [
"def",
"match_description",
"(",
"self",
",",
"description",
"=",
"None",
",",
"string_match_type",
"=",
"None",
",",
"match",
"=",
"None",
")",
":",
"self",
".",
"_match_display_text",
"(",
"'description'",
",",
"description",
",",
"string_match_type",
",",
"... | Adds a description name to match.
Multiple description matches can be added to perform a boolean
``OR`` among them.
arg: description (string): description to match
arg: string_match_type (osid.type.Type): the string match
type
arg: match (boolean): ``tr... | [
"Adds",
"a",
"description",
"name",
"to",
"match",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/osid/queries.py#L391-L412 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager._set_book_view | def _set_book_view(self, session):
"""Sets the underlying book view to match current view"""
if self._book_view == COMPARATIVE:
try:
session.use_comparative_book_view()
except AttributeError:
pass
else:
try:
sess... | python | def _set_book_view(self, session):
"""Sets the underlying book view to match current view"""
if self._book_view == COMPARATIVE:
try:
session.use_comparative_book_view()
except AttributeError:
pass
else:
try:
sess... | [
"def",
"_set_book_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_book_view",
"==",
"COMPARATIVE",
":",
"try",
":",
"session",
".",
"use_comparative_book_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
... | Sets the underlying book view to match current view | [
"Sets",
"the",
"underlying",
"book",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L140-L151 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.use_comparative_book_view | def use_comparative_book_view(self):
"""Pass through to provider CommentBookSession.use_comparative_book_view"""
self._book_view = COMPARATIVE
# self._get_provider_session('comment_book_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_comparative_book_view(self):
"""Pass through to provider CommentBookSession.use_comparative_book_view"""
self._book_view = COMPARATIVE
# self._get_provider_session('comment_book_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_comparative_book_view",
"(",
"self",
")",
":",
"self",
".",
"_book_view",
"=",
"COMPARATIVE",
"# self._get_provider_session('comment_book_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":"... | Pass through to provider CommentBookSession.use_comparative_book_view | [
"Pass",
"through",
"to",
"provider",
"CommentBookSession",
".",
"use_comparative_book_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L356-L364 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.use_plenary_book_view | def use_plenary_book_view(self):
"""Pass through to provider CommentBookSession.use_plenary_book_view"""
self._book_view = PLENARY
# self._get_provider_session('comment_book_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | python | def use_plenary_book_view(self):
"""Pass through to provider CommentBookSession.use_plenary_book_view"""
self._book_view = PLENARY
# self._get_provider_session('comment_book_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | [
"def",
"use_plenary_book_view",
"(",
"self",
")",
":",
"self",
".",
"_book_view",
"=",
"PLENARY",
"# self._get_provider_session('comment_book_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
"try... | Pass through to provider CommentBookSession.use_plenary_book_view | [
"Pass",
"through",
"to",
"provider",
"CommentBookSession",
".",
"use_plenary_book_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L366-L374 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.get_books_by_comment | def get_books_by_comment(self, *args, **kwargs):
"""Pass through to provider CommentBookSession.get_books_by_comment"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('comment_book_session').get_book... | python | def get_books_by_comment(self, *args, **kwargs):
"""Pass through to provider CommentBookSession.get_books_by_comment"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('comment_book_session').get_book... | [
"def",
"get_books_by_comment",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceBinSession.get_bins_by_resource",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'comment_boo... | Pass through to provider CommentBookSession.get_books_by_comment | [
"Pass",
"through",
"to",
"provider",
"CommentBookSession",
".",
"get_books_by_comment"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L406-L414 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.get_books | def get_books(self):
"""Pass through to provider BookLookupSession.get_books"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('book_lookup_session').get_books()
cat_list = []
for cat in c... | python | def get_books(self):
"""Pass through to provider BookLookupSession.get_books"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('book_lookup_session').get_books()
cat_list = []
for cat in c... | [
"def",
"get_books",
"(",
"self",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bins_template",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'book_lookup_session'",
")",
".",
"get_books",
"(",
")",
"cat_list",
"=... | Pass through to provider BookLookupSession.get_books | [
"Pass",
"through",
"to",
"provider",
"BookLookupSession",
".",
"get_books"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L526-L534 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.create_book | def create_book(self, *args, **kwargs):
"""Pass through to provider BookAdminSession.create_book"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.create_bin
return Book(
self._provider_manager,
self._get_provider_session('book_admin_ses... | python | def create_book(self, *args, **kwargs):
"""Pass through to provider BookAdminSession.create_book"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.create_bin
return Book(
self._provider_manager,
self._get_provider_session('book_admin_ses... | [
"def",
"create_book",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.create_bin",
"return",
"Book",
"(",
"self",
".",
"_provider_manager",
",",
"self",
".",
"_get_provider... | Pass through to provider BookAdminSession.create_book | [
"Pass",
"through",
"to",
"provider",
"BookAdminSession",
".",
"create_book"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L558-L566 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.get_book_form | def get_book_form(self, *args, **kwargs):
"""Pass through to provider BookAdminSession.get_book_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if i... | python | def get_book_form(self, *args, **kwargs):
"""Pass through to provider BookAdminSession.get_book_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if i... | [
"def",
"get_book_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.get_bin_form_for_update_template",
"# This method might be a bit sketchy. Time will tell.",
"if",
"isinstance",
... | Pass through to provider BookAdminSession.get_book_form_for_update | [
"Pass",
"through",
"to",
"provider",
"BookAdminSession",
".",
"get_book_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L580-L588 |
mitsei/dlkit | dlkit/services/commenting.py | CommentingManager.save_book | def save_book(self, book_form, *args, **kwargs):
"""Pass through to provider BookAdminSession.update_book"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if book_form.is_for_update():
return self.update_book(book_form, *args, **kwargs)
... | python | def save_book(self, book_form, *args, **kwargs):
"""Pass through to provider BookAdminSession.update_book"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if book_form.is_for_update():
return self.update_book(book_form, *args, **kwargs)
... | [
"def",
"save_book",
"(",
"self",
",",
"book_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.update_bin",
"if",
"book_form",
".",
"is_for_update",
"(",
")",
":",
"return",
"self... | Pass through to provider BookAdminSession.update_book | [
"Pass",
"through",
"to",
"provider",
"BookAdminSession",
".",
"update_book"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L601-L608 |
mitsei/dlkit | dlkit/services/commenting.py | Book._set_book_view | def _set_book_view(self, session):
"""Sets the underlying book view to match current view"""
if self._book_view == FEDERATED:
try:
session.use_federated_book_view()
except AttributeError:
pass
else:
try:
session.... | python | def _set_book_view(self, session):
"""Sets the underlying book view to match current view"""
if self._book_view == FEDERATED:
try:
session.use_federated_book_view()
except AttributeError:
pass
else:
try:
session.... | [
"def",
"_set_book_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_book_view",
"==",
"FEDERATED",
":",
"try",
":",
"session",
".",
"use_federated_book_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
"ses... | Sets the underlying book view to match current view | [
"Sets",
"the",
"underlying",
"book",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L884-L895 |
mitsei/dlkit | dlkit/services/commenting.py | Book.use_comparative_comment_view | def use_comparative_comment_view(self):
"""Pass through to provider CommentLookupSession.use_comparative_comment_view"""
self._object_views['comment'] = COMPARATIVE
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provi... | python | def use_comparative_comment_view(self):
"""Pass through to provider CommentLookupSession.use_comparative_comment_view"""
self._object_views['comment'] = COMPARATIVE
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provi... | [
"def",
"use_comparative_comment_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'comment'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_pr... | Pass through to provider CommentLookupSession.use_comparative_comment_view | [
"Pass",
"through",
"to",
"provider",
"CommentLookupSession",
".",
"use_comparative_comment_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L1019-L1027 |
mitsei/dlkit | dlkit/services/commenting.py | Book.use_plenary_comment_view | def use_plenary_comment_view(self):
"""Pass through to provider CommentLookupSession.use_plenary_comment_view"""
self._object_views['comment'] = PLENARY
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions... | python | def use_plenary_comment_view(self):
"""Pass through to provider CommentLookupSession.use_plenary_comment_view"""
self._object_views['comment'] = PLENARY
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions... | [
"def",
"use_plenary_comment_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'comment'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_s... | Pass through to provider CommentLookupSession.use_plenary_comment_view | [
"Pass",
"through",
"to",
"provider",
"CommentLookupSession",
".",
"use_plenary_comment_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L1029-L1037 |
mitsei/dlkit | dlkit/services/commenting.py | Book.use_federated_book_view | def use_federated_book_view(self):
"""Pass through to provider CommentLookupSession.use_federated_book_view"""
self._book_view = FEDERATED
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_federated_book_view(self):
"""Pass through to provider CommentLookupSession.use_federated_book_view"""
self._book_view = FEDERATED
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_federated_book_view",
"(",
"self",
")",
":",
"self",
".",
"_book_view",
"=",
"FEDERATED",
"# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
... | Pass through to provider CommentLookupSession.use_federated_book_view | [
"Pass",
"through",
"to",
"provider",
"CommentLookupSession",
".",
"use_federated_book_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L1039-L1047 |
mitsei/dlkit | dlkit/services/commenting.py | Book.use_isolated_book_view | def use_isolated_book_view(self):
"""Pass through to provider CommentLookupSession.use_isolated_book_view"""
self._book_view = ISOLATED
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
t... | python | def use_isolated_book_view(self):
"""Pass through to provider CommentLookupSession.use_isolated_book_view"""
self._book_view = ISOLATED
# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
t... | [
"def",
"use_isolated_book_view",
"(",
"self",
")",
":",
"self",
".",
"_book_view",
"=",
"ISOLATED",
"# self._get_provider_session('comment_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
... | Pass through to provider CommentLookupSession.use_isolated_book_view | [
"Pass",
"through",
"to",
"provider",
"CommentLookupSession",
".",
"use_isolated_book_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L1049-L1057 |
mitsei/dlkit | dlkit/services/commenting.py | Book.get_comment_form | def get_comment_form(self, *args, **kwargs):
"""Pass through to provider CommentAdminSession.get_comment_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. Time will tell.
... | python | def get_comment_form(self, *args, **kwargs):
"""Pass through to provider CommentAdminSession.get_comment_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. Time will tell.
... | [
"def",
"get_comment_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.get_resource_form_for_update",
"# This method might be a bit sketchy. Time will tell.",
"if",
"isinstance"... | Pass through to provider CommentAdminSession.get_comment_form_for_update | [
"Pass",
"through",
"to",
"provider",
"CommentAdminSession",
".",
"get_comment_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L1225-L1233 |
mitsei/dlkit | dlkit/services/commenting.py | Book.save_comment | def save_comment(self, comment_form, *args, **kwargs):
"""Pass through to provider CommentAdminSession.update_comment"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if comment_form.is_for_update():
return self.update_comment(... | python | def save_comment(self, comment_form, *args, **kwargs):
"""Pass through to provider CommentAdminSession.update_comment"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if comment_form.is_for_update():
return self.update_comment(... | [
"def",
"save_comment",
"(",
"self",
",",
"comment_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.update_resource",
"if",
"comment_form",
".",
"is_for_update",
"(",
")",
":",
... | Pass through to provider CommentAdminSession.update_comment | [
"Pass",
"through",
"to",
"provider",
"CommentAdminSession",
".",
"update_comment"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/commenting.py#L1247-L1254 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveLookupSession.get_objective | def get_objective(self, objective_id):
"""Gets the ``Objective`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Objective`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``... | python | def get_objective(self, objective_id):
"""Gets the ``Objective`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Objective`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``... | [
"def",
"get_objective",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resource",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",... | Gets the ``Objective`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Objective`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``Id`` was assigned to an ``Objective`` and retained... | [
"Gets",
"the",
"Objective",
"specified",
"by",
"its",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L169-L196 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveLookupSession.get_objectives_by_ids | def get_objectives_by_ids(self, objective_ids):
"""Gets an ``ObjectiveList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
objectives specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an `... | python | def get_objectives_by_ids(self, objective_ids):
"""Gets an ``ObjectiveList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
objectives specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an `... | [
"def",
"get_objectives_by_ids",
"(",
"self",
",",
"objective_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources_by_ids",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'l... | Gets an ``ObjectiveList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
objectives specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an ``Id`` in
the supplied list is not found or inaccess... | [
"Gets",
"an",
"ObjectiveList",
"corresponding",
"to",
"the",
"given",
"IdList",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L199-L240 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveLookupSession.get_objectives_by_genus_type | def get_objectives_by_genus_type(self, objective_genus_type):
"""Gets an ``ObjectiveList`` corresponding to the given objective genus ``Type`` which does not include objectives of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known objectives
o... | python | def get_objectives_by_genus_type(self, objective_genus_type):
"""Gets an ``ObjectiveList`` corresponding to the given objective genus ``Type`` which does not include objectives of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known objectives
o... | [
"def",
"get_objectives_by_genus_type",
"(",
"self",
",",
"objective_genus_type",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources_by_genus_type",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientVal... | Gets an ``ObjectiveList`` corresponding to the given objective genus ``Type`` which does not include objectives of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known objectives
or an error results. Otherwise, the returned list may contain
only... | [
"Gets",
"an",
"ObjectiveList",
"corresponding",
"to",
"the",
"given",
"objective",
"genus",
"Type",
"which",
"does",
"not",
"include",
"objectives",
"of",
"genus",
"types",
"derived",
"from",
"the",
"specified",
"Type",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L243-L269 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveLookupSession.get_objectives | def get_objectives(self):
"""Gets all ``Objectives``.
In plenary mode, the returned list contains all known objectives
or an error results. Otherwise, the returned list may contain
only those objectives that are accessible through this session.
return: (osid.learning.ObjectiveL... | python | def get_objectives(self):
"""Gets all ``Objectives``.
In plenary mode, the returned list contains all known objectives
or an error results. Otherwise, the returned list may contain
only those objectives that are accessible through this session.
return: (osid.learning.ObjectiveL... | [
"def",
"get_objectives",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",... | Gets all ``Objectives``.
In plenary mode, the returned list contains all known objectives
or an error results. Otherwise, the returned list may contain
only those objectives that are accessible through this session.
return: (osid.learning.ObjectiveList) - an ``ObjectiveList``
r... | [
"Gets",
"all",
"Objectives",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L317-L337 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveQuerySession.get_objectives_by_query | def get_objectives_by_query(self, objective_query):
"""Gets a list of ``Objectives`` matching the given objective query.
arg: objective_query (osid.learning.ObjectiveQuery): the
objective query
return: (osid.learning.ObjectiveList) - the returned
``ObjectiveLi... | python | def get_objectives_by_query(self, objective_query):
"""Gets a list of ``Objectives`` matching the given objective query.
arg: objective_query (osid.learning.ObjectiveQuery): the
objective query
return: (osid.learning.ObjectiveList) - the returned
``ObjectiveLi... | [
"def",
"get_objectives_by_query",
"(",
"self",
",",
"objective_query",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceQuerySession.get_resources_by_query",
"and_list",
"=",
"list",
"(",
")",
"or_list",
"=",
"list",
"(",
")",
"for",
"term",
"in",
"... | Gets a list of ``Objectives`` matching the given objective query.
arg: objective_query (osid.learning.ObjectiveQuery): the
objective query
return: (osid.learning.ObjectiveList) - the returned
``ObjectiveList``
raise: NullArgument - ``objective_query`` is ``nu... | [
"Gets",
"a",
"list",
"of",
"Objectives",
"matching",
"the",
"given",
"objective",
"query",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L466-L506 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveAdminSession.get_objective_form_for_create | def get_objective_form_for_create(self, objective_record_types):
"""Gets the objective form for creating new objectives.
A new form should be requested for each create transaction.
arg: objective_record_types (osid.type.Type[]): array of
objective record types
return... | python | def get_objective_form_for_create(self, objective_record_types):
"""Gets the objective form for creating new objectives.
A new form should be requested for each create transaction.
arg: objective_record_types (osid.type.Type[]): array of
objective record types
return... | [
"def",
"get_objective_form_for_create",
"(",
"self",
",",
"objective_record_types",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.get_resource_form_for_create_template",
"for",
"arg",
"in",
"objective_record_types",
":",
"if",
"not",
"isinstance... | Gets the objective form for creating new objectives.
A new form should be requested for each create transaction.
arg: objective_record_types (osid.type.Type[]): array of
objective record types
return: (osid.learning.ObjectiveForm) - the objective form
raise: NullArg... | [
"Gets",
"the",
"objective",
"form",
"for",
"creating",
"new",
"objectives",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L633-L668 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveAdminSession.create_objective | def create_objective(self, objective_form):
"""Creates a new ``Objective``.
arg: objective_form (osid.learning.ObjectiveForm): the form
for this ``Objective``
return: (osid.learning.Objective) - the new ``Objective``
raise: IllegalState - ``objective_form`` already u... | python | def create_objective(self, objective_form):
"""Creates a new ``Objective``.
arg: objective_form (osid.learning.ObjectiveForm): the form
for this ``Objective``
return: (osid.learning.Objective) - the new ``Objective``
raise: IllegalState - ``objective_form`` already u... | [
"def",
"create_objective",
"(",
"self",
",",
"objective_form",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.create_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",
"'Objective'",
",",
... | Creates a new ``Objective``.
arg: objective_form (osid.learning.ObjectiveForm): the form
for this ``Objective``
return: (osid.learning.Objective) - the new ``Objective``
raise: IllegalState - ``objective_form`` already used in a
create transaction
rai... | [
"Creates",
"a",
"new",
"Objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L671-L713 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveAdminSession.get_objective_form_for_update | def get_objective_form_for_update(self, objective_id):
"""Gets the objective form for updating an existing objective.
A new objective form should be requested for each update
transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
return:... | python | def get_objective_form_for_update(self, objective_id):
"""Gets the objective form for updating an existing objective.
A new objective form should be requested for each update
transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
return:... | [
"def",
"get_objective_form_for_update",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.get_resource_form_for_update_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",
... | Gets the objective form for updating an existing objective.
A new objective form should be requested for each update
transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
return: (osid.learning.ObjectiveForm) - the objective form
raise:... | [
"Gets",
"the",
"objective",
"form",
"for",
"updating",
"an",
"existing",
"objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L736-L767 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveAdminSession.update_objective | def update_objective(self, objective_form):
"""Updates an existing objective.
arg: objective_form (osid.learning.ObjectiveForm): the form
containing the elements to be updated
raise: IllegalState - ``objective_form`` already used in an
update transaction
... | python | def update_objective(self, objective_form):
"""Updates an existing objective.
arg: objective_form (osid.learning.ObjectiveForm): the form
containing the elements to be updated
raise: IllegalState - ``objective_form`` already used in an
update transaction
... | [
"def",
"update_objective",
"(",
"self",
",",
"objective_form",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.update_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",
"'Objective'",
",",
... | Updates an existing objective.
arg: objective_form (osid.learning.ObjectiveForm): the form
containing the elements to be updated
raise: IllegalState - ``objective_form`` already used in an
update transaction
raise: InvalidArgument - the form contains an inva... | [
"Updates",
"an",
"existing",
"objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L770-L810 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveAdminSession.delete_objective | def delete_objective(self, objective_id):
"""Deletes the ``Objective`` identified by the given ``Id``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective`` to delete
raise: NotFound - an ``Objective`` was not found identified by
the given ``Id``
... | python | def delete_objective(self, objective_id):
"""Deletes the ``Objective`` identified by the given ``Id``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective`` to delete
raise: NotFound - an ``Objective`` was not found identified by
the given ``Id``
... | [
"def",
"delete_objective",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.learning.ObjectiveAdminSession.delete_objective_template",
"if",
"not",
"isinstance",
"(",
"objective_id",
",",
"ABCId",
")",
":",
"raise",
"errors",
".",
"In... | Deletes the ``Objective`` identified by the given ``Id``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective`` to delete
raise: NotFound - an ``Objective`` was not found identified by
the given ``Id``
raise: NullArgument - ``objective_id`` is ``nu... | [
"Deletes",
"the",
"Objective",
"identified",
"by",
"the",
"given",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L833-L860 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveAdminSession.alias_objective | def alias_objective(self, objective_id, alias_id):
"""Adds an ``Id`` to an ``Objective`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Objective`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer... | python | def alias_objective(self, objective_id, alias_id):
"""Adds an ``Id`` to an ``Objective`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Objective`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer... | [
"def",
"alias_objective",
"(",
"self",
",",
"objective_id",
",",
"alias_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.alias_resources_template",
"self",
".",
"_alias_id",
"(",
"primary_id",
"=",
"objective_id",
",",
"equivalent_id",
... | Adds an ``Id`` to an ``Objective`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Objective`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to another objective, it is
reassigned to the given o... | [
"Adds",
"an",
"Id",
"to",
"an",
"Objective",
"for",
"the",
"purpose",
"of",
"creating",
"compatibility",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L881-L903 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveHierarchySession.get_root_objectives | def get_root_objectives(self):
"""Gets the root objective in this objective hierarchy.
return: (osid.learning.ObjectiveList) - the root objective
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This ... | python | def get_root_objectives(self):
"""Gets the root objective in this objective hierarchy.
return: (osid.learning.ObjectiveList) - the root objective
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This ... | [
"def",
"get_root_objectives",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.ontology.SubjectHierarchySession.get_root_subjects_template",
"root_ids",
"=",
"self",
".",
"_hierarchy_session",
".",
"get_roots",
"(",
")",
"collection",
"=",
"JSONClientValidated"... | Gets the root objective in this objective hierarchy.
return: (osid.learning.ObjectiveList) - the root objective
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method is must be implemented.* | [
"Gets",
"the",
"root",
"objective",
"in",
"this",
"objective",
"hierarchy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1037-L1058 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveHierarchySession.get_child_objectives | def get_child_objectives(self, objective_id):
"""Gets the children of the given objective.
arg: objective_id (osid.id.Id): the ``Id`` to query
return: (osid.learning.ObjectiveList) - the children of the
objective
raise: NotFound - ``objective_id`` is not found
... | python | def get_child_objectives(self, objective_id):
"""Gets the children of the given objective.
arg: objective_id (osid.id.Id): the ``Id`` to query
return: (osid.learning.ObjectiveList) - the children of the
objective
raise: NotFound - ``objective_id`` is not found
... | [
"def",
"get_child_objectives",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.ontology.SubjectHierarchySession.get_child_subjects_template",
"if",
"self",
".",
"_hierarchy_session",
".",
"has_children",
"(",
"objective_id",
")",
":",
"c... | Gets the children of the given objective.
arg: objective_id (osid.id.Id): the ``Id`` to query
return: (osid.learning.ObjectiveList) - the children of the
objective
raise: NotFound - ``objective_id`` is not found
raise: NullArgument - ``objective_id`` is ``null``
... | [
"Gets",
"the",
"children",
"of",
"the",
"given",
"objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1195-L1222 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveHierarchyDesignSession.add_child_objective | def add_child_objective(self, objective_id, child_id):
"""Adds a child to an objective.
arg: objective_id (osid.id.Id): the ``Id`` of an objective
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``objective_id`` is already a parent of
... | python | def add_child_objective(self, objective_id, child_id):
"""Adds a child to an objective.
arg: objective_id (osid.id.Id): the ``Id`` of an objective
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``objective_id`` is already a parent of
... | [
"def",
"add_child_objective",
"(",
"self",
",",
"objective_id",
",",
"child_id",
")",
":",
"# Implemented from template for",
"# osid.ontology.SubjectHierarchyDesignSession.add_child_subject_template",
"return",
"self",
".",
"_hierarchy_session",
".",
"add_child",
"(",
"id_",
... | Adds a child to an objective.
arg: objective_id (osid.id.Id): the ``Id`` of an objective
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``objective_id`` is already a parent of
``child_id``
raise: NotFound - ``objective_id`` or ``ch... | [
"Adds",
"a",
"child",
"to",
"an",
"objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1397-L1414 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveHierarchyDesignSession.remove_child_objective | def remove_child_objective(self, objective_id, child_id):
"""Removes a child from an objective.
arg: objective_id (osid.id.Id): the ``Id`` of an objective
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``objective_id`` not a parent of ``child_id``
... | python | def remove_child_objective(self, objective_id, child_id):
"""Removes a child from an objective.
arg: objective_id (osid.id.Id): the ``Id`` of an objective
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``objective_id`` not a parent of ``child_id``
... | [
"def",
"remove_child_objective",
"(",
"self",
",",
"objective_id",
",",
"child_id",
")",
":",
"# Implemented from template for",
"# osid.ontology.SubjectHierarchyDesignSession.remove_child_subject_template",
"return",
"self",
".",
"_hierarchy_session",
".",
"remove_child",
"(",
... | Removes a child from an objective.
arg: objective_id (osid.id.Id): the ``Id`` of an objective
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``objective_id`` not a parent of ``child_id``
raise: NullArgument - ``objective_id`` or ``child_id`` is
... | [
"Removes",
"a",
"child",
"from",
"an",
"objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1417-L1432 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankSession.get_objective_ids_by_objective_bank | def get_objective_ids_by_objective_bank(self, objective_bank_id):
"""Gets the list of ``Objective`` ``Ids`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.id.IdList) - list of related objectives
... | python | def get_objective_ids_by_objective_bank(self, objective_bank_id):
"""Gets the list of ``Objective`` ``Ids`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.id.IdList) - list of related objectives
... | [
"def",
"get_objective_ids_by_objective_bank",
"(",
"self",
",",
"objective_bank_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resource_ids_by_bin",
"id_list",
"=",
"[",
"]",
"for",
"objective",
"in",
"self",
".",
"get_objectives_by_ob... | Gets the list of ``Objective`` ``Ids`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.id.IdList) - list of related objectives
raise: NotFound - ``objective_bank_id`` is not found
raise: NullA... | [
"Gets",
"the",
"list",
"of",
"Objective",
"Ids",
"associated",
"with",
"an",
"ObjectiveBank",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1648-L1666 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankSession.get_objectives_by_objective_bank | def get_objectives_by_objective_bank(self, objective_bank_id):
"""Gets the list of ``Objectives`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.learning.ObjectiveList) - list of related
... | python | def get_objectives_by_objective_bank(self, objective_bank_id):
"""Gets the list of ``Objectives`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.learning.ObjectiveList) - list of related
... | [
"def",
"get_objectives_by_objective_bank",
"(",
"self",
",",
"objective_bank_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resources_by_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LEARNING'",
",",
"local",
"=",
"T... | Gets the list of ``Objectives`` associated with an ``ObjectiveBank``.
arg: objective_bank_id (osid.id.Id): ``Id`` of the
``ObjectiveBank``
return: (osid.learning.ObjectiveList) - list of related
objective ``Ids``
raise: NotFound - ``objective_bank_id`` is not... | [
"Gets",
"the",
"list",
"of",
"Objectives",
"associated",
"with",
"an",
"ObjectiveBank",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1669-L1688 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankSession.get_objective_ids_by_objective_banks | def get_objective_ids_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Objective Ids`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.id.IdList) - list of objective ``Ids... | python | def get_objective_ids_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Objective Ids`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.id.IdList) - list of objective ``Ids... | [
"def",
"get_objective_ids_by_objective_banks",
"(",
"self",
",",
"objective_bank_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resource_ids_by_bins",
"id_list",
"=",
"[",
"]",
"for",
"objective",
"in",
"self",
".",
"get_objectives_by... | Gets the list of ``Objective Ids`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.id.IdList) - list of objective ``Ids``
raise: NullArgument - ``objective_bank_ids`` is ``null``
ra... | [
"Gets",
"the",
"list",
"of",
"Objective",
"Ids",
"corresponding",
"to",
"a",
"list",
"of",
"ObjectiveBanks",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1691-L1708 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankSession.get_objectives_by_objective_banks | def get_objectives_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Objectives`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.learning.ObjectiveList) - list of objectiv... | python | def get_objectives_by_objective_banks(self, objective_bank_ids):
"""Gets the list of ``Objectives`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.learning.ObjectiveList) - list of objectiv... | [
"def",
"get_objectives_by_objective_banks",
"(",
"self",
",",
"objective_bank_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resources_by_bins",
"objective_list",
"=",
"[",
"]",
"for",
"objective_bank_id",
"in",
"objective_bank_ids",
":... | Gets the list of ``Objectives`` corresponding to a list of ``ObjectiveBanks``.
arg: objective_bank_ids (osid.id.IdList): list of objective
bank ``Ids``
return: (osid.learning.ObjectiveList) - list of objectives
raise: NullArgument - ``objective_bank_ids`` is ``null``
... | [
"Gets",
"the",
"list",
"of",
"Objectives",
"corresponding",
"to",
"a",
"list",
"of",
"ObjectiveBanks",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1711-L1729 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankSession.get_objective_bank_ids_by_objective | def get_objective_bank_ids_by_objective(self, objective_id):
"""Gets the list of ``ObjectiveBank`` ``Ids`` mapped to an ``Objective``.
arg: objective_id (osid.id.Id): ``Id`` of an ``Objective``
return: (osid.id.IdList) - list of objective bank ``Ids``
raise: NotFound - ``objective_... | python | def get_objective_bank_ids_by_objective(self, objective_id):
"""Gets the list of ``ObjectiveBank`` ``Ids`` mapped to an ``Objective``.
arg: objective_id (osid.id.Id): ``Id`` of an ``Objective``
return: (osid.id.IdList) - list of objective bank ``Ids``
raise: NotFound - ``objective_... | [
"def",
"get_objective_bank_ids_by_objective",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_bin_ids_by_resource",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LEARNING'",
",",
"local",
"=",
"... | Gets the list of ``ObjectiveBank`` ``Ids`` mapped to an ``Objective``.
arg: objective_id (osid.id.Id): ``Id`` of an ``Objective``
return: (osid.id.IdList) - list of objective bank ``Ids``
raise: NotFound - ``objective_id`` is not found
raise: NullArgument - ``objective_id`` is ``n... | [
"Gets",
"the",
"list",
"of",
"ObjectiveBank",
"Ids",
"mapped",
"to",
"an",
"Objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1732-L1753 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankSession.get_objective_banks_by_objective | def get_objective_banks_by_objective(self, objective_id):
"""Gets the list of ``ObjectiveBanks`` mapped to an ``Objective``.
arg: objective_id (osid.id.Id): ``Id`` of an ``Objective``
return: (osid.learning.ObjectiveBankList) - list of objective
banks
raise: NotFound... | python | def get_objective_banks_by_objective(self, objective_id):
"""Gets the list of ``ObjectiveBanks`` mapped to an ``Objective``.
arg: objective_id (osid.id.Id): ``Id`` of an ``Objective``
return: (osid.learning.ObjectiveBankList) - list of objective
banks
raise: NotFound... | [
"def",
"get_objective_banks_by_objective",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_bins_by_resource",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LEARNING'",
",",
"local",
"=",
"True",... | Gets the list of ``ObjectiveBanks`` mapped to an ``Objective``.
arg: objective_id (osid.id.Id): ``Id`` of an ``Objective``
return: (osid.learning.ObjectiveBankList) - list of objective
banks
raise: NotFound - ``objective_id`` is not found
raise: NullArgument - ``obj... | [
"Gets",
"the",
"list",
"of",
"ObjectiveBanks",
"mapped",
"to",
"an",
"Objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1756-L1774 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankAssignmentSession.get_assignable_objective_bank_ids | def get_assignable_objective_bank_ids(self, objective_bank_id):
"""Gets a list of objective banks including and under the given objective bank node in which any objective can be assigned.
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
return: (osid.i... | python | def get_assignable_objective_bank_ids(self, objective_bank_id):
"""Gets a list of objective banks including and under the given objective bank node in which any objective can be assigned.
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
return: (osid.i... | [
"def",
"get_assignable_objective_bank_ids",
"(",
"self",
",",
"objective_bank_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.get_assignable_bin_ids",
"# This will likely be overridden by an authorization adapter",
"mgr",
"=",
"self",
".",
... | Gets a list of objective banks including and under the given objective bank node in which any objective can be assigned.
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
return: (osid.id.IdList) - list of assignable objective bank
``Ids``
... | [
"Gets",
"a",
"list",
"of",
"objective",
"banks",
"including",
"and",
"under",
"the",
"given",
"objective",
"bank",
"node",
"in",
"which",
"any",
"objective",
"can",
"be",
"assigned",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1845-L1866 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankAssignmentSession.assign_objective_to_objective_bank | def assign_objective_to_objective_bank(self, objective_id, objective_bank_id):
"""Adds an existing ``Objective`` to an ``ObjectiveBank``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
... | python | def assign_objective_to_objective_bank(self, objective_id, objective_bank_id):
"""Adds an existing ``Objective`` to an ``ObjectiveBank``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
... | [
"def",
"assign_objective_to_objective_bank",
"(",
"self",
",",
"objective_id",
",",
"objective_bank_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.assign_resource_to_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LE... | Adds an existing ``Objective`` to an ``ObjectiveBank``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
raise: AlreadyExists - ``objective_id`` already mapped to
... | [
"Adds",
"an",
"existing",
"Objective",
"to",
"an",
"ObjectiveBank",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1890-L1913 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankAssignmentSession.unassign_objective_from_objective_bank | def unassign_objective_from_objective_bank(self, objective_id, objective_bank_id):
"""Removes an ``Objective`` from an ``ObjectiveBank``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
... | python | def unassign_objective_from_objective_bank(self, objective_id, objective_bank_id):
"""Removes an ``Objective`` from an ``ObjectiveBank``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
... | [
"def",
"unassign_objective_from_objective_bank",
"(",
"self",
",",
"objective_id",
",",
"objective_bank_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.unassign_resource_from_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"("... | Removes an ``Objective`` from an ``ObjectiveBank``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: objective_bank_id (osid.id.Id): the ``Id`` of the
``ObjectiveBank``
raise: NotFound - ``objective_id`` or ``objective_bank_id`` not
... | [
"Removes",
"an",
"Objective",
"from",
"an",
"ObjectiveBank",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1916-L1938 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveObjectiveBankAssignmentSession.reassign_proficiency_to_objective_bank | def reassign_proficiency_to_objective_bank(self, objective_id, from_objective_bank_id, to_objective_bank_id):
"""Moves an ``Objective`` from one ``ObjectiveBank`` to another.
Mappings to other ``ObjectiveBanks`` are unaffected.
arg: objective_id (osid.id.Id): the ``Id`` of the
... | python | def reassign_proficiency_to_objective_bank(self, objective_id, from_objective_bank_id, to_objective_bank_id):
"""Moves an ``Objective`` from one ``ObjectiveBank`` to another.
Mappings to other ``ObjectiveBanks`` are unaffected.
arg: objective_id (osid.id.Id): the ``Id`` of the
... | [
"def",
"reassign_proficiency_to_objective_bank",
"(",
"self",
",",
"objective_id",
",",
"from_objective_bank_id",
",",
"to_objective_bank_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.reassign_resource_to_bin",
"self",
".",
"assign_ob... | Moves an ``Objective`` from one ``ObjectiveBank`` to another.
Mappings to other ``ObjectiveBanks`` are unaffected.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: from_objective_bank_id (osid.id.Id): the ``Id`` of the
current ``Objecti... | [
"Moves",
"an",
"Objective",
"from",
"one",
"ObjectiveBank",
"to",
"another",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L1941-L1969 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveRequisiteSession.get_requisite_objectives | def get_requisite_objectives(self, objective_id):
"""Gets a list of ``Objectives`` that are the immediate requisites for the given ``Objective``.
In plenary mode, the returned list contains all of the immediate
requisites, or an error results if an ``Objective`` is not found
or inaccess... | python | def get_requisite_objectives(self, objective_id):
"""Gets a list of ``Objectives`` that are the immediate requisites for the given ``Objective``.
In plenary mode, the returned list contains all of the immediate
requisites, or an error results if an ``Objective`` is not found
or inaccess... | [
"def",
"get_requisite_objectives",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.learning.ObjectiveRequisiteSession.get_requisite_objectives_template",
"# NOTE: This implementation currently ignores plenary view",
"requisite_type",
"=",
"Type",
"(... | Gets a list of ``Objectives`` that are the immediate requisites for the given ``Objective``.
In plenary mode, the returned list contains all of the immediate
requisites, or an error results if an ``Objective`` is not found
or inaccessible. Otherwise, inaccessible ``Objectives`` may be
o... | [
"Gets",
"a",
"list",
"of",
"Objectives",
"that",
"are",
"the",
"immediate",
"requisites",
"for",
"the",
"given",
"Objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2111-L2145 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveRequisiteSession.get_dependent_objectives | def get_dependent_objectives(self, objective_id):
"""Gets a list of ``Objectives`` that require the given ``Objective``.
In plenary mode, the returned list contains all of the immediate
requisites, or an error results if an Objective is not found or
inaccessible. Otherwise, inaccessible... | python | def get_dependent_objectives(self, objective_id):
"""Gets a list of ``Objectives`` that require the given ``Objective``.
In plenary mode, the returned list contains all of the immediate
requisites, or an error results if an Objective is not found or
inaccessible. Otherwise, inaccessible... | [
"def",
"get_dependent_objectives",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.learning.ObjectiveRequisiteSession.get_dependent_objectives_template",
"# NOTE: This implementation currently ignores plenary view",
"requisite_type",
"=",
"Type",
"(... | Gets a list of ``Objectives`` that require the given ``Objective``.
In plenary mode, the returned list contains all of the immediate
requisites, or an error results if an Objective is not found or
inaccessible. Otherwise, inaccessible ``Objectives`` may be
omitted from the list and may ... | [
"Gets",
"a",
"list",
"of",
"Objectives",
"that",
"require",
"the",
"given",
"Objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2170-L2204 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveRequisiteAssignmentSession.assign_objective_requisite | def assign_objective_requisite(self, objective_id, requisite_objective_id):
"""Creates a requirement dependency between two ``Objectives``.
arg: objective_id (osid.id.Id): the ``Id`` of the dependent
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the... | python | def assign_objective_requisite(self, objective_id, requisite_objective_id):
"""Creates a requirement dependency between two ``Objectives``.
arg: objective_id (osid.id.Id): the ``Id`` of the dependent
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the... | [
"def",
"assign_objective_requisite",
"(",
"self",
",",
"objective_id",
",",
"requisite_objective_id",
")",
":",
"requisite_type",
"=",
"Type",
"(",
"*",
"*",
"Relationship",
"(",
")",
".",
"get_type_data",
"(",
"'OBJECTIVE.REQUISITE'",
")",
")",
"ras",
"=",
"sel... | Creates a requirement dependency between two ``Objectives``.
arg: objective_id (osid.id.Id): the ``Id`` of the dependent
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the
required ``Objective``
raise: AlreadyExists - ``objective_id`... | [
"Creates",
"a",
"requirement",
"dependency",
"between",
"two",
"Objectives",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2321-L2348 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ObjectiveRequisiteAssignmentSession.unassign_objective_requisite | def unassign_objective_requisite(self, objective_id, requisite_objective_id):
"""Removes an ``Objective`` requisite from an ``Objective``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the
... | python | def unassign_objective_requisite(self, objective_id, requisite_objective_id):
"""Removes an ``Objective`` requisite from an ``Objective``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the
... | [
"def",
"unassign_objective_requisite",
"(",
"self",
",",
"objective_id",
",",
"requisite_objective_id",
")",
":",
"requisite_type",
"=",
"Type",
"(",
"*",
"*",
"Relationship",
"(",
")",
".",
"get_type_data",
"(",
"'OBJECTIVE.REQUISITE'",
")",
")",
"rls",
"=",
"s... | Removes an ``Objective`` requisite from an ``Objective``.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the
required ``Objective``
raise: NotFound - ``objective_id`` or
... | [
"Removes",
"an",
"Objective",
"requisite",
"from",
"an",
"Objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2351-L2381 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityLookupSession.get_activity | def get_activity(self, activity_id):
"""Gets the ``Activity`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Activity`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``Id``... | python | def get_activity(self, activity_id):
"""Gets the ``Activity`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Activity`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``Id``... | [
"def",
"get_activity",
"(",
"self",
",",
"activity_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resource",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
... | Gets the ``Activity`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``Activity`` may have a
different ``Id`` than requested, such as the case where a
duplicate ``Id`` was assigned to a ``Activity`` and retained for... | [
"Gets",
"the",
"Activity",
"specified",
"by",
"its",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2570-L2597 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityLookupSession.get_activities_by_ids | def get_activities_by_ids(self, activity_ids):
"""Gets an ``ActivityList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
activities specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an ``I... | python | def get_activities_by_ids(self, activity_ids):
"""Gets an ``ActivityList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
activities specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an ``I... | [
"def",
"get_activities_by_ids",
"(",
"self",
",",
"activity_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources_by_ids",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'le... | Gets an ``ActivityList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the
activities specified in the ``Id`` list, in the order of the
list, including duplicates, or an error results if an ``Id`` in
the supplied list is not found or inaccessi... | [
"Gets",
"an",
"ActivityList",
"corresponding",
"to",
"the",
"given",
"IdList",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2600-L2641 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityLookupSession.get_activities_by_genus_type | def get_activities_by_genus_type(self, activity_genus_type):
"""Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` which does not include activities of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known activities
or a... | python | def get_activities_by_genus_type(self, activity_genus_type):
"""Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` which does not include activities of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known activities
or a... | [
"def",
"get_activities_by_genus_type",
"(",
"self",
",",
"activity_genus_type",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources_by_genus_type",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientVali... | Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` which does not include activities of genus types derived from the specified ``Type``.
In plenary mode, the returned list contains all known activities
or an error results. Otherwise, the returned list may contain
only t... | [
"Gets",
"an",
"ActivityList",
"corresponding",
"to",
"the",
"given",
"activity",
"genus",
"Type",
"which",
"does",
"not",
"include",
"activities",
"of",
"genus",
"types",
"derived",
"from",
"the",
"specified",
"Type",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2644-L2670 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityLookupSession.get_activities_for_objective | def get_activities_for_objective(self, objective_id):
"""Gets the activities for the given objective.
In plenary mode, the returned list contains all of the
activities mapped to the objective ``Id`` or an error results if
an Id in the supplied list is not found or inaccessible.
... | python | def get_activities_for_objective(self, objective_id):
"""Gets the activities for the given objective.
In plenary mode, the returned list contains all of the
activities mapped to the objective ``Id`` or an error results if
an Id in the supplied list is not found or inaccessible.
... | [
"def",
"get_activities_for_objective",
"(",
"self",
",",
"objective_id",
")",
":",
"# Implemented from template for",
"# osid.learning.ActivityLookupSession.get_activities_for_objective_template",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientV... | Gets the activities for the given objective.
In plenary mode, the returned list contains all of the
activities mapped to the objective ``Id`` or an error results if
an Id in the supplied list is not found or inaccessible.
Otherwise, inaccessible ``Activities`` may be omitted from the
... | [
"Gets",
"the",
"activities",
"for",
"the",
"given",
"objective",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2719-L2747 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityLookupSession.get_activities | def get_activities(self):
"""Gets all ``Activities``.
In plenary mode, the returned list contains all known activites
or an error results. Otherwise, the returned list may contain
only those activities that are accessible through this session.
return: (osid.learning.ActivityLis... | python | def get_activities(self):
"""Gets all ``Activities``.
In plenary mode, the returned list contains all known activites
or an error results. Otherwise, the returned list may contain
only those activities that are accessible through this session.
return: (osid.learning.ActivityLis... | [
"def",
"get_activities",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",... | Gets all ``Activities``.
In plenary mode, the returned list contains all known activites
or an error results. Otherwise, the returned list may contain
only those activities that are accessible through this session.
return: (osid.learning.ActivityList) - a ``ActivityList``
raise... | [
"Gets",
"all",
"Activities",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2817-L2837 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityQuerySession.get_activities_by_query | def get_activities_by_query(self, activity_query):
"""Gets a list of ``Activities`` matching the given activity query.
arg: activity_query (osid.learning.ActivityQuery): the
activity query
return: (osid.learning.ActivityList) - the returned
``ActivityList``
... | python | def get_activities_by_query(self, activity_query):
"""Gets a list of ``Activities`` matching the given activity query.
arg: activity_query (osid.learning.ActivityQuery): the
activity query
return: (osid.learning.ActivityList) - the returned
``ActivityList``
... | [
"def",
"get_activities_by_query",
"(",
"self",
",",
"activity_query",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceQuerySession.get_resources_by_query",
"and_list",
"=",
"list",
"(",
")",
"or_list",
"=",
"list",
"(",
")",
"for",
"term",
"in",
"a... | Gets a list of ``Activities`` matching the given activity query.
arg: activity_query (osid.learning.ActivityQuery): the
activity query
return: (osid.learning.ActivityList) - the returned
``ActivityList``
raise: NullArgument - ``activity_query`` is ``null``
... | [
"Gets",
"a",
"list",
"of",
"Activities",
"matching",
"the",
"given",
"activity",
"query",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2966-L3006 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityAdminSession.get_activity_form_for_create | def get_activity_form_for_create(self, objective_id, activity_record_types):
"""Gets the activity form for creating new activities.
A new form should be requested for each create transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: act... | python | def get_activity_form_for_create(self, objective_id, activity_record_types):
"""Gets the activity form for creating new activities.
A new form should be requested for each create transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: act... | [
"def",
"get_activity_form_for_create",
"(",
"self",
",",
"objective_id",
",",
"activity_record_types",
")",
":",
"# Implemented from template for",
"# osid.learning.ActivityAdminSession.get_activity_form_for_create_template",
"if",
"not",
"isinstance",
"(",
"objective_id",
",",
"... | Gets the activity form for creating new activities.
A new form should be requested for each create transaction.
arg: objective_id (osid.id.Id): the ``Id`` of the
``Objective``
arg: activity_record_types (osid.type.Type[]): array of
activity record types
... | [
"Gets",
"the",
"activity",
"form",
"for",
"creating",
"new",
"activities",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L3133-L3179 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityAdminSession.create_activity | def create_activity(self, activity_form):
"""Creates a new ``Activity``.
arg: activity_form (osid.learning.ActivityForm): the form for
this ``Activity``
return: (osid.learning.Activity) - the new ``Activity``
raise: IllegalState - ``activity_form`` already used in a
... | python | def create_activity(self, activity_form):
"""Creates a new ``Activity``.
arg: activity_form (osid.learning.ActivityForm): the form for
this ``Activity``
return: (osid.learning.Activity) - the new ``Activity``
raise: IllegalState - ``activity_form`` already used in a
... | [
"def",
"create_activity",
"(",
"self",
",",
"activity_form",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.create_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",
"'Activity'",
",",
"... | Creates a new ``Activity``.
arg: activity_form (osid.learning.ActivityForm): the form for
this ``Activity``
return: (osid.learning.Activity) - the new ``Activity``
raise: IllegalState - ``activity_form`` already used in a
create transaction
raise: In... | [
"Creates",
"a",
"new",
"Activity",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L3182-L3224 |
mitsei/dlkit | dlkit/json_/learning/sessions.py | ActivityAdminSession.update_activity | def update_activity(self, activity_form):
"""Updates an existing activity,.
arg: activity_form (osid.learning.ActivityForm): the form
containing the elements to be updated
raise: IllegalState - ``activity_form`` already used in an
update transaction
r... | python | def update_activity(self, activity_form):
"""Updates an existing activity,.
arg: activity_form (osid.learning.ActivityForm): the form
containing the elements to be updated
raise: IllegalState - ``activity_form`` already used in an
update transaction
r... | [
"def",
"update_activity",
"(",
"self",
",",
"activity_form",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.update_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'learning'",
",",
"collection",
"=",
"'Activity'",
",",
"... | Updates an existing activity,.
arg: activity_form (osid.learning.ActivityForm): the form
containing the elements to be updated
raise: IllegalState - ``activity_form`` already used in an
update transaction
raise: InvalidArgument - the form contains an invalid... | [
"Updates",
"an",
"existing",
"activity",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L3280-L3320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.