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_/logging_/sessions.py | LogEntryLogSession.get_log_ids_by_log_entry | def get_log_ids_by_log_entry(self, log_entry_id):
"""Gets the list of ``Log`` ``Ids`` mapped to a ``LogEntry``.
arg: log_entry_id (osid.id.Id): ``Id`` of a ``LogEntry``
return: (osid.id.IdList) - list of log ``Ids``
raise: NotFound - ``log_entry_id`` is not found
raise: Nu... | python | def get_log_ids_by_log_entry(self, log_entry_id):
"""Gets the list of ``Log`` ``Ids`` mapped to a ``LogEntry``.
arg: log_entry_id (osid.id.Id): ``Id`` of a ``LogEntry``
return: (osid.id.IdList) - list of log ``Ids``
raise: NotFound - ``log_entry_id`` is not found
raise: Nu... | [
"def",
"get_log_ids_by_log_entry",
"(",
"self",
",",
"log_entry_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_bin_ids_by_resource",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LOGGING'",
",",
"local",
"=",
"True",
")"... | Gets the list of ``Log`` ``Ids`` mapped to a ``LogEntry``.
arg: log_entry_id (osid.id.Id): ``Id`` of a ``LogEntry``
return: (osid.id.IdList) - list of log ``Ids``
raise: NotFound - ``log_entry_id`` is not found
raise: NullArgument - ``log_entry_id`` is ``null``
raise: Ope... | [
"Gets",
"the",
"list",
"of",
"Log",
"Ids",
"mapped",
"to",
"a",
"LogEntry",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L1334-L1355 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogEntryLogAssignmentSession.get_assignable_log_ids | def get_assignable_log_ids(self, log_id):
"""Gets a list of log including and under the given log node in which any log entry can be assigned.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
return: (osid.id.IdList) - list of assignable log ``Ids``
raise: NullArgument - ``log_id... | python | def get_assignable_log_ids(self, log_id):
"""Gets a list of log including and under the given log node in which any log entry can be assigned.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
return: (osid.id.IdList) - list of assignable log ``Ids``
raise: NullArgument - ``log_id... | [
"def",
"get_assignable_log_ids",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.get_assignable_bin_ids",
"# This will likely be overridden by an authorization adapter",
"mgr",
"=",
"self",
".",
"_get_provider_manag... | Gets a list of log including and under the given log node in which any log entry can be assigned.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
return: (osid.id.IdList) - list of assignable log ``Ids``
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unab... | [
"Gets",
"a",
"list",
"of",
"log",
"including",
"and",
"under",
"the",
"given",
"log",
"node",
"in",
"which",
"any",
"log",
"entry",
"can",
"be",
"assigned",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L1439-L1458 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogEntryLogAssignmentSession.assign_log_entry_to_log | def assign_log_entry_to_log(self, log_entry_id, log_id):
"""Adds an existing ``LogEntry`` to a ``Log``.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
raise: AlreadyExists - ``log_entry_id`` is al... | python | def assign_log_entry_to_log(self, log_entry_id, log_id):
"""Adds an existing ``LogEntry`` to a ``Log``.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
raise: AlreadyExists - ``log_entry_id`` is al... | [
"def",
"assign_log_entry_to_log",
"(",
"self",
",",
"log_entry_id",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.assign_resource_to_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LOGGING'",
",",
"loc... | Adds an existing ``LogEntry`` to a ``Log``.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
raise: AlreadyExists - ``log_entry_id`` is already assigned to
``log_id``
raise: NotFoun... | [
"Adds",
"an",
"existing",
"LogEntry",
"to",
"a",
"Log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L1480-L1501 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogEntryLogAssignmentSession.unassign_log_entry_from_log | def unassign_log_entry_from_log(self, log_entry_id, log_id):
"""Removes a ``LogEntry`` from a ``Log``.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
raise: NotFound - ``log_entry_id`` or ``log_id... | python | def unassign_log_entry_from_log(self, log_entry_id, log_id):
"""Removes a ``LogEntry`` from a ``Log``.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
raise: NotFound - ``log_entry_id`` or ``log_id... | [
"def",
"unassign_log_entry_from_log",
"(",
"self",
",",
"log_entry_id",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.unassign_resource_from_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'LOGGING'",
","... | Removes a ``LogEntry`` from a ``Log``.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: log_id (osid.id.Id): the ``Id`` of the ``Log``
raise: NotFound - ``log_entry_id`` or ``log_id`` not found or
``log_entry_id`` not assigned to ``log_i... | [
"Removes",
"a",
"LogEntry",
"from",
"a",
"Log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L1504-L1524 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogEntryLogAssignmentSession.reassign_log_entry_to_log | def reassign_log_entry_to_log(self, log_entry_id, from_log_id, to_log_id):
"""Moves a ``LogEntry`` from one ``Log`` to another.
Mappings to other ``Logs`` are unaffected.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: from_log_id (osid.id.Id):... | python | def reassign_log_entry_to_log(self, log_entry_id, from_log_id, to_log_id):
"""Moves a ``LogEntry`` from one ``Log`` to another.
Mappings to other ``Logs`` are unaffected.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: from_log_id (osid.id.Id):... | [
"def",
"reassign_log_entry_to_log",
"(",
"self",
",",
"log_entry_id",
",",
"from_log_id",
",",
"to_log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.reassign_resource_to_bin",
"self",
".",
"assign_log_entry_to_log",
"(",
"log_entr... | Moves a ``LogEntry`` from one ``Log`` to another.
Mappings to other ``Logs`` are unaffected.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: from_log_id (osid.id.Id): the ``Id`` of the current
``Log``
arg: to_log_id (osid.id.... | [
"Moves",
"a",
"LogEntry",
"from",
"one",
"Log",
"to",
"another",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L1527-L1555 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogAdminSession.can_create_log_with_record_types | def can_create_log_with_record_types(self, log_record_types):
"""Tests if this user can create a single ``Log`` using the desired record types.
While ``LoggingManager.getLogRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are required... | python | def can_create_log_with_record_types(self, log_record_types):
"""Tests if this user can create a single ``Log`` using the desired record types.
While ``LoggingManager.getLogRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are required... | [
"def",
"can_create_log_with_record_types",
"(",
"self",
",",
"log_record_types",
")",
":",
"# Implemented from template for",
"# osid.resource.BinAdminSession.can_create_bin_with_record_types",
"# NOTE: It is expected that real authentication hints will be",
"# handled in a service adapter abo... | Tests if this user can create a single ``Log`` using the desired record types.
While ``LoggingManager.getLogRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are required for creating a specific ``Log``.
Providing an empty array tests ... | [
"Tests",
"if",
"this",
"user",
"can",
"create",
"a",
"single",
"Log",
"using",
"the",
"desired",
"record",
"types",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L1890-L1914 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogAdminSession.update_log | def update_log(self, log_form):
"""Updates an existing log.
arg: log_form (osid.logging.LogForm): the form containing the
elements to be updated
raise: IllegalState - ``log_form`` already used in an update
transaction
raise: InvalidArgument - the for... | python | def update_log(self, log_form):
"""Updates an existing log.
arg: log_form (osid.logging.LogForm): the form containing the
elements to be updated
raise: IllegalState - ``log_form`` already used in an update
transaction
raise: InvalidArgument - the for... | [
"def",
"update_log",
"(",
"self",
",",
"log_form",
")",
":",
"# Implemented from template for",
"# osid.resource.BinAdminSession.update_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"updat... | Updates an existing log.
arg: log_form (osid.logging.LogForm): the form containing the
elements to be updated
raise: IllegalState - ``log_form`` already used in an update
transaction
raise: InvalidArgument - the form contains an invalid value
raise: ... | [
"Updates",
"an",
"existing",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2055-L2094 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogAdminSession.alias_log | def alias_log(self, log_id, alias_id):
"""Adds an ``Id`` to a ``Log`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Log`` is determined by the provider.
The new ``Id`` performs as an alias to the primary ``Id``. If
the alias is a pointer to another log, it is re... | python | def alias_log(self, log_id, alias_id):
"""Adds an ``Id`` to a ``Log`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Log`` is determined by the provider.
The new ``Id`` performs as an alias to the primary ``Id``. If
the alias is a pointer to another log, it is re... | [
"def",
"alias_log",
"(",
"self",
",",
"log_id",
",",
"alias_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinLookupSession.alias_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session... | Adds an ``Id`` to a ``Log`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Log`` is determined by the provider.
The new ``Id`` performs as an alias to the primary ``Id``. If
the alias is a pointer to another log, it is reassigned to the
given log ``Id``.
... | [
"Adds",
"an",
"Id",
"to",
"a",
"Log",
"for",
"the",
"purpose",
"of",
"creating",
"compatibility",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2166-L2188 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_log_hierarchy_id | def get_log_hierarchy_id(self):
"""Gets the hierarchy ``Id`` associated with this session.
return: (osid.id.Id) - the hierarchy ``Id`` associated with this
session
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for
... | python | def get_log_hierarchy_id(self):
"""Gets the hierarchy ``Id`` associated with this session.
return: (osid.id.Id) - the hierarchy ``Id`` associated with this
session
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for
... | [
"def",
"get_log_hierarchy_id",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_bin_hierarchy_id",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"get_catalog... | Gets the hierarchy ``Id`` associated with this session.
return: (osid.id.Id) - the hierarchy ``Id`` associated with this
session
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"hierarchy",
"Id",
"associated",
"with",
"this",
"session",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2236-L2248 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_log_hierarchy | def get_log_hierarchy(self):
"""Gets the hierarchy associated with this session.
return: (osid.hierarchy.Hierarchy) - the hierarchy associated
with this session
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
... | python | def get_log_hierarchy(self):
"""Gets the hierarchy associated with this session.
return: (osid.hierarchy.Hierarchy) - the hierarchy associated
with this session
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
... | [
"def",
"get_log_hierarchy",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_bin_hierarchy",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"get_catalog_hiera... | Gets the hierarchy associated with this session.
return: (osid.hierarchy.Hierarchy) - the hierarchy associated
with this session
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method mu... | [
"Gets",
"the",
"hierarchy",
"associated",
"with",
"this",
"session",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2252-L2266 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_root_logs | def get_root_logs(self):
"""Gets the root logs in the log hierarchy.
A node with no parents is an orphan. While all log ``Ids`` are
known to the hierarchy, an orphan does not appear in the
hierarchy unless explicitly added as a root node or child of
another node.
return... | python | def get_root_logs(self):
"""Gets the root logs in the log hierarchy.
A node with no parents is an orphan. While all log ``Ids`` are
known to the hierarchy, an orphan does not appear in the
hierarchy unless explicitly added as a root node or child of
another node.
return... | [
"def",
"get_root_logs",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_root_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"get_root_catalogs",
"("... | Gets the root logs in the log hierarchy.
A node with no parents is an orphan. While all log ``Ids`` are
known to the hierarchy, an orphan does not appear in the
hierarchy unless explicitly added as a root node or child of
another node.
return: (osid.logging.LogList) - the root ... | [
"Gets",
"the",
"root",
"logs",
"in",
"the",
"log",
"hierarchy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2340-L2360 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.has_parent_logs | def has_parent_logs(self, log_id):
"""Tests if the ``Log`` has any parents.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the log has parents, ``false``
otherwise
raise: NotFound - ``log_id`` is not found
raise: NullArgument -... | python | def has_parent_logs(self, log_id):
"""Tests if the ``Log`` has any parents.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the log has parents, ``false``
otherwise
raise: NotFound - ``log_id`` is not found
raise: NullArgument -... | [
"def",
"has_parent_logs",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.has_parent_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"ha... | Tests if the ``Log`` has any parents.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the log has parents, ``false``
otherwise
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: Operat... | [
"Tests",
"if",
"the",
"Log",
"has",
"any",
"parents",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2365-L2382 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.is_parent_of_log | def is_parent_of_log(self, id_, log_id):
"""Tests if an ``Id`` is a direct parent of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if this ``id`` is a parent of
``log_id,`` ``false`` otherwise
... | python | def is_parent_of_log(self, id_, log_id):
"""Tests if an ``Id`` is a direct parent of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if this ``id`` is a parent of
``log_id,`` ``false`` otherwise
... | [
"def",
"is_parent_of_log",
"(",
"self",
",",
"id_",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_parent_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_sess... | Tests if an ``Id`` is a direct parent of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if this ``id`` is a parent of
``log_id,`` ``false`` otherwise
raise: NotFound - ``log_id`` is not found
... | [
"Tests",
"if",
"an",
"Id",
"is",
"a",
"direct",
"parent",
"of",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2385-L2404 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_parent_log_ids | def get_parent_log_ids(self, log_id):
"""Gets the parent ``Ids`` of the given log.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (osid.id.IdList) - the parent ``Ids`` of the log
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
... | python | def get_parent_log_ids(self, log_id):
"""Gets the parent ``Ids`` of the given log.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (osid.id.IdList) - the parent ``Ids`` of the log
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
... | [
"def",
"get_parent_log_ids",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_parent_bin_ids",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",... | Gets the parent ``Ids`` of the given log.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (osid.id.IdList) - the parent ``Ids`` of the log
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to comple... | [
"Gets",
"the",
"parent",
"Ids",
"of",
"the",
"given",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2407-L2423 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_parent_logs | def get_parent_logs(self, log_id):
"""Gets the parent logs of the given ``id``.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query
return: (osid.logging.LogList) - the parent logs of the ``id``
raise: NotFound - a ``Log`` identified by ``Id is`` not found
raise: N... | python | def get_parent_logs(self, log_id):
"""Gets the parent logs of the given ``id``.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query
return: (osid.logging.LogList) - the parent logs of the ``id``
raise: NotFound - a ``Log`` identified by ``Id is`` not found
raise: N... | [
"def",
"get_parent_logs",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_parent_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"ge... | Gets the parent logs of the given ``id``.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query
return: (osid.logging.LogList) - the parent logs of the ``id``
raise: NotFound - a ``Log`` identified by ``Id is`` not found
raise: NullArgument - ``log_id`` is ``null``
r... | [
"Gets",
"the",
"parent",
"logs",
"of",
"the",
"given",
"id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2426-L2445 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.is_ancestor_of_log | def is_ancestor_of_log(self, id_, log_id):
"""Tests if an ``Id`` is an ancestor of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is an ancestor of the
``log_id,`` ``false`` otherwise... | python | def is_ancestor_of_log(self, id_, log_id):
"""Tests if an ``Id`` is an ancestor of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is an ancestor of the
``log_id,`` ``false`` otherwise... | [
"def",
"is_ancestor_of_log",
"(",
"self",
",",
"id_",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_ancestor_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_... | Tests if an ``Id`` is an ancestor of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is an ancestor of the
``log_id,`` ``false`` otherwise
raise: NotFound - ``log_id`` is not found
... | [
"Tests",
"if",
"an",
"Id",
"is",
"an",
"ancestor",
"of",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2448-L2467 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.has_child_logs | def has_child_logs(self, log_id):
"""Tests if a log has any children.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``log_id`` has children,
``false`` otherwise
raise: NotFound - ``log_id`` is not found
raise: NullArgument... | python | def has_child_logs(self, log_id):
"""Tests if a log has any children.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``log_id`` has children,
``false`` otherwise
raise: NotFound - ``log_id`` is not found
raise: NullArgument... | [
"def",
"has_child_logs",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.has_child_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"has_... | Tests if a log has any children.
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``log_id`` has children,
``false`` otherwise
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: Ope... | [
"Tests",
"if",
"a",
"log",
"has",
"any",
"children",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2470-L2487 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.is_child_of_log | def is_child_of_log(self, id_, log_id):
"""Tests if an ``Id`` is a direct child of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if this ``id`` is a child of
``log_id,`` ``false`` otherwise
... | python | def is_child_of_log(self, id_, log_id):
"""Tests if an ``Id`` is a direct child of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if this ``id`` is a child of
``log_id,`` ``false`` otherwise
... | [
"def",
"is_child_of_log",
"(",
"self",
",",
"id_",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_child_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_sessio... | Tests if an ``Id`` is a direct child of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if this ``id`` is a child of
``log_id,`` ``false`` otherwise
raise: NotFound - ``log_id`` is not found
... | [
"Tests",
"if",
"an",
"Id",
"is",
"a",
"direct",
"child",
"of",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2490-L2509 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_child_log_ids | def get_child_log_ids(self, log_id):
"""Gets the child ``Ids`` of the given log.
arg: log_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the depot
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
... | python | def get_child_log_ids(self, log_id):
"""Gets the child ``Ids`` of the given log.
arg: log_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the depot
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
... | [
"def",
"get_child_log_ids",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_child_bin_ids",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
... | Gets the child ``Ids`` of the given log.
arg: log_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the depot
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete re... | [
"Gets",
"the",
"child",
"Ids",
"of",
"the",
"given",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2512-L2528 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_child_logs | def get_child_logs(self, log_id):
"""Gets the child logs of the given ``id``.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query
return: (osid.logging.LogList) - the child logs of the ``id``
raise: NotFound - a ``Log`` identified by ``Id is`` not found
raise: Null... | python | def get_child_logs(self, log_id):
"""Gets the child logs of the given ``id``.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query
return: (osid.logging.LogList) - the child logs of the ``id``
raise: NotFound - a ``Log`` identified by ``Id is`` not found
raise: Null... | [
"def",
"get_child_logs",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_child_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"get_... | Gets the child logs of the given ``id``.
arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` to query
return: (osid.logging.LogList) - the child logs of the ``id``
raise: NotFound - a ``Log`` identified by ``Id is`` not found
raise: NullArgument - ``log_id`` is ``null``
rai... | [
"Gets",
"the",
"child",
"logs",
"of",
"the",
"given",
"id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2531-L2550 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.is_descendant_of_log | def is_descendant_of_log(self, id_, log_id):
"""Tests if an ``Id`` is a descendant of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is a descendant of
the ``log_id,`` ``false`` other... | python | def is_descendant_of_log(self, id_, log_id):
"""Tests if an ``Id`` is a descendant of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is a descendant of
the ``log_id,`` ``false`` other... | [
"def",
"is_descendant_of_log",
"(",
"self",
",",
"id_",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_descendant_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_cata... | Tests if an ``Id`` is a descendant of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is a descendant of
the ``log_id,`` ``false`` otherwise
raise: NotFound - ``log_id`` is not found
... | [
"Tests",
"if",
"an",
"Id",
"is",
"a",
"descendant",
"of",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2553-L2572 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchySession.get_log_nodes | def get_log_nodes(self, log_id, ancestor_levels, descendant_levels, include_siblings):
"""Gets a portion of the hierarchy for the given log.
arg: log_id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include. A v... | python | def get_log_nodes(self, log_id, ancestor_levels, descendant_levels, include_siblings):
"""Gets a portion of the hierarchy for the given log.
arg: log_id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include. A v... | [
"def",
"get_log_nodes",
"(",
"self",
",",
"log_id",
",",
"ancestor_levels",
",",
"descendant_levels",
",",
"include_siblings",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_bin_nodes",
"return",
"objects",
".",
"LogNode",
"(",
"self",... | Gets a portion of the hierarchy for the given log.
arg: log_id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include. A value of 0 returns no
parents in the node.
arg: descendant_levels (cardi... | [
"Gets",
"a",
"portion",
"of",
"the",
"hierarchy",
"for",
"the",
"given",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2611-L2638 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchyDesignSession.add_root_log | def add_root_log(self, log_id):
"""Adds a root log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: AlreadyExists - ``log_id`` is already in hierarchy
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFaile... | python | def add_root_log(self, log_id):
"""Adds a root log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: AlreadyExists - ``log_id`` is already in hierarchy
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFaile... | [
"def",
"add_root_log",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.add_root_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
"... | Adds a root log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: AlreadyExists - ``log_id`` is already in hierarchy
raise: NotFound - ``log_id`` is not found
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
rais... | [
"Adds",
"a",
"root",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2725-L2741 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchyDesignSession.remove_root_log | def remove_root_log(self, log_id):
"""Removes a root log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: NotFound - ``log_id`` is not a root
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDen... | python | def remove_root_log(self, log_id):
"""Removes a root log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: NotFound - ``log_id`` is not a root
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDen... | [
"def",
"remove_root_log",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.remove_root_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session... | Removes a root log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: NotFound - ``log_id`` is not a root
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*complianc... | [
"Removes",
"a",
"root",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2744-L2759 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchyDesignSession.add_child_log | def add_child_log(self, log_id, child_id):
"""Adds a child to a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``log_id`` is already a parent of
``child_id``
raise: NotFoun... | python | def add_child_log(self, log_id, child_id):
"""Adds a child to a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``log_id`` is already a parent of
``child_id``
raise: NotFoun... | [
"def",
"add_child_log",
"(",
"self",
",",
"log_id",
",",
"child_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.add_child_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
... | Adds a child to a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``log_id`` is already a parent of
``child_id``
raise: NotFound - ``log_id`` or ``child_id`` not found
raise... | [
"Adds",
"a",
"child",
"to",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2762-L2780 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchyDesignSession.remove_child_log | def remove_child_log(self, log_id, child_id):
"""Removes a child from a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``log_id`` not a parent of ``child_id``
raise: NullArgument - ``log_id`` o... | python | def remove_child_log(self, log_id, child_id):
"""Removes a child from a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``log_id`` not a parent of ``child_id``
raise: NullArgument - ``log_id`` o... | [
"def",
"remove_child_log",
"(",
"self",
",",
"log_id",
",",
"child_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.remove_child_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
"... | Removes a child from a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``log_id`` not a parent of ``child_id``
raise: NullArgument - ``log_id`` or ``child_id`` is ``null``
raise: OperationFaile... | [
"Removes",
"a",
"child",
"from",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2783-L2799 |
mitsei/dlkit | dlkit/json_/logging_/sessions.py | LogHierarchyDesignSession.remove_child_logs | def remove_child_logs(self, log_id):
"""Removes all children from a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: NotFound - ``log_id`` not in hierarchy
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
rai... | python | def remove_child_logs(self, log_id):
"""Removes all children from a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: NotFound - ``log_id`` not in hierarchy
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
rai... | [
"def",
"remove_child_logs",
"(",
"self",
",",
"log_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.remove_child_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_sess... | Removes all children from a log.
arg: log_id (osid.id.Id): the ``Id`` of a log
raise: NotFound - ``log_id`` not in hierarchy
raise: NullArgument - ``log_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
... | [
"Removes",
"all",
"children",
"from",
"a",
"log",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/sessions.py#L2802-L2817 |
cashlo/asciichart | asciichart/asciichart.py | bar_chart | def bar_chart(data, bar_char='=', width=80):
"""Return an horizontal bar chart
>>> print bar_chart({
... 'one': '1',
... 'two': '2',
... 'three': '3',
... 'four': '4',
... 'five': '5',
... })
five =====
four ====
one =
three ===
two ==
>>> print bar_chart({
... '1/1': 1/1.... | python | def bar_chart(data, bar_char='=', width=80):
"""Return an horizontal bar chart
>>> print bar_chart({
... 'one': '1',
... 'two': '2',
... 'three': '3',
... 'four': '4',
... 'five': '5',
... })
five =====
four ====
one =
three ===
two ==
>>> print bar_chart({
... '1/1': 1/1.... | [
"def",
"bar_chart",
"(",
"data",
",",
"bar_char",
"=",
"'='",
",",
"width",
"=",
"80",
")",
":",
"if",
"type",
"(",
"data",
")",
"is",
"dict",
":",
"output",
"=",
"[",
"]",
"max_len",
"=",
"len",
"(",
"max",
"(",
"data",
",",
"key",
"=",
"len",... | Return an horizontal bar chart
>>> print bar_chart({
... 'one': '1',
... 'two': '2',
... 'three': '3',
... 'four': '4',
... 'five': '5',
... })
five =====
four ====
one =
three ===
two ==
>>> print bar_chart({
... '1/1': 1/1.0,
... '1/2': 1/2.0,
... '1/3': 1/3.0,
... | [
"Return",
"an",
"horizontal",
"bar",
"chart"
] | train | https://github.com/cashlo/asciichart/blob/70e81cfe7ab5d8629052bf1f7aa0fe133d0d6397/asciichart/asciichart.py#L1-L62 |
python-odin/odinweb | odinweb/decorators.py | security | def security(name, *permissions):
"""
Decorator to add security definition.
"""
def inner(c):
c.security = Security(name, *permissions)
return c
return inner | python | def security(name, *permissions):
"""
Decorator to add security definition.
"""
def inner(c):
c.security = Security(name, *permissions)
return c
return inner | [
"def",
"security",
"(",
"name",
",",
"*",
"permissions",
")",
":",
"def",
"inner",
"(",
"c",
")",
":",
"c",
".",
"security",
"=",
"Security",
"(",
"name",
",",
"*",
"permissions",
")",
"return",
"c",
"return",
"inner"
] | Decorator to add security definition. | [
"Decorator",
"to",
"add",
"security",
"definition",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L269-L276 |
python-odin/odinweb | odinweb/decorators.py | action | def action(callback=None, name=None, path=None, methods=Method.GET, resource=None, tags=None,
summary=None, middleware=None):
# type: (Callable, Path, Path, Methods, Type[Resource], Tags, str, List[Any]) -> Operation
"""
Decorator to apply an action to a resource. An action is applied to a `detai... | python | def action(callback=None, name=None, path=None, methods=Method.GET, resource=None, tags=None,
summary=None, middleware=None):
# type: (Callable, Path, Path, Methods, Type[Resource], Tags, str, List[Any]) -> Operation
"""
Decorator to apply an action to a resource. An action is applied to a `detai... | [
"def",
"action",
"(",
"callback",
"=",
"None",
",",
"name",
"=",
"None",
",",
"path",
"=",
"None",
",",
"methods",
"=",
"Method",
".",
"GET",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"None",
",",
"middleware",
"=... | Decorator to apply an action to a resource. An action is applied to a `detail` operation. | [
"Decorator",
"to",
"apply",
"an",
"action",
"to",
"a",
"resource",
".",
"An",
"action",
"is",
"applied",
"to",
"a",
"detail",
"operation",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L279-L292 |
python-odin/odinweb | odinweb/decorators.py | listing | def listing(callback=None, path=None, method=Method.GET, resource=None, tags=None, summary="List resources",
middleware=None, default_limit=50, max_limit=None, use_wrapper=True):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any], int, int) -> Operation
"""
Decorator to configure a... | python | def listing(callback=None, path=None, method=Method.GET, resource=None, tags=None, summary="List resources",
middleware=None, default_limit=50, max_limit=None, use_wrapper=True):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any], int, int) -> Operation
"""
Decorator to configure a... | [
"def",
"listing",
"(",
"callback",
"=",
"None",
",",
"path",
"=",
"None",
",",
"method",
"=",
"Method",
".",
"GET",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"\"List resources\"",
",",
"middleware",
"=",
"None",
",",
... | Decorator to configure an operation that returns a list of resources. | [
"Decorator",
"to",
"configure",
"an",
"operation",
"that",
"returns",
"a",
"list",
"of",
"resources",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L487-L500 |
python-odin/odinweb | odinweb/decorators.py | create | def create(callback=None, path=None, method=Method.POST, resource=None, tags=None, summary="Create a new resource",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that creates a resource.
"""
def inn... | python | def create(callback=None, path=None, method=Method.POST, resource=None, tags=None, summary="Create a new resource",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that creates a resource.
"""
def inn... | [
"def",
"create",
"(",
"callback",
"=",
"None",
",",
"path",
"=",
"None",
",",
"method",
"=",
"Method",
".",
"POST",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"\"Create a new resource\"",
",",
"middleware",
"=",
"None",
... | Decorator to configure an operation that creates a resource. | [
"Decorator",
"to",
"configure",
"an",
"operation",
"that",
"creates",
"a",
"resource",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L503-L514 |
python-odin/odinweb | odinweb/decorators.py | detail | def detail(callback=None, path=None, method=Method.GET, resource=None, tags=None, summary="Get specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that fetches a resource.
"""
def in... | python | def detail(callback=None, path=None, method=Method.GET, resource=None, tags=None, summary="Get specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that fetches a resource.
"""
def in... | [
"def",
"detail",
"(",
"callback",
"=",
"None",
",",
"path",
"=",
"None",
",",
"method",
"=",
"Method",
".",
"GET",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"\"Get specified resource.\"",
",",
"middleware",
"=",
"None",... | Decorator to configure an operation that fetches a resource. | [
"Decorator",
"to",
"configure",
"an",
"operation",
"that",
"fetches",
"a",
"resource",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L517-L528 |
python-odin/odinweb | odinweb/decorators.py | update | def update(callback=None, path=None, method=Method.PUT, resource=None, tags=None, summary="Update specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that updates a resource.
"""
def... | python | def update(callback=None, path=None, method=Method.PUT, resource=None, tags=None, summary="Update specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that updates a resource.
"""
def... | [
"def",
"update",
"(",
"callback",
"=",
"None",
",",
"path",
"=",
"None",
",",
"method",
"=",
"Method",
".",
"PUT",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"\"Update specified resource.\"",
",",
"middleware",
"=",
"Non... | Decorator to configure an operation that updates a resource. | [
"Decorator",
"to",
"configure",
"an",
"operation",
"that",
"updates",
"a",
"resource",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L531-L543 |
python-odin/odinweb | odinweb/decorators.py | patch | def patch(callback=None, path=None, method=Method.PATCH, resource=None, tags=None, summary="Patch specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that patches a resource.
"""
def ... | python | def patch(callback=None, path=None, method=Method.PATCH, resource=None, tags=None, summary="Patch specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Resource, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that patches a resource.
"""
def ... | [
"def",
"patch",
"(",
"callback",
"=",
"None",
",",
"path",
"=",
"None",
",",
"method",
"=",
"Method",
".",
"PATCH",
",",
"resource",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"\"Patch specified resource.\"",
",",
"middleware",
"=",
"Non... | Decorator to configure an operation that patches a resource. | [
"Decorator",
"to",
"configure",
"an",
"operation",
"that",
"patches",
"a",
"resource",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L546-L559 |
python-odin/odinweb | odinweb/decorators.py | delete | def delete(callback=None, path=None, method=Method.DELETE, tags=None, summary="Delete specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that deletes resource.
"""
def inner(c):
op = ... | python | def delete(callback=None, path=None, method=Method.DELETE, tags=None, summary="Delete specified resource.",
middleware=None):
# type: (Callable, Path, Methods, Tags, str, List[Any]) -> Operation
"""
Decorator to configure an operation that deletes resource.
"""
def inner(c):
op = ... | [
"def",
"delete",
"(",
"callback",
"=",
"None",
",",
"path",
"=",
"None",
",",
"method",
"=",
"Method",
".",
"DELETE",
",",
"tags",
"=",
"None",
",",
"summary",
"=",
"\"Delete specified resource.\"",
",",
"middleware",
"=",
"None",
")",
":",
"# type: (Calla... | Decorator to configure an operation that deletes resource. | [
"Decorator",
"to",
"configure",
"an",
"operation",
"that",
"deletes",
"resource",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L562-L573 |
python-odin/odinweb | odinweb/decorators.py | Operation.execute | def execute(self, request, *args, **path_args):
# type: (BaseHttpRequest, tuple, Dict[Any]) -> Any
"""
Execute the callback (binding callback if required)
"""
binding = self.binding
if binding:
# Provide binding as decorators are executed prior to binding
... | python | def execute(self, request, *args, **path_args):
# type: (BaseHttpRequest, tuple, Dict[Any]) -> Any
"""
Execute the callback (binding callback if required)
"""
binding = self.binding
if binding:
# Provide binding as decorators are executed prior to binding
... | [
"def",
"execute",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"path_args",
")",
":",
"# type: (BaseHttpRequest, tuple, Dict[Any]) -> Any",
"binding",
"=",
"self",
".",
"binding",
"if",
"binding",
":",
"# Provide binding as decorators are executed pri... | Execute the callback (binding callback if required) | [
"Execute",
"the",
"callback",
"(",
"binding",
"callback",
"if",
"required",
")"
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L159-L169 |
python-odin/odinweb | odinweb/decorators.py | Operation.bind_to_instance | def bind_to_instance(self, instance):
"""
Bind a ResourceApi instance to an operation.
"""
self.binding = instance
self.middleware.append(instance) | python | def bind_to_instance(self, instance):
"""
Bind a ResourceApi instance to an operation.
"""
self.binding = instance
self.middleware.append(instance) | [
"def",
"bind_to_instance",
"(",
"self",
",",
"instance",
")",
":",
"self",
".",
"binding",
"=",
"instance",
"self",
".",
"middleware",
".",
"append",
"(",
"instance",
")"
] | Bind a ResourceApi instance to an operation. | [
"Bind",
"a",
"ResourceApi",
"instance",
"to",
"an",
"operation",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L171-L176 |
python-odin/odinweb | odinweb/decorators.py | Operation.op_paths | def op_paths(self, path_prefix=None):
# type: (Path) -> Generator[Tuple[UrlPath, Operation]]
"""
Yield operations paths stored in containers.
"""
url_path = self.path
if path_prefix:
url_path = path_prefix + url_path
yield url_path, self | python | def op_paths(self, path_prefix=None):
# type: (Path) -> Generator[Tuple[UrlPath, Operation]]
"""
Yield operations paths stored in containers.
"""
url_path = self.path
if path_prefix:
url_path = path_prefix + url_path
yield url_path, self | [
"def",
"op_paths",
"(",
"self",
",",
"path_prefix",
"=",
"None",
")",
":",
"# type: (Path) -> Generator[Tuple[UrlPath, Operation]]",
"url_path",
"=",
"self",
".",
"path",
"if",
"path_prefix",
":",
"url_path",
"=",
"path_prefix",
"+",
"url_path",
"yield",
"url_path",... | Yield operations paths stored in containers. | [
"Yield",
"operations",
"paths",
"stored",
"in",
"containers",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L178-L187 |
python-odin/odinweb | odinweb/decorators.py | Operation.resource | def resource(self):
"""
Resource associated with operation.
"""
if self._resource:
return self._resource
elif self.binding:
return self.binding.resource | python | def resource(self):
"""
Resource associated with operation.
"""
if self._resource:
return self._resource
elif self.binding:
return self.binding.resource | [
"def",
"resource",
"(",
"self",
")",
":",
"if",
"self",
".",
"_resource",
":",
"return",
"self",
".",
"_resource",
"elif",
"self",
".",
"binding",
":",
"return",
"self",
".",
"binding",
".",
"resource"
] | Resource associated with operation. | [
"Resource",
"associated",
"with",
"operation",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L197-L204 |
python-odin/odinweb | odinweb/decorators.py | Operation.key_field_name | def key_field_name(self):
"""
Field identified as the key.
"""
name = 'resource_id'
if self.resource:
key_field = getmeta(self.resource).key_field
if key_field:
name = key_field.attname
return name | python | def key_field_name(self):
"""
Field identified as the key.
"""
name = 'resource_id'
if self.resource:
key_field = getmeta(self.resource).key_field
if key_field:
name = key_field.attname
return name | [
"def",
"key_field_name",
"(",
"self",
")",
":",
"name",
"=",
"'resource_id'",
"if",
"self",
".",
"resource",
":",
"key_field",
"=",
"getmeta",
"(",
"self",
".",
"resource",
")",
".",
"key_field",
"if",
"key_field",
":",
"name",
"=",
"key_field",
".",
"at... | Field identified as the key. | [
"Field",
"identified",
"as",
"the",
"key",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L207-L216 |
python-odin/odinweb | odinweb/decorators.py | Operation.to_swagger | def to_swagger(self):
"""
Generate a dictionary for documentation generation.
"""
return dict_filter(
operationId=self.operation_id,
description=(self.callback.__doc__ or '').strip() or None,
summary=self.summary or None,
tags=list(self.tag... | python | def to_swagger(self):
"""
Generate a dictionary for documentation generation.
"""
return dict_filter(
operationId=self.operation_id,
description=(self.callback.__doc__ or '').strip() or None,
summary=self.summary or None,
tags=list(self.tag... | [
"def",
"to_swagger",
"(",
"self",
")",
":",
"return",
"dict_filter",
"(",
"operationId",
"=",
"self",
".",
"operation_id",
",",
"description",
"=",
"(",
"self",
".",
"callback",
".",
"__doc__",
"or",
"''",
")",
".",
"strip",
"(",
")",
"or",
"None",
","... | Generate a dictionary for documentation generation. | [
"Generate",
"a",
"dictionary",
"for",
"documentation",
"generation",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L228-L243 |
python-odin/odinweb | odinweb/decorators.py | Operation.tags | def tags(self):
# type: () -> Set[str]
"""
Tags applied to operation.
"""
tags = set()
if self._tags:
tags.update(self._tags)
if self.binding:
binding_tags = getattr(self.binding, 'tags', None)
if binding_tags:
t... | python | def tags(self):
# type: () -> Set[str]
"""
Tags applied to operation.
"""
tags = set()
if self._tags:
tags.update(self._tags)
if self.binding:
binding_tags = getattr(self.binding, 'tags', None)
if binding_tags:
t... | [
"def",
"tags",
"(",
"self",
")",
":",
"# type: () -> Set[str]",
"tags",
"=",
"set",
"(",
")",
"if",
"self",
".",
"_tags",
":",
"tags",
".",
"update",
"(",
"self",
".",
"_tags",
")",
"if",
"self",
".",
"binding",
":",
"binding_tags",
"=",
"getattr",
"... | Tags applied to operation. | [
"Tags",
"applied",
"to",
"operation",
"."
] | train | https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/decorators.py#L251-L263 |
delfick/harpoon | harpoon/ship/runner.py | Runner.run_container | def run_container(self, conf, images, **kwargs):
"""Run this image and all dependency images"""
with self._run_container(conf, images, **kwargs):
pass | python | def run_container(self, conf, images, **kwargs):
"""Run this image and all dependency images"""
with self._run_container(conf, images, **kwargs):
pass | [
"def",
"run_container",
"(",
"self",
",",
"conf",
",",
"images",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"_run_container",
"(",
"conf",
",",
"images",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | Run this image and all dependency images | [
"Run",
"this",
"image",
"and",
"all",
"dependency",
"images"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L41-L44 |
delfick/harpoon | harpoon/ship/runner.py | Runner.delete_deps | def delete_deps(self, conf, images):
"""Delete any deleteable images"""
for dependency_name, _ in conf.dependency_images():
image = images[dependency_name]
if image.deleteable_image:
log.info("Removing un-needed image {0}".format(image.image_name))
... | python | def delete_deps(self, conf, images):
"""Delete any deleteable images"""
for dependency_name, _ in conf.dependency_images():
image = images[dependency_name]
if image.deleteable_image:
log.info("Removing un-needed image {0}".format(image.image_name))
... | [
"def",
"delete_deps",
"(",
"self",
",",
"conf",
",",
"images",
")",
":",
"for",
"dependency_name",
",",
"_",
"in",
"conf",
".",
"dependency_images",
"(",
")",
":",
"image",
"=",
"images",
"[",
"dependency_name",
"]",
"if",
"image",
".",
"deleteable_image",... | Delete any deleteable images | [
"Delete",
"any",
"deleteable",
"images"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L76-L82 |
delfick/harpoon | harpoon/ship/runner.py | Runner.run_deps | def run_deps(self, conf, images):
"""Start containers for all our dependencies"""
for dependency_name, detached in conf.dependency_images(for_running=True):
try:
self.run_container(images[dependency_name], images, detach=detached, dependency=True)
except Exception... | python | def run_deps(self, conf, images):
"""Start containers for all our dependencies"""
for dependency_name, detached in conf.dependency_images(for_running=True):
try:
self.run_container(images[dependency_name], images, detach=detached, dependency=True)
except Exception... | [
"def",
"run_deps",
"(",
"self",
",",
"conf",
",",
"images",
")",
":",
"for",
"dependency_name",
",",
"detached",
"in",
"conf",
".",
"dependency_images",
"(",
"for_running",
"=",
"True",
")",
":",
"try",
":",
"self",
".",
"run_container",
"(",
"images",
"... | Start containers for all our dependencies | [
"Start",
"containers",
"for",
"all",
"our",
"dependencies"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L84-L90 |
delfick/harpoon | harpoon/ship/runner.py | Runner.stop_deps | def stop_deps(self, conf, images):
"""Stop the containers for all our dependencies"""
for dependency, _ in conf.dependency_images():
self.stop_deps(images[dependency], images)
try:
self.stop_container(images[dependency], fail_on_bad_exit=True, fail_reason="Failed ... | python | def stop_deps(self, conf, images):
"""Stop the containers for all our dependencies"""
for dependency, _ in conf.dependency_images():
self.stop_deps(images[dependency], images)
try:
self.stop_container(images[dependency], fail_on_bad_exit=True, fail_reason="Failed ... | [
"def",
"stop_deps",
"(",
"self",
",",
"conf",
",",
"images",
")",
":",
"for",
"dependency",
",",
"_",
"in",
"conf",
".",
"dependency_images",
"(",
")",
":",
"self",
".",
"stop_deps",
"(",
"images",
"[",
"dependency",
"]",
",",
"images",
")",
"try",
"... | Stop the containers for all our dependencies | [
"Stop",
"the",
"containers",
"for",
"all",
"our",
"dependencies"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L92-L101 |
delfick/harpoon | harpoon/ship/runner.py | Runner.wait_for_deps | def wait_for_deps(self, conf, images):
"""Wait for all our dependencies"""
from harpoon.option_spec.image_objs import WaitCondition
api = conf.harpoon.docker_context_maker().api
waited = set()
last_attempt = {}
dependencies = set(dep for dep, _ in conf.dependency_images(... | python | def wait_for_deps(self, conf, images):
"""Wait for all our dependencies"""
from harpoon.option_spec.image_objs import WaitCondition
api = conf.harpoon.docker_context_maker().api
waited = set()
last_attempt = {}
dependencies = set(dep for dep, _ in conf.dependency_images(... | [
"def",
"wait_for_deps",
"(",
"self",
",",
"conf",
",",
"images",
")",
":",
"from",
"harpoon",
".",
"option_spec",
".",
"image_objs",
"import",
"WaitCondition",
"api",
"=",
"conf",
".",
"harpoon",
".",
"docker_context_maker",
"(",
")",
".",
"api",
"waited",
... | Wait for all our dependencies | [
"Wait",
"for",
"all",
"our",
"dependencies"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L103-L186 |
delfick/harpoon | harpoon/ship/runner.py | Runner.wait_for_dep | def wait_for_dep(self, api, conf, wait_condition, start, last_attempt):
"""Wait for this image"""
from harpoon.option_spec.image_objs import WaitCondition
conditions = list(wait_condition.conditions(start, last_attempt))
if conditions[0] in (WaitCondition.KeepWaiting, WaitCondition.Timed... | python | def wait_for_dep(self, api, conf, wait_condition, start, last_attempt):
"""Wait for this image"""
from harpoon.option_spec.image_objs import WaitCondition
conditions = list(wait_condition.conditions(start, last_attempt))
if conditions[0] in (WaitCondition.KeepWaiting, WaitCondition.Timed... | [
"def",
"wait_for_dep",
"(",
"self",
",",
"api",
",",
"conf",
",",
"wait_condition",
",",
"start",
",",
"last_attempt",
")",
":",
"from",
"harpoon",
".",
"option_spec",
".",
"image_objs",
"import",
"WaitCondition",
"conditions",
"=",
"list",
"(",
"wait_conditio... | Wait for this image | [
"Wait",
"for",
"this",
"image"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L188-L213 |
delfick/harpoon | harpoon/ship/runner.py | Runner.create_container | def create_container(self, conf, detach, tty):
"""Create a single container"""
name = conf.name
image_name = conf.image_name
if conf.tag is not NotSpecified:
image_name = conf.image_name_with_tag
container_name = conf.container_name
with conf.assumed_role():... | python | def create_container(self, conf, detach, tty):
"""Create a single container"""
name = conf.name
image_name = conf.image_name
if conf.tag is not NotSpecified:
image_name = conf.image_name_with_tag
container_name = conf.container_name
with conf.assumed_role():... | [
"def",
"create_container",
"(",
"self",
",",
"conf",
",",
"detach",
",",
"tty",
")",
":",
"name",
"=",
"conf",
".",
"name",
"image_name",
"=",
"conf",
".",
"image_name",
"if",
"conf",
".",
"tag",
"is",
"not",
"NotSpecified",
":",
"image_name",
"=",
"co... | Create a single container | [
"Create",
"a",
"single",
"container"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L226-L328 |
delfick/harpoon | harpoon/ship/runner.py | Runner.start_container | def start_container(self, conf, tty=True, detach=False, is_dependency=False, no_intervention=False):
"""Start up a single container"""
# Make sure we can bind to our specified ports!
if not conf.harpoon.docker_api.base_url.startswith("http"):
self.find_bound_ports(conf.ports)
... | python | def start_container(self, conf, tty=True, detach=False, is_dependency=False, no_intervention=False):
"""Start up a single container"""
# Make sure we can bind to our specified ports!
if not conf.harpoon.docker_api.base_url.startswith("http"):
self.find_bound_ports(conf.ports)
... | [
"def",
"start_container",
"(",
"self",
",",
"conf",
",",
"tty",
"=",
"True",
",",
"detach",
"=",
"False",
",",
"is_dependency",
"=",
"False",
",",
"no_intervention",
"=",
"False",
")",
":",
"# Make sure we can bind to our specified ports!",
"if",
"not",
"conf",
... | Start up a single container | [
"Start",
"up",
"a",
"single",
"container"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L334-L368 |
delfick/harpoon | harpoon/ship/runner.py | Runner.start_tty | def start_tty(self, conf, interactive):
"""Startup a tty"""
try:
api = conf.harpoon.docker_context_maker().api
container_id = conf.container_id
stdin = conf.harpoon.tty_stdin
stdout = conf.harpoon.tty_stdout
stderr = conf.harpoon.tty_stderr
... | python | def start_tty(self, conf, interactive):
"""Startup a tty"""
try:
api = conf.harpoon.docker_context_maker().api
container_id = conf.container_id
stdin = conf.harpoon.tty_stdin
stdout = conf.harpoon.tty_stdout
stderr = conf.harpoon.tty_stderr
... | [
"def",
"start_tty",
"(",
"self",
",",
"conf",
",",
"interactive",
")",
":",
"try",
":",
"api",
"=",
"conf",
".",
"harpoon",
".",
"docker_context_maker",
"(",
")",
".",
"api",
"container_id",
"=",
"conf",
".",
"container_id",
"stdin",
"=",
"conf",
".",
... | Startup a tty | [
"Startup",
"a",
"tty"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L370-L384 |
delfick/harpoon | harpoon/ship/runner.py | Runner.wait_till_stopped | def wait_till_stopped(self, conf, container_id, timeout=10, message=None, waiting=True):
"""Wait till a container is stopped"""
stopped = False
inspection = None
for _ in until(timeout=timeout, action=message):
try:
inspection = conf.harpoon.docker_api.inspect... | python | def wait_till_stopped(self, conf, container_id, timeout=10, message=None, waiting=True):
"""Wait till a container is stopped"""
stopped = False
inspection = None
for _ in until(timeout=timeout, action=message):
try:
inspection = conf.harpoon.docker_api.inspect... | [
"def",
"wait_till_stopped",
"(",
"self",
",",
"conf",
",",
"container_id",
",",
"timeout",
"=",
"10",
",",
"message",
"=",
"None",
",",
"waiting",
"=",
"True",
")",
":",
"stopped",
"=",
"False",
"inspection",
"=",
"None",
"for",
"_",
"in",
"until",
"("... | Wait till a container is stopped | [
"Wait",
"till",
"a",
"container",
"is",
"stopped"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L390-L420 |
delfick/harpoon | harpoon/ship/runner.py | Runner.is_stopped | def is_stopped(self, *args, **kwargs):
"""Return whether this container is stopped"""
kwargs["waiting"] = False
return self.wait_till_stopped(*args, **kwargs) | python | def is_stopped(self, *args, **kwargs):
"""Return whether this container is stopped"""
kwargs["waiting"] = False
return self.wait_till_stopped(*args, **kwargs) | [
"def",
"is_stopped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"waiting\"",
"]",
"=",
"False",
"return",
"self",
".",
"wait_till_stopped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Return whether this container is stopped | [
"Return",
"whether",
"this",
"container",
"is",
"stopped"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L422-L425 |
delfick/harpoon | harpoon/ship/runner.py | Runner.stop_container | def stop_container(self, conf, fail_on_bad_exit=False, fail_reason=None, tag=None, remove_volumes=False):
"""Stop some container"""
stopped = False
container_id = conf.container_id
if not container_id:
return
container_name = conf.container_name
stopped, exit... | python | def stop_container(self, conf, fail_on_bad_exit=False, fail_reason=None, tag=None, remove_volumes=False):
"""Stop some container"""
stopped = False
container_id = conf.container_id
if not container_id:
return
container_name = conf.container_name
stopped, exit... | [
"def",
"stop_container",
"(",
"self",
",",
"conf",
",",
"fail_on_bad_exit",
"=",
"False",
",",
"fail_reason",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"remove_volumes",
"=",
"False",
")",
":",
"stopped",
"=",
"False",
"container_id",
"=",
"conf",
".",
... | Stop some container | [
"Stop",
"some",
"container"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L427-L503 |
delfick/harpoon | harpoon/ship/runner.py | Runner.get_exit_code | def get_exit_code(self, conf):
"""Determine how a container exited"""
for _ in until(timeout=0.5, step=0.1, silent=True):
try:
inspection = conf.harpoon.docker_api.inspect_container(conf.container_id)
if not isinstance(inspection, dict) or "State" not in inspe... | python | def get_exit_code(self, conf):
"""Determine how a container exited"""
for _ in until(timeout=0.5, step=0.1, silent=True):
try:
inspection = conf.harpoon.docker_api.inspect_container(conf.container_id)
if not isinstance(inspection, dict) or "State" not in inspe... | [
"def",
"get_exit_code",
"(",
"self",
",",
"conf",
")",
":",
"for",
"_",
"in",
"until",
"(",
"timeout",
"=",
"0.5",
",",
"step",
"=",
"0.1",
",",
"silent",
"=",
"True",
")",
":",
"try",
":",
"inspection",
"=",
"conf",
".",
"harpoon",
".",
"docker_ap... | Determine how a container exited | [
"Determine",
"how",
"a",
"container",
"exited"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L509-L519 |
delfick/harpoon | harpoon/ship/runner.py | Runner.find_bound_ports | def find_bound_ports(self, ports):
"""Find any ports that are already bound and complain about them"""
bound = []
for port in ports:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.bind((port.ip if port.ip is not NotSpecified else "127.0.0.1",... | python | def find_bound_ports(self, ports):
"""Find any ports that are already bound and complain about them"""
bound = []
for port in ports:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.bind((port.ip if port.ip is not NotSpecified else "127.0.0.1",... | [
"def",
"find_bound_ports",
"(",
"self",
",",
"ports",
")",
":",
"bound",
"=",
"[",
"]",
"for",
"port",
"in",
"ports",
":",
"s",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"try",
":",
"s",
".... | Find any ports that are already bound and complain about them | [
"Find",
"any",
"ports",
"that",
"are",
"already",
"bound",
"and",
"complain",
"about",
"them"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L521-L534 |
delfick/harpoon | harpoon/ship/runner.py | Runner.stage_run_intervention | def stage_run_intervention(self, conf, just_do_it=False):
"""Start an intervention!"""
if not conf.harpoon.interactive or conf.harpoon.no_intervention:
return
if just_do_it:
answer = 'y'
else:
hp.write_to(conf.harpoon.stdout, "!!!!\n")
hp.... | python | def stage_run_intervention(self, conf, just_do_it=False):
"""Start an intervention!"""
if not conf.harpoon.interactive or conf.harpoon.no_intervention:
return
if just_do_it:
answer = 'y'
else:
hp.write_to(conf.harpoon.stdout, "!!!!\n")
hp.... | [
"def",
"stage_run_intervention",
"(",
"self",
",",
"conf",
",",
"just_do_it",
"=",
"False",
")",
":",
"if",
"not",
"conf",
".",
"harpoon",
".",
"interactive",
"or",
"conf",
".",
"harpoon",
".",
"no_intervention",
":",
"return",
"if",
"just_do_it",
":",
"an... | Start an intervention! | [
"Start",
"an",
"intervention!"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L540-L555 |
delfick/harpoon | harpoon/ship/runner.py | Runner.intervention | def intervention(self, commit, conf):
"""Ask the user if they want to commit this container and run sh in it"""
if not conf.harpoon.interactive or conf.harpoon.no_intervention:
yield
return
hp.write_to(conf.harpoon.stdout, "!!!!\n")
hp.write_to(conf.harpoon.stdou... | python | def intervention(self, commit, conf):
"""Ask the user if they want to commit this container and run sh in it"""
if not conf.harpoon.interactive or conf.harpoon.no_intervention:
yield
return
hp.write_to(conf.harpoon.stdout, "!!!!\n")
hp.write_to(conf.harpoon.stdou... | [
"def",
"intervention",
"(",
"self",
",",
"commit",
",",
"conf",
")",
":",
"if",
"not",
"conf",
".",
"harpoon",
".",
"interactive",
"or",
"conf",
".",
"harpoon",
".",
"no_intervention",
":",
"yield",
"return",
"hp",
".",
"write_to",
"(",
"conf",
".",
"h... | Ask the user if they want to commit this container and run sh in it | [
"Ask",
"the",
"user",
"if",
"they",
"want",
"to",
"commit",
"this",
"container",
"and",
"run",
"sh",
"in",
"it"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L578-L594 |
delfick/harpoon | harpoon/ship/runner.py | Runner.commit_and_run | def commit_and_run(self, commit, conf, command="sh"):
"""Commit this container id and run the provided command in it and clean up afterwards"""
image_hash = None
try:
image_hash = conf.harpoon.docker_api.commit(commit)["Id"]
new_conf = conf.clone()
new_conf.b... | python | def commit_and_run(self, commit, conf, command="sh"):
"""Commit this container id and run the provided command in it and clean up afterwards"""
image_hash = None
try:
image_hash = conf.harpoon.docker_api.commit(commit)["Id"]
new_conf = conf.clone()
new_conf.b... | [
"def",
"commit_and_run",
"(",
"self",
",",
"commit",
",",
"conf",
",",
"command",
"=",
"\"sh\"",
")",
":",
"image_hash",
"=",
"None",
"try",
":",
"image_hash",
"=",
"conf",
".",
"harpoon",
".",
"docker_api",
".",
"commit",
"(",
"commit",
")",
"[",
"\"I... | Commit this container id and run the provided command in it and clean up afterwards | [
"Commit",
"this",
"container",
"id",
"and",
"run",
"the",
"provided",
"command",
"in",
"it",
"and",
"clean",
"up",
"afterwards"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/runner.py#L597-L627 |
mitsei/dlkit | dlkit/json_/__init__.py | MongoListener.initialize | def initialize(self, runtime):
"""Initialize this listener. Finds most recent timestamp"""
if self.is_alive():
raise IllegalState('notification thread is already initialized')
if not JSON_CLIENT.is_json_client_set() and runtime is not None:
JSON_CLIENT.set_json_client(run... | python | def initialize(self, runtime):
"""Initialize this listener. Finds most recent timestamp"""
if self.is_alive():
raise IllegalState('notification thread is already initialized')
if not JSON_CLIENT.is_json_client_set() and runtime is not None:
JSON_CLIENT.set_json_client(run... | [
"def",
"initialize",
"(",
"self",
",",
"runtime",
")",
":",
"if",
"self",
".",
"is_alive",
"(",
")",
":",
"raise",
"IllegalState",
"(",
"'notification thread is already initialized'",
")",
"if",
"not",
"JSON_CLIENT",
".",
"is_json_client_set",
"(",
")",
"and",
... | Initialize this listener. Finds most recent timestamp | [
"Initialize",
"this",
"listener",
".",
"Finds",
"most",
"recent",
"timestamp"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/__init__.py#L57-L72 |
mitsei/dlkit | dlkit/json_/__init__.py | MongoListener._notify_receiver | def _notify_receiver(self, receiver, params, doc):
"""Send notification to the receiver"""
verb = VMAP[doc['op']]
ns = doc['ns']
notification_id = Id(ns + 'Notification:' + str(ObjectId()) + '@' + params['authority'])
object_id = Id(ns + ':' + str(doc['o']['_id']) + '@' + params[... | python | def _notify_receiver(self, receiver, params, doc):
"""Send notification to the receiver"""
verb = VMAP[doc['op']]
ns = doc['ns']
notification_id = Id(ns + 'Notification:' + str(ObjectId()) + '@' + params['authority'])
object_id = Id(ns + ':' + str(doc['o']['_id']) + '@' + params[... | [
"def",
"_notify_receiver",
"(",
"self",
",",
"receiver",
",",
"params",
",",
"doc",
")",
":",
"verb",
"=",
"VMAP",
"[",
"doc",
"[",
"'op'",
"]",
"]",
"ns",
"=",
"doc",
"[",
"'ns'",
"]",
"notification_id",
"=",
"Id",
"(",
"ns",
"+",
"'Notification:'",... | Send notification to the receiver | [
"Send",
"notification",
"to",
"the",
"receiver"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/__init__.py#L74-L84 |
mitsei/dlkit | dlkit/json_/__init__.py | MongoListener._run_namespace | def _run_namespace(self, doc):
"""Run through all receivers related to the doc's namespace"""
for receiver in self.receivers[doc['ns']]:
params = self.receivers[doc['ns']][receiver]
if params[doc['op']]:
if params[doc['op']] is True or str(doc['o']['_id']) in para... | python | def _run_namespace(self, doc):
"""Run through all receivers related to the doc's namespace"""
for receiver in self.receivers[doc['ns']]:
params = self.receivers[doc['ns']][receiver]
if params[doc['op']]:
if params[doc['op']] is True or str(doc['o']['_id']) in para... | [
"def",
"_run_namespace",
"(",
"self",
",",
"doc",
")",
":",
"for",
"receiver",
"in",
"self",
".",
"receivers",
"[",
"doc",
"[",
"'ns'",
"]",
"]",
":",
"params",
"=",
"self",
".",
"receivers",
"[",
"doc",
"[",
"'ns'",
"]",
"]",
"[",
"receiver",
"]",... | Run through all receivers related to the doc's namespace | [
"Run",
"through",
"all",
"receivers",
"related",
"to",
"the",
"doc",
"s",
"namespace"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/__init__.py#L86-L99 |
mitsei/dlkit | dlkit/json_/__init__.py | MongoListener._retry | def _retry(self):
"""Deal with unacknowledged notifications."""
notifications_to_delete = []
for notification_id in self.notifications:
if datetime.datetime.utcnow() > self.notifications[notification_id]['ts'] + self._wait_period:
self._notify_receiver(
... | python | def _retry(self):
"""Deal with unacknowledged notifications."""
notifications_to_delete = []
for notification_id in self.notifications:
if datetime.datetime.utcnow() > self.notifications[notification_id]['ts'] + self._wait_period:
self._notify_receiver(
... | [
"def",
"_retry",
"(",
"self",
")",
":",
"notifications_to_delete",
"=",
"[",
"]",
"for",
"notification_id",
"in",
"self",
".",
"notifications",
":",
"if",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
">",
"self",
".",
"notifications",
"[",
"notifi... | Deal with unacknowledged notifications. | [
"Deal",
"with",
"unacknowledged",
"notifications",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/__init__.py#L101-L116 |
mitsei/dlkit | dlkit/json_/__init__.py | MongoListener.run | def run(self):
"""main control loop for thread"""
while True:
try:
cursor = JSON_CLIENT.json_client['local']['oplog.rs'].find(
{'ts': {'$gt': self.last_timestamp}})
except TypeError:
# filesystem, so .json_client is a bool and n... | python | def run(self):
"""main control loop for thread"""
while True:
try:
cursor = JSON_CLIENT.json_client['local']['oplog.rs'].find(
{'ts': {'$gt': self.last_timestamp}})
except TypeError:
# filesystem, so .json_client is a bool and n... | [
"def",
"run",
"(",
"self",
")",
":",
"while",
"True",
":",
"try",
":",
"cursor",
"=",
"JSON_CLIENT",
".",
"json_client",
"[",
"'local'",
"]",
"[",
"'oplog.rs'",
"]",
".",
"find",
"(",
"{",
"'ts'",
":",
"{",
"'$gt'",
":",
"self",
".",
"last_timestamp"... | main control loop for thread | [
"main",
"control",
"loop",
"for",
"thread"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/__init__.py#L118-L137 |
OnroerendErfgoed/crabpy_pyramid | crabpy_pyramid/utils.py | range_return | def range_return(request, items):
"""
Determine what range of objects to return.
Will check fot both `Range` and `X-Range` headers in the request and
set both `Content-Range` and 'X-Content-Range' headers.
:rtype: list
"""
if ('Range' in request.headers):
range = parse_range_header... | python | def range_return(request, items):
"""
Determine what range of objects to return.
Will check fot both `Range` and `X-Range` headers in the request and
set both `Content-Range` and 'X-Content-Range' headers.
:rtype: list
"""
if ('Range' in request.headers):
range = parse_range_header... | [
"def",
"range_return",
"(",
"request",
",",
"items",
")",
":",
"if",
"(",
"'Range'",
"in",
"request",
".",
"headers",
")",
":",
"range",
"=",
"parse_range_header",
"(",
"request",
".",
"headers",
"[",
"'Range'",
"]",
")",
"elif",
"'X-Range'",
"in",
"requ... | Determine what range of objects to return.
Will check fot both `Range` and `X-Range` headers in the request and
set both `Content-Range` and 'X-Content-Range' headers.
:rtype: list | [
"Determine",
"what",
"range",
"of",
"objects",
"to",
"return",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/utils.py#L39-L69 |
OnroerendErfgoed/crabpy_pyramid | crabpy_pyramid/utils.py | set_http_caching | def set_http_caching(request, gateway='crab', region='permanent'):
"""
Set an HTTP Cache Control header on a request.
:param pyramid.request.Request request: Request to set headers on.
:param str gateway: What gateway are we caching for? Defaults to `crab`.
:param str region: What caching region to... | python | def set_http_caching(request, gateway='crab', region='permanent'):
"""
Set an HTTP Cache Control header on a request.
:param pyramid.request.Request request: Request to set headers on.
:param str gateway: What gateway are we caching for? Defaults to `crab`.
:param str region: What caching region to... | [
"def",
"set_http_caching",
"(",
"request",
",",
"gateway",
"=",
"'crab'",
",",
"region",
"=",
"'permanent'",
")",
":",
"crabpy_exp",
"=",
"request",
".",
"registry",
".",
"settings",
".",
"get",
"(",
"'crabpy.%s.cache_config.%s.expiration_time'",
"%",
"(",
"gate... | Set an HTTP Cache Control header on a request.
:param pyramid.request.Request request: Request to set headers on.
:param str gateway: What gateway are we caching for? Defaults to `crab`.
:param str region: What caching region to use? Defaults to `permanent`.
:rtype: pyramid.request.Request | [
"Set",
"an",
"HTTP",
"Cache",
"Control",
"header",
"on",
"a",
"request",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/utils.py#L72-L86 |
mitsei/dlkit | dlkit/json_/osid/types.py | Generic.get_type_data | def get_type_data(self, name):
"""Return dictionary representation of type."""
return {
'authority': 'birdland.mit.edu',
'namespace': 'Genus Types',
'identifier': name,
'domain': 'Generic Types',
'display_name': self.generic_types[name] + ' Gen... | python | def get_type_data(self, name):
"""Return dictionary representation of type."""
return {
'authority': 'birdland.mit.edu',
'namespace': 'Genus Types',
'identifier': name,
'domain': 'Generic Types',
'display_name': self.generic_types[name] + ' Gen... | [
"def",
"get_type_data",
"(",
"self",
",",
"name",
")",
":",
"return",
"{",
"'authority'",
":",
"'birdland.mit.edu'",
",",
"'namespace'",
":",
"'Genus Types'",
",",
"'identifier'",
":",
"name",
",",
"'domain'",
":",
"'Generic Types'",
",",
"'display_name'",
":",
... | Return dictionary representation of type. | [
"Return",
"dictionary",
"representation",
"of",
"type",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/types.py#L20-L31 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._initialize_part_map | def _initialize_part_map(self):
"""Sets up assessmentPartMap with as much information as is initially available."""
self._my_map['assessmentParts'] = []
self._my_map['questions'] = []
item_ids = self._assessment_part.get_item_ids()
if item_ids.available():
# This is a... | python | def _initialize_part_map(self):
"""Sets up assessmentPartMap with as much information as is initially available."""
self._my_map['assessmentParts'] = []
self._my_map['questions'] = []
item_ids = self._assessment_part.get_item_ids()
if item_ids.available():
# This is a... | [
"def",
"_initialize_part_map",
"(",
"self",
")",
":",
"self",
".",
"_my_map",
"[",
"'assessmentParts'",
"]",
"=",
"[",
"]",
"self",
".",
"_my_map",
"[",
"'questions'",
"]",
"=",
"[",
"]",
"item_ids",
"=",
"self",
".",
"_assessment_part",
".",
"get_item_ids... | Sets up assessmentPartMap with as much information as is initially available. | [
"Sets",
"up",
"assessmentPartMap",
"with",
"as",
"much",
"information",
"as",
"is",
"initially",
"available",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L103-L116 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._get_part_map | def _get_part_map(self, part_id):
""" from self._my_map['assessmentParts'], return the one part map
with ID that matches the one passed in"""
return [p for p in self._my_map['assessmentParts']
if p['assessmentPartId'] == str(part_id)][0] | python | def _get_part_map(self, part_id):
""" from self._my_map['assessmentParts'], return the one part map
with ID that matches the one passed in"""
return [p for p in self._my_map['assessmentParts']
if p['assessmentPartId'] == str(part_id)][0] | [
"def",
"_get_part_map",
"(",
"self",
",",
"part_id",
")",
":",
"return",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"_my_map",
"[",
"'assessmentParts'",
"]",
"if",
"p",
"[",
"'assessmentPartId'",
"]",
"==",
"str",
"(",
"part_id",
")",
"]",
"[",
"0",
"]... | from self._my_map['assessmentParts'], return the one part map
with ID that matches the one passed in | [
"from",
"self",
".",
"_my_map",
"[",
"assessmentParts",
"]",
"return",
"the",
"one",
"part",
"map",
"with",
"ID",
"that",
"matches",
"the",
"one",
"passed",
"in"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L118-L122 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._insert_part_map | def _insert_part_map(self, part_map, index=-1):
""" add a part map to self._my_map['assessmentParts']"""
if index == -1:
self._my_map['assessmentParts'].append(part_map)
else:
self._my_map['assessmentParts'].insert(index, part_map) | python | def _insert_part_map(self, part_map, index=-1):
""" add a part map to self._my_map['assessmentParts']"""
if index == -1:
self._my_map['assessmentParts'].append(part_map)
else:
self._my_map['assessmentParts'].insert(index, part_map) | [
"def",
"_insert_part_map",
"(",
"self",
",",
"part_map",
",",
"index",
"=",
"-",
"1",
")",
":",
"if",
"index",
"==",
"-",
"1",
":",
"self",
".",
"_my_map",
"[",
"'assessmentParts'",
"]",
".",
"append",
"(",
"part_map",
")",
"else",
":",
"self",
".",
... | add a part map to self._my_map['assessmentParts'] | [
"add",
"a",
"part",
"map",
"to",
"self",
".",
"_my_map",
"[",
"assessmentParts",
"]"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L124-L129 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._load_simple_section_questions | def _load_simple_section_questions(self, item_ids):
"""For loading the simple section case (common)
just load the questions for the section, and insert the one part
into assessment part map.
"""
self._insert_part_map(
get_default_part_map(self._assessment_part_id,
... | python | def _load_simple_section_questions(self, item_ids):
"""For loading the simple section case (common)
just load the questions for the section, and insert the one part
into assessment part map.
"""
self._insert_part_map(
get_default_part_map(self._assessment_part_id,
... | [
"def",
"_load_simple_section_questions",
"(",
"self",
",",
"item_ids",
")",
":",
"self",
".",
"_insert_part_map",
"(",
"get_default_part_map",
"(",
"self",
".",
"_assessment_part_id",
",",
"0",
",",
"self",
".",
"_assessment_part",
".",
"are_items_sequential",
"(",
... | For loading the simple section case (common)
just load the questions for the section, and insert the one part
into assessment part map. | [
"For",
"loading",
"the",
"simple",
"section",
"case",
"(",
"common",
")"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L135-L157 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._save | def _save(self):
"""Saves the current state of this AssessmentSection to database.
Should be called every time the question map changes.
"""
collection = JSONClientValidated('assessment',
collection='AssessmentSection',
... | python | def _save(self):
"""Saves the current state of this AssessmentSection to database.
Should be called every time the question map changes.
"""
collection = JSONClientValidated('assessment',
collection='AssessmentSection',
... | [
"def",
"_save",
"(",
"self",
")",
":",
"collection",
"=",
"JSONClientValidated",
"(",
"'assessment'",
",",
"collection",
"=",
"'AssessmentSection'",
",",
"runtime",
"=",
"self",
".",
"_runtime",
")",
"if",
"'_id'",
"in",
"self",
".",
"_my_map",
":",
"# This ... | Saves the current state of this AssessmentSection to database.
Should be called every time the question map changes. | [
"Saves",
"the",
"current",
"state",
"of",
"this",
"AssessmentSection",
"to",
"database",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L159-L172 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._delete | def _delete(self):
"""Deletes this AssessmentSection from database.
Will be called by AssessmentTaken._delete() for clean-up purposes.
"""
collection = JSONClientValidated('assessment',
collection='AssessmentSection',
... | python | def _delete(self):
"""Deletes this AssessmentSection from database.
Will be called by AssessmentTaken._delete() for clean-up purposes.
"""
collection = JSONClientValidated('assessment',
collection='AssessmentSection',
... | [
"def",
"_delete",
"(",
"self",
")",
":",
"collection",
"=",
"JSONClientValidated",
"(",
"'assessment'",
",",
"collection",
"=",
"'AssessmentSection'",
",",
"runtime",
"=",
"self",
".",
"_runtime",
")",
"collection",
".",
"delete_one",
"(",
"{",
"'_id'",
":",
... | Deletes this AssessmentSection from database.
Will be called by AssessmentTaken._delete() for clean-up purposes. | [
"Deletes",
"this",
"AssessmentSection",
"from",
"database",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L174-L183 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.is_simple_section | def is_simple_section(self):
"""Tests if this section is simple (ie, items assigned directly to Section Part)."""
item_ids = self._get_assessment_part(self._assessment_part_id).get_item_ids()
if item_ids.available():
return True
return False | python | def is_simple_section(self):
"""Tests if this section is simple (ie, items assigned directly to Section Part)."""
item_ids = self._get_assessment_part(self._assessment_part_id).get_item_ids()
if item_ids.available():
return True
return False | [
"def",
"is_simple_section",
"(",
"self",
")",
":",
"item_ids",
"=",
"self",
".",
"_get_assessment_part",
"(",
"self",
".",
"_assessment_part_id",
")",
".",
"get_item_ids",
"(",
")",
"if",
"item_ids",
".",
"available",
"(",
")",
":",
"return",
"True",
"return... | Tests if this section is simple (ie, items assigned directly to Section Part). | [
"Tests",
"if",
"this",
"section",
"is",
"simple",
"(",
"ie",
"items",
"assigned",
"directly",
"to",
"Section",
"Part",
")",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L199-L204 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._get_assessment_part | def _get_assessment_part(self, part_id=None):
"""Gets an AssessmentPart given a part_id.
Returns this Section's own part if part_id is None.
Make this a private part, so that it doesn't collide with the AssessmentPart.get_assessment_part
method, which does not expect any arguments...
... | python | def _get_assessment_part(self, part_id=None):
"""Gets an AssessmentPart given a part_id.
Returns this Section's own part if part_id is None.
Make this a private part, so that it doesn't collide with the AssessmentPart.get_assessment_part
method, which does not expect any arguments...
... | [
"def",
"_get_assessment_part",
"(",
"self",
",",
"part_id",
"=",
"None",
")",
":",
"if",
"part_id",
"is",
"None",
":",
"return",
"self",
".",
"_assessment_part",
"if",
"part_id",
"not",
"in",
"self",
".",
"_assessment_parts",
":",
"lookup_session",
"=",
"sel... | Gets an AssessmentPart given a part_id.
Returns this Section's own part if part_id is None.
Make this a private part, so that it doesn't collide with the AssessmentPart.get_assessment_part
method, which does not expect any arguments... | [
"Gets",
"an",
"AssessmentPart",
"given",
"a",
"part_id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L206-L220 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._update_from_database | def _update_from_database(self):
"""Updates map to latest state in database.
Should be called prior to major object events to assure that an
assessment being taken on multiple devices are reasonably synchronized.
"""
collection = JSONClientValidated('assessment',
... | python | def _update_from_database(self):
"""Updates map to latest state in database.
Should be called prior to major object events to assure that an
assessment being taken on multiple devices are reasonably synchronized.
"""
collection = JSONClientValidated('assessment',
... | [
"def",
"_update_from_database",
"(",
"self",
")",
":",
"collection",
"=",
"JSONClientValidated",
"(",
"'assessment'",
",",
"collection",
"=",
"'AssessmentSection'",
",",
"runtime",
"=",
"self",
".",
"_runtime",
")",
"self",
".",
"_my_map",
"=",
"collection",
"."... | Updates map to latest state in database.
Should be called prior to major object events to assure that an
assessment being taken on multiple devices are reasonably synchronized. | [
"Updates",
"map",
"to",
"latest",
"state",
"in",
"database",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L222-L232 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._update_questions | def _update_questions(self):
"""Updates questions known to this Section"""
if self.is_simple_section():
return # we don't need to go through any this for simple sections
# ideally, we would update the parts map and questions list
# at the same time as _get_parts(), to not ru... | python | def _update_questions(self):
"""Updates questions known to this Section"""
if self.is_simple_section():
return # we don't need to go through any this for simple sections
# ideally, we would update the parts map and questions list
# at the same time as _get_parts(), to not ru... | [
"def",
"_update_questions",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_simple_section",
"(",
")",
":",
"return",
"# we don't need to go through any this for simple sections",
"# ideally, we would update the parts map and questions list",
"# at the same time as _get_parts(), to not... | Updates questions known to this Section | [
"Updates",
"questions",
"known",
"to",
"this",
"Section"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L234-L247 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._update_assessment_parts_map | def _update_assessment_parts_map(self, part_list):
"""Updates the part map.
Called before question list gets updated if it is determined that the
sections assessmentPart map is out of date with the current part list.
"""
for part in part_list:
# perhaps look for a "... | python | def _update_assessment_parts_map(self, part_list):
"""Updates the part map.
Called before question list gets updated if it is determined that the
sections assessmentPart map is out of date with the current part list.
"""
for part in part_list:
# perhaps look for a "... | [
"def",
"_update_assessment_parts_map",
"(",
"self",
",",
"part_list",
")",
":",
"for",
"part",
"in",
"part_list",
":",
"# perhaps look for a \"level offset\"?",
"level",
"=",
"part",
".",
"_level_in_section",
"# plus or minus \"level offset\"?",
"if",
"str",
"(",
"part"... | Updates the part map.
Called before question list gets updated if it is determined that the
sections assessmentPart map is out of date with the current part list. | [
"Updates",
"the",
"part",
"map",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L283-L296 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._get_question_map | def _get_question_map(self, question_id):
"""get question map from questions matching question_id
This can make sense of both Section assigned Ids or normal Question/Item Ids
"""
if question_id.get_authority() == ASSESSMENT_AUTHORITY:
key = '_id'
match_value = O... | python | def _get_question_map(self, question_id):
"""get question map from questions matching question_id
This can make sense of both Section assigned Ids or normal Question/Item Ids
"""
if question_id.get_authority() == ASSESSMENT_AUTHORITY:
key = '_id'
match_value = O... | [
"def",
"_get_question_map",
"(",
"self",
",",
"question_id",
")",
":",
"if",
"question_id",
".",
"get_authority",
"(",
")",
"==",
"ASSESSMENT_AUTHORITY",
":",
"key",
"=",
"'_id'",
"match_value",
"=",
"ObjectId",
"(",
"question_id",
".",
"get_identifier",
"(",
... | get question map from questions matching question_id
This can make sense of both Section assigned Ids or normal Question/Item Ids | [
"get",
"question",
"map",
"from",
"questions",
"matching",
"question_id"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L421-L436 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_question_ids_for_assessment_part | def get_question_ids_for_assessment_part(self, assessment_part_id):
"""convenience method returns unique question ids associated with an assessment_part_id"""
question_ids = []
for question_map in self._my_map['questions']:
if question_map['assessmentPartId'] == str(assessment_part_i... | python | def get_question_ids_for_assessment_part(self, assessment_part_id):
"""convenience method returns unique question ids associated with an assessment_part_id"""
question_ids = []
for question_map in self._my_map['questions']:
if question_map['assessmentPartId'] == str(assessment_part_i... | [
"def",
"get_question_ids_for_assessment_part",
"(",
"self",
",",
"assessment_part_id",
")",
":",
"question_ids",
"=",
"[",
"]",
"for",
"question_map",
"in",
"self",
".",
"_my_map",
"[",
"'questions'",
"]",
":",
"if",
"question_map",
"[",
"'assessmentPartId'",
"]",... | convenience method returns unique question ids associated with an assessment_part_id | [
"convenience",
"method",
"returns",
"unique",
"question",
"ids",
"associated",
"with",
"an",
"assessment_part_id"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L438-L444 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_item_ids_for_assessment_part | def get_item_ids_for_assessment_part(self, assessment_part_id):
"""convenience method returns item ids associated with an assessment_part_id"""
item_ids = []
for question_map in self._my_map['questions']:
if question_map['assessmentPartId'] == str(assessment_part_id):
... | python | def get_item_ids_for_assessment_part(self, assessment_part_id):
"""convenience method returns item ids associated with an assessment_part_id"""
item_ids = []
for question_map in self._my_map['questions']:
if question_map['assessmentPartId'] == str(assessment_part_id):
... | [
"def",
"get_item_ids_for_assessment_part",
"(",
"self",
",",
"assessment_part_id",
")",
":",
"item_ids",
"=",
"[",
"]",
"for",
"question_map",
"in",
"self",
".",
"_my_map",
"[",
"'questions'",
"]",
":",
"if",
"question_map",
"[",
"'assessmentPartId'",
"]",
"==",... | convenience method returns item ids associated with an assessment_part_id | [
"convenience",
"method",
"returns",
"item",
"ids",
"associated",
"with",
"an",
"assessment_part_id"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L446-L452 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection._get_item | def _get_item(self, question_id):
"""we need a middle-man method to convert the unique "assessment-session"
authority question_ids into "real" itemIds
BUT this also has to return the "magic" item, so we can't rely
on
question = self.get_question(question_id)
... | python | def _get_item(self, question_id):
"""we need a middle-man method to convert the unique "assessment-session"
authority question_ids into "real" itemIds
BUT this also has to return the "magic" item, so we can't rely
on
question = self.get_question(question_id)
... | [
"def",
"_get_item",
"(",
"self",
",",
"question_id",
")",
":",
"question_map",
"=",
"self",
".",
"_get_question_map",
"(",
"question_id",
")",
"# Throws NotFound()",
"real_question_id",
"=",
"Id",
"(",
"question_map",
"[",
"'questionId'",
"]",
")",
"return",
"se... | we need a middle-man method to convert the unique "assessment-session"
authority question_ids into "real" itemIds
BUT this also has to return the "magic" item, so we can't rely
on
question = self.get_question(question_id)
ils = self._get_item_lookup_session()
... | [
"we",
"need",
"a",
"middle",
"-",
"man",
"method",
"to",
"convert",
"the",
"unique",
"assessment",
"-",
"session",
"authority",
"question_ids",
"into",
"real",
"itemIds",
"BUT",
"this",
"also",
"has",
"to",
"return",
"the",
"magic",
"item",
"so",
"we",
"ca... | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L464-L475 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_questions | def get_questions(self, answered=None, honor_sequential=True, update=True):
"""gets all available questions for this section
if answered == False: only return next unanswered question
if answered == True: only return next answered question
if answered in None: return next question wheth... | python | def get_questions(self, answered=None, honor_sequential=True, update=True):
"""gets all available questions for this section
if answered == False: only return next unanswered question
if answered == True: only return next answered question
if answered in None: return next question wheth... | [
"def",
"get_questions",
"(",
"self",
",",
"answered",
"=",
"None",
",",
"honor_sequential",
"=",
"True",
",",
"update",
"=",
"True",
")",
":",
"def",
"update_question_list",
"(",
")",
":",
"\"\"\"Supportive function to aid readability of _get_questions.\"\"\"",
"lates... | gets all available questions for this section
if answered == False: only return next unanswered question
if answered == True: only return next answered question
if answered in None: return next question whether answered or not
if honor_sequential == True: only return questions if sectio... | [
"gets",
"all",
"available",
"questions",
"for",
"this",
"section"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L494-L529 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_next_question | def get_next_question(self, question_id, answered=None, reverse=False, honor_sequential=True):
"""Inspects question map to return the next available question.
if answered == False: only return next unanswered question
if answered == True: only return next answered question
if answered i... | python | def get_next_question(self, question_id, answered=None, reverse=False, honor_sequential=True):
"""Inspects question map to return the next available question.
if answered == False: only return next unanswered question
if answered == True: only return next answered question
if answered i... | [
"def",
"get_next_question",
"(",
"self",
",",
"question_id",
",",
"answered",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"honor_sequential",
"=",
"True",
")",
":",
"self",
".",
"_update_questions",
"(",
")",
"# Make sure questions list is current",
"question_... | Inspects question map to return the next available question.
if answered == False: only return next unanswered question
if answered == True: only return next answered question
if answered in None: return next question whether answered or not
if reverse == True: go backwards - effectivel... | [
"Inspects",
"question",
"map",
"to",
"return",
"the",
"next",
"available",
"question",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L575-L608 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.submit_response | def submit_response(self, question_id, answer_form=None):
"""Updates assessmentParts map to insert an item response.
answer_form is None indicates that the current response is to be cleared
"""
if answer_form is None:
response = {'missingResponse': NULL_RESPONSE,
... | python | def submit_response(self, question_id, answer_form=None):
"""Updates assessmentParts map to insert an item response.
answer_form is None indicates that the current response is to be cleared
"""
if answer_form is None:
response = {'missingResponse': NULL_RESPONSE,
... | [
"def",
"submit_response",
"(",
"self",
",",
"question_id",
",",
"answer_form",
"=",
"None",
")",
":",
"if",
"answer_form",
"is",
"None",
":",
"response",
"=",
"{",
"'missingResponse'",
":",
"NULL_RESPONSE",
",",
"'itemId'",
":",
"str",
"(",
"question_id",
")... | Updates assessmentParts map to insert an item response.
answer_form is None indicates that the current response is to be cleared | [
"Updates",
"assessmentParts",
"map",
"to",
"insert",
"an",
"item",
"response",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L610-L634 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_response | def get_response(self, question_id):
"""Gets the response for question_id"""
question_map = self._get_question_map(question_id) # will raise NotFound()
return self._get_response_from_question_map(question_map) | python | def get_response(self, question_id):
"""Gets the response for question_id"""
question_map = self._get_question_map(question_id) # will raise NotFound()
return self._get_response_from_question_map(question_map) | [
"def",
"get_response",
"(",
"self",
",",
"question_id",
")",
":",
"question_map",
"=",
"self",
".",
"_get_question_map",
"(",
"question_id",
")",
"# will raise NotFound()",
"return",
"self",
".",
"_get_response_from_question_map",
"(",
"question_map",
")"
] | Gets the response for question_id | [
"Gets",
"the",
"response",
"for",
"question_id"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L636-L639 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_responses | def get_responses(self):
"""Gets list of the latest responses"""
response_list = []
for question_map in self._my_map['questions']:
response_list.append(self._get_response_from_question_map(question_map))
return ResponseList(response_list) | python | def get_responses(self):
"""Gets list of the latest responses"""
response_list = []
for question_map in self._my_map['questions']:
response_list.append(self._get_response_from_question_map(question_map))
return ResponseList(response_list) | [
"def",
"get_responses",
"(",
"self",
")",
":",
"response_list",
"=",
"[",
"]",
"for",
"question_map",
"in",
"self",
".",
"_my_map",
"[",
"'questions'",
"]",
":",
"response_list",
".",
"append",
"(",
"self",
".",
"_get_response_from_question_map",
"(",
"questio... | Gets list of the latest responses | [
"Gets",
"list",
"of",
"the",
"latest",
"responses"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L641-L646 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.is_question_answered | def is_question_answered(self, question_id):
"""has the question matching item_id been answered and not skipped"""
question_map = self._get_question_map(question_id) # will raise NotFound()
if 'missingResponse' in question_map['responses'][0]:
return False
else:
... | python | def is_question_answered(self, question_id):
"""has the question matching item_id been answered and not skipped"""
question_map = self._get_question_map(question_id) # will raise NotFound()
if 'missingResponse' in question_map['responses'][0]:
return False
else:
... | [
"def",
"is_question_answered",
"(",
"self",
",",
"question_id",
")",
":",
"question_map",
"=",
"self",
".",
"_get_question_map",
"(",
"question_id",
")",
"# will raise NotFound()",
"if",
"'missingResponse'",
"in",
"question_map",
"[",
"'responses'",
"]",
"[",
"0",
... | has the question matching item_id been answered and not skipped | [
"has",
"the",
"question",
"matching",
"item_id",
"been",
"answered",
"and",
"not",
"skipped"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L660-L666 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.is_feedback_available | def is_feedback_available(self, question_id):
"""is feedback available for item"""
response = self.get_response(question_id)
item = self._get_item(question_id)
if response.is_answered():
return item.is_feedback_available_for_response(response)
return item.is_feedback_... | python | def is_feedback_available(self, question_id):
"""is feedback available for item"""
response = self.get_response(question_id)
item = self._get_item(question_id)
if response.is_answered():
return item.is_feedback_available_for_response(response)
return item.is_feedback_... | [
"def",
"is_feedback_available",
"(",
"self",
",",
"question_id",
")",
":",
"response",
"=",
"self",
".",
"get_response",
"(",
"question_id",
")",
"item",
"=",
"self",
".",
"_get_item",
"(",
"question_id",
")",
"if",
"response",
".",
"is_answered",
"(",
")",
... | is feedback available for item | [
"is",
"feedback",
"available",
"for",
"item"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L668-L674 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_feedback | def get_feedback(self, question_id):
"""get feedback for item"""
response = self.get_response(question_id)
item = self._get_item(response.get_item_id())
if response.is_answered():
try:
return item.get_feedback_for_response(response)
except errors.I... | python | def get_feedback(self, question_id):
"""get feedback for item"""
response = self.get_response(question_id)
item = self._get_item(response.get_item_id())
if response.is_answered():
try:
return item.get_feedback_for_response(response)
except errors.I... | [
"def",
"get_feedback",
"(",
"self",
",",
"question_id",
")",
":",
"response",
"=",
"self",
".",
"get_response",
"(",
"question_id",
")",
"item",
"=",
"self",
".",
"_get_item",
"(",
"response",
".",
"get_item_id",
"(",
")",
")",
"if",
"response",
".",
"is... | get feedback for item | [
"get",
"feedback",
"for",
"item"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L676-L686 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_confused_learning_objective_ids | def get_confused_learning_objective_ids(self, question_id):
"""get confused objective ids available for the question"""
response = self.get_response(question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.get_confused_learning_obj... | python | def get_confused_learning_objective_ids(self, question_id):
"""get confused objective ids available for the question"""
response = self.get_response(question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.get_confused_learning_obj... | [
"def",
"get_confused_learning_objective_ids",
"(",
"self",
",",
"question_id",
")",
":",
"response",
"=",
"self",
".",
"get_response",
"(",
"question_id",
")",
"if",
"response",
".",
"is_answered",
"(",
")",
":",
"item",
"=",
"self",
".",
"_get_item",
"(",
"... | get confused objective ids available for the question | [
"get",
"confused",
"objective",
"ids",
"available",
"for",
"the",
"question"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L688-L694 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.is_correctness_available | def is_correctness_available(self, question_id):
"""is a measure of correctness available for the question"""
response = self.get_response(question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.is_correctness_available_for_respon... | python | def is_correctness_available(self, question_id):
"""is a measure of correctness available for the question"""
response = self.get_response(question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.is_correctness_available_for_respon... | [
"def",
"is_correctness_available",
"(",
"self",
",",
"question_id",
")",
":",
"response",
"=",
"self",
".",
"get_response",
"(",
"question_id",
")",
"if",
"response",
".",
"is_answered",
"(",
")",
":",
"item",
"=",
"self",
".",
"_get_item",
"(",
"response",
... | is a measure of correctness available for the question | [
"is",
"a",
"measure",
"of",
"correctness",
"available",
"for",
"the",
"question"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L696-L702 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.is_correct | def is_correct(self, question_id):
"""is the question answered correctly"""
response = self.get_response(question_id=question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.is_response_correct(response)
raise errors.Illega... | python | def is_correct(self, question_id):
"""is the question answered correctly"""
response = self.get_response(question_id=question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.is_response_correct(response)
raise errors.Illega... | [
"def",
"is_correct",
"(",
"self",
",",
"question_id",
")",
":",
"response",
"=",
"self",
".",
"get_response",
"(",
"question_id",
"=",
"question_id",
")",
"if",
"response",
".",
"is_answered",
"(",
")",
":",
"item",
"=",
"self",
".",
"_get_item",
"(",
"r... | is the question answered correctly | [
"is",
"the",
"question",
"answered",
"correctly"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L704-L710 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.get_correctness | def get_correctness(self, question_id):
"""get measure of correctness for the question"""
response = self.get_response(question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.get_correctness_for_response(response)
raise er... | python | def get_correctness(self, question_id):
"""get measure of correctness for the question"""
response = self.get_response(question_id)
if response.is_answered():
item = self._get_item(response.get_item_id())
return item.get_correctness_for_response(response)
raise er... | [
"def",
"get_correctness",
"(",
"self",
",",
"question_id",
")",
":",
"response",
"=",
"self",
".",
"get_response",
"(",
"question_id",
")",
"if",
"response",
".",
"is_answered",
"(",
")",
":",
"item",
"=",
"self",
".",
"_get_item",
"(",
"response",
".",
... | get measure of correctness for the question | [
"get",
"measure",
"of",
"correctness",
"for",
"the",
"question"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L712-L718 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.finish | def finish(self):
"""Declare this section finished"""
self._my_map['over'] = True # finished == over?
self._my_map['completionTime'] = DateTime.utcnow()
self._save() | python | def finish(self):
"""Declare this section finished"""
self._my_map['over'] = True # finished == over?
self._my_map['completionTime'] = DateTime.utcnow()
self._save() | [
"def",
"finish",
"(",
"self",
")",
":",
"self",
".",
"_my_map",
"[",
"'over'",
"]",
"=",
"True",
"# finished == over?",
"self",
".",
"_my_map",
"[",
"'completionTime'",
"]",
"=",
"DateTime",
".",
"utcnow",
"(",
")",
"self",
".",
"_save",
"(",
")"
] | Declare this section finished | [
"Declare",
"this",
"section",
"finished"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L720-L724 |
mitsei/dlkit | dlkit/json_/assessment/mixins.py | AssessmentSessionSection.is_complete | def is_complete(self):
"""Check all Questions for completeness
For now, completeness simply means that all questions have been
responded to and not skipped or cleared.
"""
self._update_questions() # Make sure questions list is current
for question_map in self._my_map['... | python | def is_complete(self):
"""Check all Questions for completeness
For now, completeness simply means that all questions have been
responded to and not skipped or cleared.
"""
self._update_questions() # Make sure questions list is current
for question_map in self._my_map['... | [
"def",
"is_complete",
"(",
"self",
")",
":",
"self",
".",
"_update_questions",
"(",
")",
"# Make sure questions list is current",
"for",
"question_map",
"in",
"self",
".",
"_my_map",
"[",
"'questions'",
"]",
":",
"if",
"'missingResponse'",
"in",
"question_map",
"[... | Check all Questions for completeness
For now, completeness simply means that all questions have been
responded to and not skipped or cleared. | [
"Check",
"all",
"Questions",
"for",
"completeness"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/mixins.py#L732-L743 |
cnelson/python-fleet | fleet/v1/objects/unit.py | Unit._set_options_from_file | def _set_options_from_file(self, file_handle):
"""Parses a unit file and updates self._data['options']
Args:
file_handle (file): a file-like object (supporting read()) containing a unit
Returns:
True: The file was successfuly parsed and options were updated
Rai... | python | def _set_options_from_file(self, file_handle):
"""Parses a unit file and updates self._data['options']
Args:
file_handle (file): a file-like object (supporting read()) containing a unit
Returns:
True: The file was successfuly parsed and options were updated
Rai... | [
"def",
"_set_options_from_file",
"(",
"self",
",",
"file_handle",
")",
":",
"# TODO: Find a library to handle this unit file parsing",
"# Can't use configparser, it doesn't handle multiple entries for the same key in the same section",
"# This is terribly naive",
"# build our output here",
"... | Parses a unit file and updates self._data['options']
Args:
file_handle (file): a file-like object (supporting read()) containing a unit
Returns:
True: The file was successfuly parsed and options were updated
Raises:
IOError: from_file was specified and it d... | [
"Parses",
"a",
"unit",
"file",
"and",
"updates",
"self",
".",
"_data",
"[",
"options",
"]"
] | train | https://github.com/cnelson/python-fleet/blob/a11dcd8bb3986d1d8f0af90d2da7399c9cc54b4d/fleet/v1/objects/unit.py#L134-L224 |
cnelson/python-fleet | fleet/v1/objects/unit.py | Unit.add_option | def add_option(self, section, name, value):
"""Add an option to a section of the unit file
Args:
section (str): The name of the section, If it doesn't exist it will be created
name (str): The name of the option to add
value (str): The value of the option
Ret... | python | def add_option(self, section, name, value):
"""Add an option to a section of the unit file
Args:
section (str): The name of the section, If it doesn't exist it will be created
name (str): The name of the option to add
value (str): The value of the option
Ret... | [
"def",
"add_option",
"(",
"self",
",",
"section",
",",
"name",
",",
"value",
")",
":",
"# Don't allow updating units we loaded from fleet, it's not supported",
"if",
"self",
".",
"_is_live",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"'Submitted units cannot update th... | Add an option to a section of the unit file
Args:
section (str): The name of the section, If it doesn't exist it will be created
name (str): The name of the option to add
value (str): The value of the option
Returns:
True: The item was added | [
"Add",
"an",
"option",
"to",
"a",
"section",
"of",
"the",
"unit",
"file"
] | train | https://github.com/cnelson/python-fleet/blob/a11dcd8bb3986d1d8f0af90d2da7399c9cc54b4d/fleet/v1/objects/unit.py#L241-L266 |
cnelson/python-fleet | fleet/v1/objects/unit.py | Unit.remove_option | def remove_option(self, section, name, value=None):
"""Remove an option from a unit
Args:
section (str): The section to remove from.
name (str): The item to remove.
value (str, optional): If specified, only the option matching this value will be removed
... | python | def remove_option(self, section, name, value=None):
"""Remove an option from a unit
Args:
section (str): The section to remove from.
name (str): The item to remove.
value (str, optional): If specified, only the option matching this value will be removed
... | [
"def",
"remove_option",
"(",
"self",
",",
"section",
",",
"name",
",",
"value",
"=",
"None",
")",
":",
"# Don't allow updating units we loaded from fleet, it's not supported",
"if",
"self",
".",
"_is_live",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"'Submitted un... | Remove an option from a unit
Args:
section (str): The section to remove from.
name (str): The item to remove.
value (str, optional): If specified, only the option matching this value will be removed
If not specified, all options with ``name... | [
"Remove",
"an",
"option",
"from",
"a",
"unit"
] | train | https://github.com/cnelson/python-fleet/blob/a11dcd8bb3986d1d8f0af90d2da7399c9cc54b4d/fleet/v1/objects/unit.py#L268-L302 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.