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_/commenting/sessions.py | CommentLookupSession.get_comments | def get_comments(self):
"""Gets all comments.
return: (osid.commenting.CommentList) - a list of comments
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.*
"""... | python | def get_comments(self):
"""Gets all comments.
return: (osid.commenting.CommentList) - a list of comments
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.*
"""... | [
"def",
"get_comments",
"(",
"self",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'commenting'",
",",
"collection",
"=",... | Gets all comments.
return: (osid.commenting.CommentList) - a list of comments
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"all",
"comments",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L651-L667 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentQuerySession.get_comments_by_query | def get_comments_by_query(self, comment_query):
"""Gets a list of comments matching the given search.
arg: comment_query (osid.commenting.CommentQuery): the search
query array
return: (osid.commenting.CommentList) - the returned
``CommentList``
raise: ... | python | def get_comments_by_query(self, comment_query):
"""Gets a list of comments matching the given search.
arg: comment_query (osid.commenting.CommentQuery): the search
query array
return: (osid.commenting.CommentList) - the returned
``CommentList``
raise: ... | [
"def",
"get_comments_by_query",
"(",
"self",
",",
"comment_query",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceQuerySession.get_resources_by_query",
"and_list",
"=",
"list",
"(",
")",
"or_list",
"=",
"list",
"(",
")",
"for",
"term",
"in",
"comm... | Gets a list of comments matching the given search.
arg: comment_query (osid.commenting.CommentQuery): the search
query array
return: (osid.commenting.CommentList) - the returned
``CommentList``
raise: NullArgument - ``comment_query`` is ``null``
raise... | [
"Gets",
"a",
"list",
"of",
"comments",
"matching",
"the",
"given",
"search",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L784-L824 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentAdminSession.get_comment_form_for_create | def get_comment_form_for_create(self, reference_id, comment_record_types):
"""Gets the comment form for creating new comments.
A new form should be requested for each create transaction.
arg: reference_id (osid.id.Id): the ``Id`` for the reference
object
arg: comm... | python | def get_comment_form_for_create(self, reference_id, comment_record_types):
"""Gets the comment form for creating new comments.
A new form should be requested for each create transaction.
arg: reference_id (osid.id.Id): the ``Id`` for the reference
object
arg: comm... | [
"def",
"get_comment_form_for_create",
"(",
"self",
",",
"reference_id",
",",
"comment_record_types",
")",
":",
"# Implemented from template for",
"# osid.relationship.CommentAdminSession.get_comment_form_for_create_template",
"# These really need to be in module imports:",
"if",
"not",
... | Gets the comment form for creating new comments.
A new form should be requested for each create transaction.
arg: reference_id (osid.id.Id): the ``Id`` for the reference
object
arg: comment_record_types (osid.type.Type[]): array of
comment record types
... | [
"Gets",
"the",
"comment",
"form",
"for",
"creating",
"new",
"comments",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L951-L999 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentAdminSession.create_comment | def create_comment(self, comment_form):
"""Creates a new ``Comment``.
arg: comment_form (osid.commenting.CommentForm): the form for
this ``Comment``
return: (osid.commenting.Comment) - the new ``Comment``
raise: IllegalState - ``comment_form`` already used in a creat... | python | def create_comment(self, comment_form):
"""Creates a new ``Comment``.
arg: comment_form (osid.commenting.CommentForm): the form for
this ``Comment``
return: (osid.commenting.Comment) - the new ``Comment``
raise: IllegalState - ``comment_form`` already used in a creat... | [
"def",
"create_comment",
"(",
"self",
",",
"comment_form",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.create_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'commenting'",
",",
"collection",
"=",
"'Comment'",
",",
"r... | Creates a new ``Comment``.
arg: comment_form (osid.commenting.CommentForm): the form for
this ``Comment``
return: (osid.commenting.Comment) - the new ``Comment``
raise: IllegalState - ``comment_form`` already used in a create
transaction
raise: Inval... | [
"Creates",
"a",
"new",
"Comment",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1002-L1044 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentAdminSession.update_comment | def update_comment(self, comment_form):
"""Updates an existing comment.
arg: comment_form (osid.commenting.CommentForm): the form
containing the elements to be updated
raise: IllegalState - ``comment_form`` already used in an
update transaction
raise:... | python | def update_comment(self, comment_form):
"""Updates an existing comment.
arg: comment_form (osid.commenting.CommentForm): the form
containing the elements to be updated
raise: IllegalState - ``comment_form`` already used in an
update transaction
raise:... | [
"def",
"update_comment",
"(",
"self",
",",
"comment_form",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.update_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'commenting'",
",",
"collection",
"=",
"'Comment'",
",",
"r... | Updates an existing comment.
arg: comment_form (osid.commenting.CommentForm): the form
containing the elements to be updated
raise: IllegalState - ``comment_form`` already used in an
update transaction
raise: InvalidArgument - the form contains an invalid va... | [
"Updates",
"an",
"existing",
"comment",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1100-L1140 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentAdminSession.delete_comment | def delete_comment(self, comment_id):
"""Deletes a ``Comment``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
to remove
raise: NotFound - ``comment_id`` not found
raise: NullArgument - ``comment_id`` is ``null``
raise: OperationFailed - unable... | python | def delete_comment(self, comment_id):
"""Deletes a ``Comment``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
to remove
raise: NotFound - ``comment_id`` not found
raise: NullArgument - ``comment_id`` is ``null``
raise: OperationFailed - unable... | [
"def",
"delete_comment",
"(",
"self",
",",
"comment_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.delete_resource_template",
"collection",
"=",
"JSONClientValidated",
"(",
"'commenting'",
",",
"collection",
"=",
"'Comment'",
",",
"run... | Deletes a ``Comment``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
to remove
raise: NotFound - ``comment_id`` not found
raise: NullArgument - ``comment_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDe... | [
"Deletes",
"a",
"Comment",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1163-L1187 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentAdminSession.alias_comment | def alias_comment(self, comment_id, alias_id):
"""Adds an ``Id`` to a ``Comment`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Comment`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to anoth... | python | def alias_comment(self, comment_id, alias_id):
"""Adds an ``Id`` to a ``Comment`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Comment`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to anoth... | [
"def",
"alias_comment",
"(",
"self",
",",
"comment_id",
",",
"alias_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceAdminSession.alias_resources_template",
"self",
".",
"_alias_id",
"(",
"primary_id",
"=",
"comment_id",
",",
"equivalent_id",
"=",
... | Adds an ``Id`` to a ``Comment`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Comment`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to another comment, it is
reassigned to the given comment ... | [
"Adds",
"an",
"Id",
"to",
"a",
"Comment",
"for",
"the",
"purpose",
"of",
"creating",
"compatibility",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1208-L1229 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookSession.get_comment_ids_by_book | def get_comment_ids_by_book(self, book_id):
"""Gets the list of Comment Ids associated with a ``Book``.
arg: book_id (osid.id.Id): ``Id`` of a ``Book``.
return: (osid.id.IdList) - list of related comment ``Ids``
raise: NotFound - ``book_id`` is not found
raise: NullArgument... | python | def get_comment_ids_by_book(self, book_id):
"""Gets the list of Comment Ids associated with a ``Book``.
arg: book_id (osid.id.Id): ``Id`` of a ``Book``.
return: (osid.id.IdList) - list of related comment ``Ids``
raise: NotFound - ``book_id`` is not found
raise: NullArgument... | [
"def",
"get_comment_ids_by_book",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resource_ids_by_bin",
"id_list",
"=",
"[",
"]",
"for",
"comment",
"in",
"self",
".",
"get_comments_by_book",
"(",
"book_id",
... | Gets the list of Comment Ids associated with a ``Book``.
arg: book_id (osid.id.Id): ``Id`` of a ``Book``.
return: (osid.id.IdList) - list of related comment ``Ids``
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFai... | [
"Gets",
"the",
"list",
"of",
"Comment",
"Ids",
"associated",
"with",
"a",
"Book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1304-L1321 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookSession.get_comments_by_book | def get_comments_by_book(self, book_id):
"""Gets the list of ``Comments`` associated with a ``Book``.
arg: book_id (osid.id.Id): ``Id`` of a ``Book``
return: (osid.commenting.CommentList) - list of related comments
raise: NotFound - ``book_id`` is not found
raise: NullArgum... | python | def get_comments_by_book(self, book_id):
"""Gets the list of ``Comments`` associated with a ``Book``.
arg: book_id (osid.id.Id): ``Id`` of a ``Book``
return: (osid.commenting.CommentList) - list of related comments
raise: NotFound - ``book_id`` is not found
raise: NullArgum... | [
"def",
"get_comments_by_book",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resources_by_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'COMMENTING'",
",",
"local",
"=",
"True",
")",
"look... | Gets the list of ``Comments`` associated with a ``Book``.
arg: book_id (osid.id.Id): ``Id`` of a ``Book``
return: (osid.commenting.CommentList) - list of related comments
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: Operat... | [
"Gets",
"the",
"list",
"of",
"Comments",
"associated",
"with",
"a",
"Book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1324-L1341 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookSession.get_comment_ids_by_books | def get_comment_ids_by_books(self, book_ids):
"""Gets the list of ``Comment Ids`` corresponding to a list of ``Book`` objects.
arg: book_ids (osid.id.IdList): list of book ``Ids``
return: (osid.id.IdList) - list of comment ``Ids``
raise: NullArgument - ``book_ids`` is ``null``
... | python | def get_comment_ids_by_books(self, book_ids):
"""Gets the list of ``Comment Ids`` corresponding to a list of ``Book`` objects.
arg: book_ids (osid.id.IdList): list of book ``Ids``
return: (osid.id.IdList) - list of comment ``Ids``
raise: NullArgument - ``book_ids`` is ``null``
... | [
"def",
"get_comment_ids_by_books",
"(",
"self",
",",
"book_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resource_ids_by_bins",
"id_list",
"=",
"[",
"]",
"for",
"comment",
"in",
"self",
".",
"get_comments_by_books",
"(",
"book_id... | Gets the list of ``Comment Ids`` corresponding to a list of ``Book`` objects.
arg: book_ids (osid.id.IdList): list of book ``Ids``
return: (osid.id.IdList) - list of comment ``Ids``
raise: NullArgument - ``book_ids`` is ``null``
raise: OperationFailed - unable to complete request
... | [
"Gets",
"the",
"list",
"of",
"Comment",
"Ids",
"corresponding",
"to",
"a",
"list",
"of",
"Book",
"objects",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1344-L1360 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookSession.get_comments_by_books | def get_comments_by_books(self, book_ids):
"""Gets the list of ``Comments`` corresponding to a list of ``Books``.
arg: book_ids (osid.id.IdList): list of book ``Ids``
return: (osid.commenting.CommentList) - list of comments
raise: NullArgument - ``book_ids`` is ``null``
rais... | python | def get_comments_by_books(self, book_ids):
"""Gets the list of ``Comments`` corresponding to a list of ``Books``.
arg: book_ids (osid.id.IdList): list of book ``Ids``
return: (osid.commenting.CommentList) - list of comments
raise: NullArgument - ``book_ids`` is ``null``
rais... | [
"def",
"get_comments_by_books",
"(",
"self",
",",
"book_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_resources_by_bins",
"comment_list",
"=",
"[",
"]",
"for",
"book_id",
"in",
"book_ids",
":",
"comment_list",
"+=",
"list",
"("... | Gets the list of ``Comments`` corresponding to a list of ``Books``.
arg: book_ids (osid.id.IdList): list of book ``Ids``
return: (osid.commenting.CommentList) - list of comments
raise: NullArgument - ``book_ids`` is ``null``
raise: OperationFailed - unable to complete request
... | [
"Gets",
"the",
"list",
"of",
"Comments",
"corresponding",
"to",
"a",
"list",
"of",
"Books",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1363-L1380 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookSession.get_book_ids_by_comment | def get_book_ids_by_comment(self, comment_id):
"""Gets the list of ``Book`` ``Ids`` mapped to a ``Comment``.
arg: comment_id (osid.id.Id): ``Id`` of a ``Comment``
return: (osid.id.IdList) - list of book ``Ids``
raise: NotFound - ``comment_id`` is not found
raise: NullArgum... | python | def get_book_ids_by_comment(self, comment_id):
"""Gets the list of ``Book`` ``Ids`` mapped to a ``Comment``.
arg: comment_id (osid.id.Id): ``Id`` of a ``Comment``
return: (osid.id.IdList) - list of book ``Ids``
raise: NotFound - ``comment_id`` is not found
raise: NullArgum... | [
"def",
"get_book_ids_by_comment",
"(",
"self",
",",
"comment_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_bin_ids_by_resource",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'COMMENTING'",
",",
"local",
"=",
"True",
")"... | Gets the list of ``Book`` ``Ids`` mapped to a ``Comment``.
arg: comment_id (osid.id.Id): ``Id`` of a ``Comment``
return: (osid.id.IdList) - list of book ``Ids``
raise: NotFound - ``comment_id`` is not found
raise: NullArgument - ``comment_id`` is ``null``
raise: Operation... | [
"Gets",
"the",
"list",
"of",
"Book",
"Ids",
"mapped",
"to",
"a",
"Comment",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1383-L1404 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookSession.get_books_by_comment | def get_books_by_comment(self, comment_id):
"""Gets the list of ``Book`` objects mapped to a ``Comment``.
arg: comment_id (osid.id.Id): ``Id`` of a ``Comment``
return: (osid.commenting.BookList) - list of books
raise: NotFound - ``comment_id`` is not found
raise: NullArgume... | python | def get_books_by_comment(self, comment_id):
"""Gets the list of ``Book`` objects mapped to a ``Comment``.
arg: comment_id (osid.id.Id): ``Id`` of a ``Comment``
return: (osid.commenting.BookList) - list of books
raise: NotFound - ``comment_id`` is not found
raise: NullArgume... | [
"def",
"get_books_by_comment",
"(",
"self",
",",
"comment_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinSession.get_bins_by_resource",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'COMMENTING'",
",",
"local",
"=",
"True",
")",
"l... | Gets the list of ``Book`` objects mapped to a ``Comment``.
arg: comment_id (osid.id.Id): ``Id`` of a ``Comment``
return: (osid.commenting.BookList) - list of books
raise: NotFound - ``comment_id`` is not found
raise: NullArgument - ``comment_id`` is ``null``
raise: Operati... | [
"Gets",
"the",
"list",
"of",
"Book",
"objects",
"mapped",
"to",
"a",
"Comment",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1407-L1424 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookAssignmentSession.get_assignable_book_ids | def get_assignable_book_ids(self, book_id):
"""Gets a list of books including and under the given book node in which any comment can be assigned.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
return: (osid.id.IdList) - list of assignable book ``Ids``
raise: NullArgument - ``... | python | def get_assignable_book_ids(self, book_id):
"""Gets a list of books including and under the given book node in which any comment can be assigned.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
return: (osid.id.IdList) - list of assignable book ``Ids``
raise: NullArgument - ``... | [
"def",
"get_assignable_book_ids",
"(",
"self",
",",
"book_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_man... | Gets a list of books including and under the given book node in which any comment can be assigned.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
return: (osid.id.IdList) - list of assignable book ``Ids``
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed -... | [
"Gets",
"a",
"list",
"of",
"books",
"including",
"and",
"under",
"the",
"given",
"book",
"node",
"in",
"which",
"any",
"comment",
"can",
"be",
"assigned",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1493-L1512 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookAssignmentSession.assign_comment_to_book | def assign_comment_to_book(self, comment_id, book_id):
"""Adds an existing ``Comment`` to a ``Book``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
raise: AlreadyExists - ``comment_id`` is already assigned to
... | python | def assign_comment_to_book(self, comment_id, book_id):
"""Adds an existing ``Comment`` to a ``Book``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
raise: AlreadyExists - ``comment_id`` is already assigned to
... | [
"def",
"assign_comment_to_book",
"(",
"self",
",",
"comment_id",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.assign_resource_to_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'COMMENTING'",
",",
"lo... | Adds an existing ``Comment`` to a ``Book``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
raise: AlreadyExists - ``comment_id`` is already assigned to
``book_id``
raise: NotFound - ``comment_id``... | [
"Adds",
"an",
"existing",
"Comment",
"to",
"a",
"Book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1532-L1551 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookAssignmentSession.unassign_comment_from_book | def unassign_comment_from_book(self, comment_id, book_id):
"""Removes a ``Comment`` from a ``Book``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
raise: NotFound - ``comment_id`` or ``book_id`` not found or
... | python | def unassign_comment_from_book(self, comment_id, book_id):
"""Removes a ``Comment`` from a ``Book``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
raise: NotFound - ``comment_id`` or ``book_id`` not found or
... | [
"def",
"unassign_comment_from_book",
"(",
"self",
",",
"comment_id",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.unassign_resource_from_bin",
"mgr",
"=",
"self",
".",
"_get_provider_manager",
"(",
"'COMMENTING'",
",... | Removes a ``Comment`` from a ``Book``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: book_id (osid.id.Id): the ``Id`` of the ``Book``
raise: NotFound - ``comment_id`` or ``book_id`` not found or
``comment_id`` not assigned to ``book_id``
raise: ... | [
"Removes",
"a",
"Comment",
"from",
"a",
"Book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1554-L1572 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentBookAssignmentSession.reassign_comment_to_book | def reassign_comment_to_book(self, comment_id, from_book_id, to_book_id):
"""Moves a ``Credit`` from one ``Book`` to another.
Mappings to other ``Books`` are unaffected.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: from_book_id (osid.id.Id): the ``Id`` of the ... | python | def reassign_comment_to_book(self, comment_id, from_book_id, to_book_id):
"""Moves a ``Credit`` from one ``Book`` to another.
Mappings to other ``Books`` are unaffected.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: from_book_id (osid.id.Id): the ``Id`` of the ... | [
"def",
"reassign_comment_to_book",
"(",
"self",
",",
"comment_id",
",",
"from_book_id",
",",
"to_book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceBinAssignmentSession.reassign_resource_to_bin",
"self",
".",
"assign_comment_to_book",
"(",
"comment_id... | Moves a ``Credit`` from one ``Book`` to another.
Mappings to other ``Books`` are unaffected.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
arg: from_book_id (osid.id.Id): the ``Id`` of the current
``Book``
arg: to_book_id (osid.id.Id): the ``Id`` ... | [
"Moves",
"a",
"Credit",
"from",
"one",
"Book",
"to",
"another",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1575-L1602 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookAdminSession.can_create_book_with_record_types | def can_create_book_with_record_types(self, book_record_types):
"""Tests if this user can create a single ``Book`` using the desired record types.
While ``CommentingManager.getBookRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are r... | python | def can_create_book_with_record_types(self, book_record_types):
"""Tests if this user can create a single ``Book`` using the desired record types.
While ``CommentingManager.getBookRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are r... | [
"def",
"can_create_book_with_record_types",
"(",
"self",
",",
"book_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 a... | Tests if this user can create a single ``Book`` using the desired record types.
While ``CommentingManager.getBookRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are required for creating a specific ``Book``.
Providing an empty array ... | [
"Tests",
"if",
"this",
"user",
"can",
"create",
"a",
"single",
"Book",
"using",
"the",
"desired",
"record",
"types",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L1929-L1953 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookAdminSession.update_book | def update_book(self, book_form):
"""Updates an existing book.
arg: book_form (osid.commenting.BookForm): the form
containing the elements to be updated
raise: IllegalState - ``book_form`` already used in an update
transaction
raise: InvalidArgument ... | python | def update_book(self, book_form):
"""Updates an existing book.
arg: book_form (osid.commenting.BookForm): the form
containing the elements to be updated
raise: IllegalState - ``book_form`` already used in an update
transaction
raise: InvalidArgument ... | [
"def",
"update_book",
"(",
"self",
",",
"book_form",
")",
":",
"# Implemented from template for",
"# osid.resource.BinAdminSession.update_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"upd... | Updates an existing book.
arg: book_form (osid.commenting.BookForm): the form
containing the elements to be updated
raise: IllegalState - ``book_form`` already used in an update
transaction
raise: InvalidArgument - the form contains an invalid value
... | [
"Updates",
"an",
"existing",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2094-L2133 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookAdminSession.alias_book | def alias_book(self, book_id, alias_id):
"""Adds an ``Id`` to a ``Book`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Book`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to another book, it ... | python | def alias_book(self, book_id, alias_id):
"""Adds an ``Id`` to a ``Book`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Book`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to another book, it ... | [
"def",
"alias_book",
"(",
"self",
",",
"book_id",
",",
"alias_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinLookupSession.alias_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_sessi... | Adds an ``Id`` to a ``Book`` for the purpose of creating compatibility.
The primary ``Id`` of the ``Book`` is determined by the
provider. The new ``Id`` performs as an alias to the primary
``Id``. If the alias is a pointer to another book, it is
reassigned to the given book ``Id``.
... | [
"Adds",
"an",
"Id",
"to",
"a",
"Book",
"for",
"the",
"purpose",
"of",
"creating",
"compatibility",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2205-L2227 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.get_root_books | def get_root_books(self):
"""Gets the root books in the book hierarchy.
A node with no parents is an orphan. While all book ``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.
re... | python | def get_root_books(self):
"""Gets the root books in the book hierarchy.
A node with no parents is an orphan. While all book ``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.
re... | [
"def",
"get_root_books",
"(",
"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 books in the book hierarchy.
A node with no parents is an orphan. While all book ``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.commenting.BookList) - th... | [
"Gets",
"the",
"root",
"books",
"in",
"the",
"book",
"hierarchy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2379-L2399 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.has_parent_books | def has_parent_books(self, book_id):
"""Tests if the ``Book`` has any parents.
arg: book_id (osid.id.Id): a book ``Id``
return: (boolean) - ``true`` if the book has parents, f ``alse``
otherwise
raise: NotFound - ``book_id`` is not found
raise: NullArgument ... | python | def has_parent_books(self, book_id):
"""Tests if the ``Book`` has any parents.
arg: book_id (osid.id.Id): a book ``Id``
return: (boolean) - ``true`` if the book has parents, f ``alse``
otherwise
raise: NotFound - ``book_id`` is not found
raise: NullArgument ... | [
"def",
"has_parent_books",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.has_parent_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"... | Tests if the ``Book`` has any parents.
arg: book_id (osid.id.Id): a book ``Id``
return: (boolean) - ``true`` if the book has parents, f ``alse``
otherwise
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: Operat... | [
"Tests",
"if",
"the",
"Book",
"has",
"any",
"parents",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2404-L2421 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.is_parent_of_book | def is_parent_of_book(self, id_, book_id):
"""Tests if an ``Id`` is a direct parent of book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if this ``id`` is a parent of
``book_id,`` f ``alse`` otherwise... | python | def is_parent_of_book(self, id_, book_id):
"""Tests if an ``Id`` is a direct parent of book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if this ``id`` is a parent of
``book_id,`` f ``alse`` otherwise... | [
"def",
"is_parent_of_book",
"(",
"self",
",",
"id_",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_parent_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_se... | Tests if an ``Id`` is a direct parent of book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if this ``id`` is a parent of
``book_id,`` f ``alse`` otherwise
raise: NotFound - ``book_id`` is not found
... | [
"Tests",
"if",
"an",
"Id",
"is",
"a",
"direct",
"parent",
"of",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2424-L2443 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.get_parent_book_ids | def get_parent_book_ids(self, book_id):
"""Gets the parent ``Ids`` of the given book.
arg: book_id (osid.id.Id): a book ``Id``
return: (osid.id.IdList) - the parent ``Ids`` of the book
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
... | python | def get_parent_book_ids(self, book_id):
"""Gets the parent ``Ids`` of the given book.
arg: book_id (osid.id.Id): a book ``Id``
return: (osid.id.IdList) - the parent ``Ids`` of the book
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
... | [
"def",
"get_parent_book_ids",
"(",
"self",
",",
"book_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 book.
arg: book_id (osid.id.Id): a book ``Id``
return: (osid.id.IdList) - the parent ``Ids`` of the book
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complet... | [
"Gets",
"the",
"parent",
"Ids",
"of",
"the",
"given",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2446-L2462 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.get_parent_books | def get_parent_books(self, book_id):
"""Gets the parent books of the given ``id``.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to
query
return: (osid.commenting.BookList) - the parent books of the
``id``
raise: NotFound - a ``Book`` identifi... | python | def get_parent_books(self, book_id):
"""Gets the parent books of the given ``id``.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to
query
return: (osid.commenting.BookList) - the parent books of the
``id``
raise: NotFound - a ``Book`` identifi... | [
"def",
"get_parent_books",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_parent_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"... | Gets the parent books of the given ``id``.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to
query
return: (osid.commenting.BookList) - the parent books of the
``id``
raise: NotFound - a ``Book`` identified by ``Id is`` not found
raise: NullAr... | [
"Gets",
"the",
"parent",
"books",
"of",
"the",
"given",
"id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2465-L2486 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.is_ancestor_of_book | def is_ancestor_of_book(self, id_, book_id):
"""Tests if an ``Id`` is an ancestor of a book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``tru`` e if this ``id`` is an ancestor of
``book_id,`` ``false`` other... | python | def is_ancestor_of_book(self, id_, book_id):
"""Tests if an ``Id`` is an ancestor of a book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``tru`` e if this ``id`` is an ancestor of
``book_id,`` ``false`` other... | [
"def",
"is_ancestor_of_book",
"(",
"self",
",",
"id_",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_ancestor_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalo... | Tests if an ``Id`` is an ancestor of a book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``tru`` e if this ``id`` is an ancestor of
``book_id,`` ``false`` otherwise
raise: NotFound - ``book_id`` is not found... | [
"Tests",
"if",
"an",
"Id",
"is",
"an",
"ancestor",
"of",
"a",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2489-L2508 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.has_child_books | def has_child_books(self, book_id):
"""Tests if a book has any children.
arg: book_id (osid.id.Id): a book ``Id``
return: (boolean) - ``true`` if the ``book_id`` has children,
``false`` otherwise
raise: NotFound - ``book_id`` is not found
raise: NullArgument... | python | def has_child_books(self, book_id):
"""Tests if a book has any children.
arg: book_id (osid.id.Id): a book ``Id``
return: (boolean) - ``true`` if the ``book_id`` has children,
``false`` otherwise
raise: NotFound - ``book_id`` is not found
raise: NullArgument... | [
"def",
"has_child_books",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.has_child_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"ha... | Tests if a book has any children.
arg: book_id (osid.id.Id): a book ``Id``
return: (boolean) - ``true`` if the ``book_id`` has children,
``false`` otherwise
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: Oper... | [
"Tests",
"if",
"a",
"book",
"has",
"any",
"children",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2511-L2528 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.is_child_of_book | def is_child_of_book(self, id_, book_id):
"""Tests if a book is a direct child of another.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if the ``id`` is a child of
``book_id,`` ``false`` otherwise
... | python | def is_child_of_book(self, id_, book_id):
"""Tests if a book is a direct child of another.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if the ``id`` is a child of
``book_id,`` ``false`` otherwise
... | [
"def",
"is_child_of_book",
"(",
"self",
",",
"id_",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_child_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_sess... | Tests if a book is a direct child of another.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if the ``id`` is a child of
``book_id,`` ``false`` otherwise
raise: NotFound - ``book_id`` is not found
... | [
"Tests",
"if",
"a",
"book",
"is",
"a",
"direct",
"child",
"of",
"another",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2531-L2550 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.get_child_book_ids | def get_child_book_ids(self, book_id):
"""Gets the child ``Ids`` of the given book.
arg: book_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the book
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
... | python | def get_child_book_ids(self, book_id):
"""Gets the child ``Ids`` of the given book.
arg: book_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the book
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
... | [
"def",
"get_child_book_ids",
"(",
"self",
",",
"book_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 book.
arg: book_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the book
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete... | [
"Gets",
"the",
"child",
"Ids",
"of",
"the",
"given",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2553-L2569 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.get_child_books | def get_child_books(self, book_id):
"""Gets the child books of the given ``id``.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to
query
return: (osid.commenting.BookList) - the child books of the
``id``
raise: NotFound - a ``Book`` identified ... | python | def get_child_books(self, book_id):
"""Gets the child books of the given ``id``.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to
query
return: (osid.commenting.BookList) - the child books of the
``id``
raise: NotFound - a ``Book`` identified ... | [
"def",
"get_child_books",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_child_bins",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_session",
".",
"ge... | Gets the child books of the given ``id``.
arg: book_id (osid.id.Id): the ``Id`` of the ``Book`` to
query
return: (osid.commenting.BookList) - the child books of the
``id``
raise: NotFound - a ``Book`` identified by ``Id is`` not found
raise: NullArgu... | [
"Gets",
"the",
"child",
"books",
"of",
"the",
"given",
"id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2572-L2593 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.is_descendant_of_book | def is_descendant_of_book(self, id_, book_id):
"""Tests if an ``Id`` is a descendant of a book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if the ``id`` is a descendant of
the ``book_id,`` ``false``... | python | def is_descendant_of_book(self, id_, book_id):
"""Tests if an ``Id`` is a descendant of a book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if the ``id`` is a descendant of
the ``book_id,`` ``false``... | [
"def",
"is_descendant_of_book",
"(",
"self",
",",
"id_",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.is_descendant_of_bin",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_ca... | Tests if an ``Id`` is a descendant of a book.
arg: id (osid.id.Id): an ``Id``
arg: book_id (osid.id.Id): the ``Id`` of a book
return: (boolean) - ``true`` if the ``id`` is a descendant of
the ``book_id,`` ``false`` otherwise
raise: NotFound - ``book_id`` is not f... | [
"Tests",
"if",
"an",
"Id",
"is",
"a",
"descendant",
"of",
"a",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2596-L2615 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchySession.get_book_nodes | def get_book_nodes(self, book_id, ancestor_levels, descendant_levels, include_siblings):
"""Gets a portion of the hierarchy for the given book.
arg: book_id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include.... | python | def get_book_nodes(self, book_id, ancestor_levels, descendant_levels, include_siblings):
"""Gets a portion of the hierarchy for the given book.
arg: book_id (osid.id.Id): the ``Id`` to query
arg: ancestor_levels (cardinal): the maximum number of
ancestor levels to include.... | [
"def",
"get_book_nodes",
"(",
"self",
",",
"book_id",
",",
"ancestor_levels",
",",
"descendant_levels",
",",
"include_siblings",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchySession.get_bin_nodes",
"return",
"objects",
".",
"BookNode",
"(",
"sel... | Gets a portion of the hierarchy for the given book.
arg: book_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 (car... | [
"Gets",
"a",
"portion",
"of",
"the",
"hierarchy",
"for",
"the",
"given",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2654-L2681 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchyDesignSession.add_root_book | def add_root_book(self, book_id):
"""Adds a root book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: AlreadyExists - ``book_id`` is already in hierarchy
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: Operat... | python | def add_root_book(self, book_id):
"""Adds a root book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: AlreadyExists - ``book_id`` is already in hierarchy
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: Operat... | [
"def",
"add_root_book",
"(",
"self",
",",
"book_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 book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: AlreadyExists - ``book_id`` is already in hierarchy
raise: NotFound - ``book_id`` is not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
... | [
"Adds",
"a",
"root",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2769-L2785 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchyDesignSession.remove_root_book | def remove_root_book(self, book_id):
"""Removes a root book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: NotFound - ``book_id`` is not a root
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: Permis... | python | def remove_root_book(self, book_id):
"""Removes a root book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: NotFound - ``book_id`` is not a root
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: Permis... | [
"def",
"remove_root_book",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.remove_root_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_sessi... | Removes a root book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: NotFound - ``book_id`` is not a root
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*comp... | [
"Removes",
"a",
"root",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2788-L2803 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchyDesignSession.add_child_book | def add_child_book(self, book_id, child_id):
"""Adds a child to a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``book_id`` is already a parent of
``child_id``
raise: N... | python | def add_child_book(self, book_id, child_id):
"""Adds a child to a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``book_id`` is already a parent of
``child_id``
raise: N... | [
"def",
"add_child_book",
"(",
"self",
",",
"book_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 book.
arg: book_id (osid.id.Id): the ``Id`` of a book
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: AlreadyExists - ``book_id`` is already a parent of
``child_id``
raise: NotFound - ``book_id`` or ``child_id`` not found
... | [
"Adds",
"a",
"child",
"to",
"a",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2806-L2824 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchyDesignSession.remove_child_book | def remove_child_book(self, book_id, child_id):
"""Removes a child from a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``book_id`` not a parent of ``child_id``
raise: NullArgument - ``book... | python | def remove_child_book(self, book_id, child_id):
"""Removes a child from a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``book_id`` not a parent of ``child_id``
raise: NullArgument - ``book... | [
"def",
"remove_child_book",
"(",
"self",
",",
"book_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 book.
arg: book_id (osid.id.Id): the ``Id`` of a book
arg: child_id (osid.id.Id): the ``Id`` of the new child
raise: NotFound - ``book_id`` not a parent of ``child_id``
raise: NullArgument - ``book_id`` or ``child_id`` is ``null``
raise: Operation... | [
"Removes",
"a",
"child",
"from",
"a",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2827-L2843 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | BookHierarchyDesignSession.remove_child_books | def remove_child_books(self, book_id):
"""Removes all children from a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: NotFound - ``book_id`` not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
rai... | python | def remove_child_books(self, book_id):
"""Removes all children from a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: NotFound - ``book_id`` not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
rai... | [
"def",
"remove_child_books",
"(",
"self",
",",
"book_id",
")",
":",
"# Implemented from template for",
"# osid.resource.BinHierarchyDesignSession.remove_child_bin_template",
"if",
"self",
".",
"_catalog_session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_catalog_se... | Removes all children from a book.
arg: book_id (osid.id.Id): the ``Id`` of a book
raise: NotFound - ``book_id`` not found
raise: NullArgument - ``book_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
... | [
"Removes",
"all",
"children",
"from",
"a",
"book",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2846-L2861 |
mitsei/dlkit | dlkit/runtime/impls/configuration/sessions.py | ValueRetrievalSession.get_value_by_parameter | def get_value_by_parameter(self, parameter_id=None):
"""Gets a ``Value`` for the given parameter ``Id``.
If more than one value exists for the given parameter, the most
preferred value is returned. This method can be used as a
convenience when only one value is expected.
``get_v... | python | def get_value_by_parameter(self, parameter_id=None):
"""Gets a ``Value`` for the given parameter ``Id``.
If more than one value exists for the given parameter, the most
preferred value is returned. This method can be used as a
convenience when only one value is expected.
``get_v... | [
"def",
"get_value_by_parameter",
"(",
"self",
",",
"parameter_id",
"=",
"None",
")",
":",
"pass",
"if",
"parameter_id",
"is",
"None",
":",
"raise",
"NullArgument",
"try",
":",
"parameter_key",
"=",
"parameter_id",
".",
"get_identifier",
"(",
")",
"+",
"'.'",
... | Gets a ``Value`` for the given parameter ``Id``.
If more than one value exists for the given parameter, the most
preferred value is returned. This method can be used as a
convenience when only one value is expected.
``get_values_by_parameters()`` should be used for getting all
t... | [
"Gets",
"a",
"Value",
"for",
"the",
"given",
"parameter",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/configuration/sessions.py#L166-L204 |
textbook/flash | flash/parse.py | parse_config | def parse_config():
"""Parse the configuration and create required services.
Note:
Either takes the configuration from the environment (a variable
named ``FLASH_CONFIG``) or a file at the module root (named
``config.json``). Either way, it will attempt to parse it as
JSON, expecting the... | python | def parse_config():
"""Parse the configuration and create required services.
Note:
Either takes the configuration from the environment (a variable
named ``FLASH_CONFIG``) or a file at the module root (named
``config.json``). Either way, it will attempt to parse it as
JSON, expecting the... | [
"def",
"parse_config",
"(",
")",
":",
"env",
"=",
"getenv",
"(",
"'FLASH_CONFIG'",
")",
"if",
"env",
":",
"logger",
".",
"info",
"(",
"'loading configuration from environment'",
")",
"data",
"=",
"json",
".",
"loads",
"(",
"env",
")",
"else",
":",
"data",
... | Parse the configuration and create required services.
Note:
Either takes the configuration from the environment (a variable
named ``FLASH_CONFIG``) or a file at the module root (named
``config.json``). Either way, it will attempt to parse it as
JSON, expecting the following format::
... | [
"Parse",
"the",
"configuration",
"and",
"create",
"required",
"services",
"."
] | train | https://github.com/textbook/flash/blob/ee93f0976a1a6bf11a995f1fbbe24c6c66d0aa1f/flash/parse.py#L13-L44 |
textbook/flash | flash/parse.py | _parse_file | def _parse_file():
"""Parse the config from a file.
Note:
Assumes any value that ``"$LOOKS_LIKE_THIS"`` in a service
definition refers to an environment variable, and attempts to get
it accordingly.
"""
file_name = path.join(
path.abspath(path.dirname(path.dirname(__file__)))... | python | def _parse_file():
"""Parse the config from a file.
Note:
Assumes any value that ``"$LOOKS_LIKE_THIS"`` in a service
definition refers to an environment variable, and attempts to get
it accordingly.
"""
file_name = path.join(
path.abspath(path.dirname(path.dirname(__file__)))... | [
"def",
"_parse_file",
"(",
")",
":",
"file_name",
"=",
"path",
".",
"join",
"(",
"path",
".",
"abspath",
"(",
"path",
".",
"dirname",
"(",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
")",
",",
"'config.json'",
")",
"logger",
".",
"info",
"(",
... | Parse the config from a file.
Note:
Assumes any value that ``"$LOOKS_LIKE_THIS"`` in a service
definition refers to an environment variable, and attempts to get
it accordingly. | [
"Parse",
"the",
"config",
"from",
"a",
"file",
"."
] | train | https://github.com/textbook/flash/blob/ee93f0976a1a6bf11a995f1fbbe24c6c66d0aa1f/flash/parse.py#L47-L73 |
textbook/flash | flash/parse.py | _read_file | def _read_file(file_name):
"""Read the file content and load it as JSON.
Arguments:
file_name (:py:class:`str`): The filename.
Returns:
:py:class:`dict`: The loaded JSON data.
Raises:
:py:class:`FileNotFoundError`: If the file is not found.
"""
with open(file_name) as confi... | python | def _read_file(file_name):
"""Read the file content and load it as JSON.
Arguments:
file_name (:py:class:`str`): The filename.
Returns:
:py:class:`dict`: The loaded JSON data.
Raises:
:py:class:`FileNotFoundError`: If the file is not found.
"""
with open(file_name) as confi... | [
"def",
"_read_file",
"(",
"file_name",
")",
":",
"with",
"open",
"(",
"file_name",
")",
"as",
"config_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"config_file",
")",
"return",
"data"
] | Read the file content and load it as JSON.
Arguments:
file_name (:py:class:`str`): The filename.
Returns:
:py:class:`dict`: The loaded JSON data.
Raises:
:py:class:`FileNotFoundError`: If the file is not found. | [
"Read",
"the",
"file",
"content",
"and",
"load",
"it",
"as",
"JSON",
"."
] | train | https://github.com/textbook/flash/blob/ee93f0976a1a6bf11a995f1fbbe24c6c66d0aa1f/flash/parse.py#L76-L91 |
omaraboumrad/mastool | mastool/extension.py | Mastool.build_message | def build_message(self, checker):
"""Builds the checker's error message to report"""
solution = ' (%s)' % checker.solution if self.with_solutions else ''
return '{} {}{}'.format(checker.code,
checker.msg,
solution) | python | def build_message(self, checker):
"""Builds the checker's error message to report"""
solution = ' (%s)' % checker.solution if self.with_solutions else ''
return '{} {}{}'.format(checker.code,
checker.msg,
solution) | [
"def",
"build_message",
"(",
"self",
",",
"checker",
")",
":",
"solution",
"=",
"' (%s)'",
"%",
"checker",
".",
"solution",
"if",
"self",
".",
"with_solutions",
"else",
"''",
"return",
"'{} {}{}'",
".",
"format",
"(",
"checker",
".",
"code",
",",
"checker"... | Builds the checker's error message to report | [
"Builds",
"the",
"checker",
"s",
"error",
"message",
"to",
"report"
] | train | https://github.com/omaraboumrad/mastool/blob/0ec566de6717d03c6ec61affe5d1e9ff8d7e6ebd/mastool/extension.py#L32-L37 |
omaraboumrad/mastool | mastool/extension.py | Mastool.run | def run(self):
"""Primary entry point to the plugin, runs once per file."""
paths = [x for x in practices.__dict__.values()
if hasattr(x, 'code')]
for node in ast.walk(self.tree):
try:
lineno, col_offset = node.lineno, node.col_offset
exc... | python | def run(self):
"""Primary entry point to the plugin, runs once per file."""
paths = [x for x in practices.__dict__.values()
if hasattr(x, 'code')]
for node in ast.walk(self.tree):
try:
lineno, col_offset = node.lineno, node.col_offset
exc... | [
"def",
"run",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"x",
"for",
"x",
"in",
"practices",
".",
"__dict__",
".",
"values",
"(",
")",
"if",
"hasattr",
"(",
"x",
",",
"'code'",
")",
"]",
"for",
"node",
"in",
"ast",
".",
"walk",
"(",
"self",
".",... | Primary entry point to the plugin, runs once per file. | [
"Primary",
"entry",
"point",
"to",
"the",
"plugin",
"runs",
"once",
"per",
"file",
"."
] | train | https://github.com/omaraboumrad/mastool/blob/0ec566de6717d03c6ec61affe5d1e9ff8d7e6ebd/mastool/extension.py#L39-L54 |
ryanpetrello/cleaver | cleaver/backend/db/__init__.py | SQLAlchemyBackend.all_experiments | def all_experiments(self):
"""
Retrieve every available experiment.
Returns a list of ``cleaver.experiment.Experiment``s
"""
try:
return [
self.experiment_factory(e)
for e in model.Experiment.query.all()
]
finally:
... | python | def all_experiments(self):
"""
Retrieve every available experiment.
Returns a list of ``cleaver.experiment.Experiment``s
"""
try:
return [
self.experiment_factory(e)
for e in model.Experiment.query.all()
]
finally:
... | [
"def",
"all_experiments",
"(",
"self",
")",
":",
"try",
":",
"return",
"[",
"self",
".",
"experiment_factory",
"(",
"e",
")",
"for",
"e",
"in",
"model",
".",
"Experiment",
".",
"query",
".",
"all",
"(",
")",
"]",
"finally",
":",
"self",
".",
"Session... | Retrieve every available experiment.
Returns a list of ``cleaver.experiment.Experiment``s | [
"Retrieve",
"every",
"available",
"experiment",
"."
] | train | https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/backend/db/__init__.py#L48-L60 |
ryanpetrello/cleaver | cleaver/backend/db/__init__.py | SQLAlchemyBackend.get_experiment | def get_experiment(self, name, variants):
"""
Retrieve an experiment by its name and variants (assuming it exists).
:param name a unique string name for the experiment
:param variants a list of strings, each with a unique variant name
Returns a ``cleaver.experiment.Experiment``... | python | def get_experiment(self, name, variants):
"""
Retrieve an experiment by its name and variants (assuming it exists).
:param name a unique string name for the experiment
:param variants a list of strings, each with a unique variant name
Returns a ``cleaver.experiment.Experiment``... | [
"def",
"get_experiment",
"(",
"self",
",",
"name",
",",
"variants",
")",
":",
"try",
":",
"return",
"self",
".",
"experiment_factory",
"(",
"model",
".",
"Experiment",
".",
"get_by",
"(",
"name",
"=",
"name",
")",
")",
"finally",
":",
"self",
".",
"Ses... | Retrieve an experiment by its name and variants (assuming it exists).
:param name a unique string name for the experiment
:param variants a list of strings, each with a unique variant name
Returns a ``cleaver.experiment.Experiment`` or ``None`` | [
"Retrieve",
"an",
"experiment",
"by",
"its",
"name",
"and",
"variants",
"(",
"assuming",
"it",
"exists",
")",
"."
] | train | https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/backend/db/__init__.py#L62-L74 |
ryanpetrello/cleaver | cleaver/backend/db/__init__.py | SQLAlchemyBackend.save_experiment | def save_experiment(self, name, variants):
"""
Persist an experiment and its variants (unless they already exist).
:param name a unique string name for the experiment
:param variants a list of strings, each with a unique variant name
"""
try:
model.Experiment... | python | def save_experiment(self, name, variants):
"""
Persist an experiment and its variants (unless they already exist).
:param name a unique string name for the experiment
:param variants a list of strings, each with a unique variant name
"""
try:
model.Experiment... | [
"def",
"save_experiment",
"(",
"self",
",",
"name",
",",
"variants",
")",
":",
"try",
":",
"model",
".",
"Experiment",
"(",
"name",
"=",
"name",
",",
"started_on",
"=",
"datetime",
".",
"utcnow",
"(",
")",
",",
"variants",
"=",
"[",
"model",
".",
"Va... | Persist an experiment and its variants (unless they already exist).
:param name a unique string name for the experiment
:param variants a list of strings, each with a unique variant name | [
"Persist",
"an",
"experiment",
"and",
"its",
"variants",
"(",
"unless",
"they",
"already",
"exist",
")",
"."
] | train | https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/backend/db/__init__.py#L76-L94 |
ryanpetrello/cleaver | cleaver/backend/db/__init__.py | SQLAlchemyBackend.get_variant | def get_variant(self, identity, experiment_name):
"""
Retrieve the variant for a specific user and experiment (if it exists).
:param identity a unique user identifier
:param experiment_name the string name of the experiment
Returns a ``String`` or `None`
"""
try... | python | def get_variant(self, identity, experiment_name):
"""
Retrieve the variant for a specific user and experiment (if it exists).
:param identity a unique user identifier
:param experiment_name the string name of the experiment
Returns a ``String`` or `None`
"""
try... | [
"def",
"get_variant",
"(",
"self",
",",
"identity",
",",
"experiment_name",
")",
":",
"try",
":",
"match",
"=",
"model",
".",
"Participant",
".",
"query",
".",
"join",
"(",
"model",
".",
"Experiment",
")",
".",
"filter",
"(",
"and_",
"(",
"model",
".",... | Retrieve the variant for a specific user and experiment (if it exists).
:param identity a unique user identifier
:param experiment_name the string name of the experiment
Returns a ``String`` or `None` | [
"Retrieve",
"the",
"variant",
"for",
"a",
"specific",
"user",
"and",
"experiment",
"(",
"if",
"it",
"exists",
")",
"."
] | train | https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/backend/db/__init__.py#L110-L128 |
ryanpetrello/cleaver | cleaver/backend/db/__init__.py | SQLAlchemyBackend.set_variant | def set_variant(self, identity, experiment_name, variant_name):
"""
Set the variant for a specific user.
:param identity a unique user identifier
:param experiment_name the string name of the experiment
:param variant_name the string name of the variant
"""
try:
... | python | def set_variant(self, identity, experiment_name, variant_name):
"""
Set the variant for a specific user.
:param identity a unique user identifier
:param experiment_name the string name of the experiment
:param variant_name the string name of the variant
"""
try:
... | [
"def",
"set_variant",
"(",
"self",
",",
"identity",
",",
"experiment_name",
",",
"variant_name",
")",
":",
"try",
":",
"experiment",
"=",
"model",
".",
"Experiment",
".",
"get_by",
"(",
"name",
"=",
"experiment_name",
")",
"variant",
"=",
"model",
".",
"Va... | Set the variant for a specific user.
:param identity a unique user identifier
:param experiment_name the string name of the experiment
:param variant_name the string name of the variant | [
"Set",
"the",
"variant",
"for",
"a",
"specific",
"user",
"."
] | train | https://github.com/ryanpetrello/cleaver/blob/0ef266e1a0603c6d414df4b9926ce2a59844db35/cleaver/backend/db/__init__.py#L130-L153 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook._parametersAsIndex | def _parametersAsIndex( self, ps ):
"""Private method to turn a parameter dict into a string suitable for
keying a dict.
ps: the parameters as a hash
returns: a string key"""
k = ""
for p in sorted(ps.keys()): # normalise the parameters
v = ps[p]
... | python | def _parametersAsIndex( self, ps ):
"""Private method to turn a parameter dict into a string suitable for
keying a dict.
ps: the parameters as a hash
returns: a string key"""
k = ""
for p in sorted(ps.keys()): # normalise the parameters
v = ps[p]
... | [
"def",
"_parametersAsIndex",
"(",
"self",
",",
"ps",
")",
":",
"k",
"=",
"\"\"",
"for",
"p",
"in",
"sorted",
"(",
"ps",
".",
"keys",
"(",
")",
")",
":",
"# normalise the parameters",
"v",
"=",
"ps",
"[",
"p",
"]",
"k",
"=",
"k",
"+",
"\"{p}=[[{v}]]... | Private method to turn a parameter dict into a string suitable for
keying a dict.
ps: the parameters as a hash
returns: a string key | [
"Private",
"method",
"to",
"turn",
"a",
"parameter",
"dict",
"into",
"a",
"string",
"suitable",
"for",
"keying",
"a",
"dict",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L69-L79 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.addResult | def addResult( self, result, jobids = None ):
"""Add a result. This should be :term:`results dict` as returned from
an instance of :class:`Experiment`, that contains metadata,
parameters, and result. Results cannot be overridden, as
notebooks are immutable: adding more results simply add... | python | def addResult( self, result, jobids = None ):
"""Add a result. This should be :term:`results dict` as returned from
an instance of :class:`Experiment`, that contains metadata,
parameters, and result. Results cannot be overridden, as
notebooks are immutable: adding more results simply add... | [
"def",
"addResult",
"(",
"self",
",",
"result",
",",
"jobids",
"=",
"None",
")",
":",
"# deal with the dufferent ways of presenting results to be added",
"if",
"isinstance",
"(",
"result",
",",
"list",
")",
":",
"# a list, recursively add",
"for",
"res",
"in",
"resu... | Add a result. This should be :term:`results dict` as returned from
an instance of :class:`Experiment`, that contains metadata,
parameters, and result. Results cannot be overridden, as
notebooks are immutable: adding more results simply adds
another result set.
The results may in... | [
"Add",
"a",
"result",
".",
"This",
"should",
"be",
":",
"term",
":",
"results",
"dict",
"as",
"returned",
"from",
"an",
"instance",
"of",
":",
"class",
":",
"Experiment",
"that",
"contains",
"metadata",
"parameters",
"and",
"result",
".",
"Results",
"canno... | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L81-L153 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.addPendingResult | def addPendingResult( self, ps, jobid ):
"""Add a "pending" result that we expect to get results for.
:param ps: the parameters for the result
:param jobid: an identifier for the pending result"""
k = self._parametersAsIndex(ps)
# retrieve or create the result list
if k... | python | def addPendingResult( self, ps, jobid ):
"""Add a "pending" result that we expect to get results for.
:param ps: the parameters for the result
:param jobid: an identifier for the pending result"""
k = self._parametersAsIndex(ps)
# retrieve or create the result list
if k... | [
"def",
"addPendingResult",
"(",
"self",
",",
"ps",
",",
"jobid",
")",
":",
"k",
"=",
"self",
".",
"_parametersAsIndex",
"(",
"ps",
")",
"# retrieve or create the result list",
"if",
"k",
"in",
"self",
".",
"_results",
".",
"keys",
"(",
")",
":",
"rs",
"=... | Add a "pending" result that we expect to get results for.
:param ps: the parameters for the result
:param jobid: an identifier for the pending result | [
"Add",
"a",
"pending",
"result",
"that",
"we",
"expect",
"to",
"get",
"results",
"for",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L155-L173 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.cancelPendingResult | def cancelPendingResult( self, jobid ):
"""Cancel a particular pending result. Note that this only affects the
notebook's record, not any job running in a lab.
:param jobid: job id for pending result"""
if jobid in self._pending.keys():
k = self._pending[jobid]
d... | python | def cancelPendingResult( self, jobid ):
"""Cancel a particular pending result. Note that this only affects the
notebook's record, not any job running in a lab.
:param jobid: job id for pending result"""
if jobid in self._pending.keys():
k = self._pending[jobid]
d... | [
"def",
"cancelPendingResult",
"(",
"self",
",",
"jobid",
")",
":",
"if",
"jobid",
"in",
"self",
".",
"_pending",
".",
"keys",
"(",
")",
":",
"k",
"=",
"self",
".",
"_pending",
"[",
"jobid",
"]",
"del",
"self",
".",
"_pending",
"[",
"jobid",
"]",
"i... | Cancel a particular pending result. Note that this only affects the
notebook's record, not any job running in a lab.
:param jobid: job id for pending result | [
"Cancel",
"a",
"particular",
"pending",
"result",
".",
"Note",
"that",
"this",
"only",
"affects",
"the",
"notebook",
"s",
"record",
"not",
"any",
"job",
"running",
"in",
"a",
"lab",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L175-L194 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.pendingResultsFor | def pendingResultsFor( self, ps ):
"""Retrieve a list of all pending results associated with the given parameters.
:param ps: the parameters
:returns: a list of pending result job ids, which may be empty"""
k = self._parametersAsIndex(ps)
if k in self._results.keys():
... | python | def pendingResultsFor( self, ps ):
"""Retrieve a list of all pending results associated with the given parameters.
:param ps: the parameters
:returns: a list of pending result job ids, which may be empty"""
k = self._parametersAsIndex(ps)
if k in self._results.keys():
... | [
"def",
"pendingResultsFor",
"(",
"self",
",",
"ps",
")",
":",
"k",
"=",
"self",
".",
"_parametersAsIndex",
"(",
"ps",
")",
"if",
"k",
"in",
"self",
".",
"_results",
".",
"keys",
"(",
")",
":",
"# filter out pending job ids, which can be anything except dicts",
... | Retrieve a list of all pending results associated with the given parameters.
:param ps: the parameters
:returns: a list of pending result job ids, which may be empty | [
"Retrieve",
"a",
"list",
"of",
"all",
"pending",
"results",
"associated",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L196-L206 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.cancelPendingResultsFor | def cancelPendingResultsFor( self, ps ):
"""Cancel all pending results for the given parameters. Note that
this only affects the notebook's record, not any job running in a lab.
:param ps: the parameters"""
k = self._parametersAsIndex(ps)
if k in self._results.keys():
... | python | def cancelPendingResultsFor( self, ps ):
"""Cancel all pending results for the given parameters. Note that
this only affects the notebook's record, not any job running in a lab.
:param ps: the parameters"""
k = self._parametersAsIndex(ps)
if k in self._results.keys():
... | [
"def",
"cancelPendingResultsFor",
"(",
"self",
",",
"ps",
")",
":",
"k",
"=",
"self",
".",
"_parametersAsIndex",
"(",
"ps",
")",
"if",
"k",
"in",
"self",
".",
"_results",
".",
"keys",
"(",
")",
":",
"# remove from results",
"rs",
"=",
"self",
".",
"_re... | Cancel all pending results for the given parameters. Note that
this only affects the notebook's record, not any job running in a lab.
:param ps: the parameters | [
"Cancel",
"all",
"pending",
"results",
"for",
"the",
"given",
"parameters",
".",
"Note",
"that",
"this",
"only",
"affects",
"the",
"notebook",
"s",
"record",
"not",
"any",
"job",
"running",
"in",
"a",
"lab",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L208-L223 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.cancelAllPendingResults | def cancelAllPendingResults( self ):
"""Cancel all pending results. Note that this only affects the
notebook's record, not any job running in a lab."""
for k in self._results.keys():
rs = self._results[k]
self._results[k] = [ j for j in rs if isinstance(j, dict) ]
... | python | def cancelAllPendingResults( self ):
"""Cancel all pending results. Note that this only affects the
notebook's record, not any job running in a lab."""
for k in self._results.keys():
rs = self._results[k]
self._results[k] = [ j for j in rs if isinstance(j, dict) ]
... | [
"def",
"cancelAllPendingResults",
"(",
"self",
")",
":",
"for",
"k",
"in",
"self",
".",
"_results",
".",
"keys",
"(",
")",
":",
"rs",
"=",
"self",
".",
"_results",
"[",
"k",
"]",
"self",
".",
"_results",
"[",
"k",
"]",
"=",
"[",
"j",
"for",
"j",
... | Cancel all pending results. Note that this only affects the
notebook's record, not any job running in a lab. | [
"Cancel",
"all",
"pending",
"results",
".",
"Note",
"that",
"this",
"only",
"affects",
"the",
"notebook",
"s",
"record",
"not",
"any",
"job",
"running",
"in",
"a",
"lab",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L225-L231 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.resultsFor | def resultsFor( self, ps ):
"""Retrieve a list of all results associated with the given parameters.
:param ps: the parameters
:returns: a list of results, which may be empty"""
k = self._parametersAsIndex(ps)
if k in self._results.keys():
# filter out pending job ids... | python | def resultsFor( self, ps ):
"""Retrieve a list of all results associated with the given parameters.
:param ps: the parameters
:returns: a list of results, which may be empty"""
k = self._parametersAsIndex(ps)
if k in self._results.keys():
# filter out pending job ids... | [
"def",
"resultsFor",
"(",
"self",
",",
"ps",
")",
":",
"k",
"=",
"self",
".",
"_parametersAsIndex",
"(",
"ps",
")",
"if",
"k",
"in",
"self",
".",
"_results",
".",
"keys",
"(",
")",
":",
"# filter out pending job ids, which can be anything except dicts",
"retur... | Retrieve a list of all results associated with the given parameters.
:param ps: the parameters
:returns: a list of results, which may be empty | [
"Retrieve",
"a",
"list",
"of",
"all",
"results",
"associated",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L239-L249 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.results | def results( self ):
"""Return a list of all the results currently available. This
excludes pending results. Results are returned as a single flat
list, so any repetition structure is lost.
:returns: a list of results"""
rs = []
for k in self._results.keys():
... | python | def results( self ):
"""Return a list of all the results currently available. This
excludes pending results. Results are returned as a single flat
list, so any repetition structure is lost.
:returns: a list of results"""
rs = []
for k in self._results.keys():
... | [
"def",
"results",
"(",
"self",
")",
":",
"rs",
"=",
"[",
"]",
"for",
"k",
"in",
"self",
".",
"_results",
".",
"keys",
"(",
")",
":",
"# filter out pending job ids, which can be anything except dicts",
"ars",
"=",
"[",
"res",
"for",
"res",
"in",
"self",
"."... | Return a list of all the results currently available. This
excludes pending results. Results are returned as a single flat
list, so any repetition structure is lost.
:returns: a list of results | [
"Return",
"a",
"list",
"of",
"all",
"the",
"results",
"currently",
"available",
".",
"This",
"excludes",
"pending",
"results",
".",
"Results",
"are",
"returned",
"as",
"a",
"single",
"flat",
"list",
"so",
"any",
"repetition",
"structure",
"is",
"lost",
"."
] | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L265-L276 |
simoninireland/epyc | epyc/labnotebook.py | LabNotebook.dataframe | def dataframe( self, only_successful = True ):
"""Return the results as a pandas DataFrame. Note that there is a danger
of duplicate labels here, for example if the results contain a value
with the same name as one of the parameters. To resolve this, parameter names
take precedence over ... | python | def dataframe( self, only_successful = True ):
"""Return the results as a pandas DataFrame. Note that there is a danger
of duplicate labels here, for example if the results contain a value
with the same name as one of the parameters. To resolve this, parameter names
take precedence over ... | [
"def",
"dataframe",
"(",
"self",
",",
"only_successful",
"=",
"True",
")",
":",
"def",
"extract",
"(",
"r",
")",
":",
"if",
"r",
"[",
"Experiment",
".",
"METADATA",
"]",
"[",
"Experiment",
".",
"STATUS",
"]",
":",
"# experiment was a success, include it",
... | Return the results as a pandas DataFrame. Note that there is a danger
of duplicate labels here, for example if the results contain a value
with the same name as one of the parameters. To resolve this, parameter names
take precedence over metadata values, and result names take precedence over
... | [
"Return",
"the",
"results",
"as",
"a",
"pandas",
"DataFrame",
".",
"Note",
"that",
"there",
"is",
"a",
"danger",
"of",
"duplicate",
"labels",
"here",
"for",
"example",
"if",
"the",
"results",
"contain",
"a",
"value",
"with",
"the",
"same",
"name",
"as",
... | train | https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/labnotebook.py#L303-L336 |
david-caro/python-autosemver | autosemver/__init__.py | distutils_autosemver_case | def distutils_autosemver_case(
metadata, with_release_notes=False, with_authors=True, with_changelog=True,
bugtracker_url=None,
):
"""
:param metadata: distutils metadata object.
:param with_release_notes: if true, will create the release notes.
:type with_release_notes: bool
:param with_aut... | python | def distutils_autosemver_case(
metadata, with_release_notes=False, with_authors=True, with_changelog=True,
bugtracker_url=None,
):
"""
:param metadata: distutils metadata object.
:param with_release_notes: if true, will create the release notes.
:type with_release_notes: bool
:param with_aut... | [
"def",
"distutils_autosemver_case",
"(",
"metadata",
",",
"with_release_notes",
"=",
"False",
",",
"with_authors",
"=",
"True",
",",
"with_changelog",
"=",
"True",
",",
"bugtracker_url",
"=",
"None",
",",
")",
":",
"metadata",
".",
"version",
"=",
"pkg_version",... | :param metadata: distutils metadata object.
:param with_release_notes: if true, will create the release notes.
:type with_release_notes: bool
:param with_authors: if true, will create the authors file.
:type with_authors: bool
:param with_changelog: if true, will create the release notes file.
:... | [
":",
"param",
"metadata",
":",
"distutils",
"metadata",
"object",
".",
":",
"param",
"with_release_notes",
":",
"if",
"true",
"will",
"create",
"the",
"release",
"notes",
".",
":",
"type",
"with_release_notes",
":",
"bool",
":",
"param",
"with_authors",
":",
... | train | https://github.com/david-caro/python-autosemver/blob/3bc0adb70c33e4bd3623ae4c1944d5ee37f4303d/autosemver/__init__.py#L109-L137 |
david-caro/python-autosemver | autosemver/__init__.py | distutils_old_autosemver_case | def distutils_old_autosemver_case(metadata, attr, value):
"""DEPRECATED"""
metadata = distutils_default_case(metadata, attr, value)
create_changelog(bugtracker_url=getattr(metadata, 'bugtracker_url', ''))
return metadata | python | def distutils_old_autosemver_case(metadata, attr, value):
"""DEPRECATED"""
metadata = distutils_default_case(metadata, attr, value)
create_changelog(bugtracker_url=getattr(metadata, 'bugtracker_url', ''))
return metadata | [
"def",
"distutils_old_autosemver_case",
"(",
"metadata",
",",
"attr",
",",
"value",
")",
":",
"metadata",
"=",
"distutils_default_case",
"(",
"metadata",
",",
"attr",
",",
"value",
")",
"create_changelog",
"(",
"bugtracker_url",
"=",
"getattr",
"(",
"metadata",
... | DEPRECATED | [
"DEPRECATED"
] | train | https://github.com/david-caro/python-autosemver/blob/3bc0adb70c33e4bd3623ae4c1944d5ee37f4303d/autosemver/__init__.py#L140-L144 |
majerteam/sylk_parser | sylk_parser/sylk.py | SYLK.parse | def parse(self, stream):
"""
Parse the given stream
"""
lines = re.sub("[\r\n]+", "\n", stream.read()).split("\n")
for line in lines:
self.parseline(line) | python | def parse(self, stream):
"""
Parse the given stream
"""
lines = re.sub("[\r\n]+", "\n", stream.read()).split("\n")
for line in lines:
self.parseline(line) | [
"def",
"parse",
"(",
"self",
",",
"stream",
")",
":",
"lines",
"=",
"re",
".",
"sub",
"(",
"\"[\\r\\n]+\"",
",",
"\"\\n\"",
",",
"stream",
".",
"read",
"(",
")",
")",
".",
"split",
"(",
"\"\\n\"",
")",
"for",
"line",
"in",
"lines",
":",
"self",
"... | Parse the given stream | [
"Parse",
"the",
"given",
"stream"
] | train | https://github.com/majerteam/sylk_parser/blob/0f62f9d3ca1c273017d7ea728f9db809f2241389/sylk_parser/sylk.py#L135-L141 |
tenforce/docker-py-aiohttp | aiodockerpy/utils/json_stream.py | stream_as_text | async def stream_as_text(stream):
"""
Given a stream of bytes or text, if any of the items in the stream
are bytes convert them to text.
This function can be removed once we return text streams
instead of byte streams.
"""
async for data in stream:
if not isinstance(data, six.text_ty... | python | async def stream_as_text(stream):
"""
Given a stream of bytes or text, if any of the items in the stream
are bytes convert them to text.
This function can be removed once we return text streams
instead of byte streams.
"""
async for data in stream:
if not isinstance(data, six.text_ty... | [
"async",
"def",
"stream_as_text",
"(",
"stream",
")",
":",
"async",
"for",
"data",
"in",
"stream",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"six",
".",
"text_type",
")",
":",
"data",
"=",
"data",
".",
"decode",
"(",
"'utf-8'",
",",
"'replace'"... | Given a stream of bytes or text, if any of the items in the stream
are bytes convert them to text.
This function can be removed once we return text streams
instead of byte streams. | [
"Given",
"a",
"stream",
"of",
"bytes",
"or",
"text",
"if",
"any",
"of",
"the",
"items",
"in",
"the",
"stream",
"are",
"bytes",
"convert",
"them",
"to",
"text",
".",
"This",
"function",
"can",
"be",
"removed",
"once",
"we",
"return",
"text",
"streams",
... | train | https://github.com/tenforce/docker-py-aiohttp/blob/ab997f18bdbeb6d83abc6e5281934493552015f3/aiodockerpy/utils/json_stream.py#L11-L21 |
wolfhong/formic | build.py | pylint_jenkins | def pylint_jenkins():
"""Run PyLint on the code and produce a report suitable for the
Jenkins plugin 'violations'.
Note that there is a bug in the Violations plugin which means that
absolute paths to source (produced by PyLint) are not read. The sed command
removes the workspace part of the path ma... | python | def pylint_jenkins():
"""Run PyLint on the code and produce a report suitable for the
Jenkins plugin 'violations'.
Note that there is a bug in the Violations plugin which means that
absolute paths to source (produced by PyLint) are not read. The sed command
removes the workspace part of the path ma... | [
"def",
"pylint_jenkins",
"(",
")",
":",
"cmd",
"=",
"'{0} formic -f parseable'",
".",
"format",
"(",
"PYLINT_EXE",
")",
".",
"split",
"(",
"' '",
")",
"return",
"dovetail",
".",
"call",
"(",
"cmd",
",",
"stdout",
"=",
"BUILD_PYLINT",
")"
] | Run PyLint on the code and produce a report suitable for the
Jenkins plugin 'violations'.
Note that there is a bug in the Violations plugin which means that
absolute paths to source (produced by PyLint) are not read. The sed command
removes the workspace part of the path making everything good again. T... | [
"Run",
"PyLint",
"on",
"the",
"code",
"and",
"produce",
"a",
"report",
"suitable",
"for",
"the",
"Jenkins",
"plugin",
"violations",
"."
] | train | https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/build.py#L47-L56 |
wolfhong/formic | build.py | configure_google_analytics | def configure_google_analytics():
"""An optional task; if run, this will switch on Google Analystics, reporting
documentation usage to Aviser.
This is meant to be run only by Aviser when producing HTML for the main
web site.
"""
f = open(os.path.join("doc", "_templates", "google-analytics.html"... | python | def configure_google_analytics():
"""An optional task; if run, this will switch on Google Analystics, reporting
documentation usage to Aviser.
This is meant to be run only by Aviser when producing HTML for the main
web site.
"""
f = open(os.path.join("doc", "_templates", "google-analytics.html"... | [
"def",
"configure_google_analytics",
"(",
")",
":",
"f",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"\"doc\"",
",",
"\"_templates\"",
",",
"\"google-analytics.html\"",
")",
",",
"\"w\"",
")",
"f",
".",
"write",
"(",
"\"\"\"<script type=\"text/javas... | An optional task; if run, this will switch on Google Analystics, reporting
documentation usage to Aviser.
This is meant to be run only by Aviser when producing HTML for the main
web site. | [
"An",
"optional",
"task",
";",
"if",
"run",
"this",
"will",
"switch",
"on",
"Google",
"Analystics",
"reporting",
"documentation",
"usage",
"to",
"Aviser",
"."
] | train | https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/build.py#L134-L155 |
wolfhong/formic | build.py | publish | def publish():
"""Publishes Formic to PyPi (don't run unless you are the maintainer)"""
print("To be ready for release, remember:")
print(" 1) Update the version number (and associated test)")
print(" 2) Update the ChangeLog.rst (and other documentation)")
print(
" ChangeLo... | python | def publish():
"""Publishes Formic to PyPi (don't run unless you are the maintainer)"""
print("To be ready for release, remember:")
print(" 1) Update the version number (and associated test)")
print(" 2) Update the ChangeLog.rst (and other documentation)")
print(
" ChangeLo... | [
"def",
"publish",
"(",
")",
":",
"print",
"(",
"\"To be ready for release, remember:\"",
")",
"print",
"(",
"\" 1) Update the version number (and associated test)\"",
")",
"print",
"(",
"\" 2) Update the ChangeLog.rst (and other documentation)\"",
")",
"print",
"(",
"... | Publishes Formic to PyPi (don't run unless you are the maintainer) | [
"Publishes",
"Formic",
"to",
"PyPi",
"(",
"don",
"t",
"run",
"unless",
"you",
"are",
"the",
"maintainer",
")"
] | train | https://github.com/wolfhong/formic/blob/0d81eb88dcbb6fa705194fc6ccf2993f4abbaa76/build.py#L174-L252 |
OTL/jps | jps/launcher.py | launch_modules_with_names | def launch_modules_with_names(modules_with_names, module_args={}, kill_before_launch=True):
'''launch module.main functions in another process'''
processes = []
if kill_before_launch:
for module_name, name in modules_with_names:
kill_module(name)
for module_name, name in modules_with... | python | def launch_modules_with_names(modules_with_names, module_args={}, kill_before_launch=True):
'''launch module.main functions in another process'''
processes = []
if kill_before_launch:
for module_name, name in modules_with_names:
kill_module(name)
for module_name, name in modules_with... | [
"def",
"launch_modules_with_names",
"(",
"modules_with_names",
",",
"module_args",
"=",
"{",
"}",
",",
"kill_before_launch",
"=",
"True",
")",
":",
"processes",
"=",
"[",
"]",
"if",
"kill_before_launch",
":",
"for",
"module_name",
",",
"name",
"in",
"modules_wit... | launch module.main functions in another process | [
"launch",
"module",
".",
"main",
"functions",
"in",
"another",
"process"
] | train | https://github.com/OTL/jps/blob/2c5a438d59611fffca6853072c822ef22665ed87/jps/launcher.py#L32-L49 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbums.list | def list(self, **kwds):
"""
Endpoint: /albums/list.json
Returns a list of Album objects.
"""
albums = self._client.get("/albums/list.json", **kwds)["result"]
albums = self._result_to_list(albums)
return [Album(self._client, album) for album in albums] | python | def list(self, **kwds):
"""
Endpoint: /albums/list.json
Returns a list of Album objects.
"""
albums = self._client.get("/albums/list.json", **kwds)["result"]
albums = self._result_to_list(albums)
return [Album(self._client, album) for album in albums] | [
"def",
"list",
"(",
"self",
",",
"*",
"*",
"kwds",
")",
":",
"albums",
"=",
"self",
".",
"_client",
".",
"get",
"(",
"\"/albums/list.json\"",
",",
"*",
"*",
"kwds",
")",
"[",
"\"result\"",
"]",
"albums",
"=",
"self",
".",
"_result_to_list",
"(",
"alb... | Endpoint: /albums/list.json
Returns a list of Album objects. | [
"Endpoint",
":",
"/",
"albums",
"/",
"list",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L12-L20 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.cover_update | def cover_update(self, album, photo, **kwds):
"""
Endpoint: /album/<album_id>/cover/<photo_id>/update.json
Update the cover photo of an album.
Returns the updated album object.
"""
result = self._client.post("/album/%s/cover/%s/update.json" %
... | python | def cover_update(self, album, photo, **kwds):
"""
Endpoint: /album/<album_id>/cover/<photo_id>/update.json
Update the cover photo of an album.
Returns the updated album object.
"""
result = self._client.post("/album/%s/cover/%s/update.json" %
... | [
"def",
"cover_update",
"(",
"self",
",",
"album",
",",
"photo",
",",
"*",
"*",
"kwds",
")",
":",
"result",
"=",
"self",
".",
"_client",
".",
"post",
"(",
"\"/album/%s/cover/%s/update.json\"",
"%",
"(",
"self",
".",
"_extract_id",
"(",
"album",
")",
",",
... | Endpoint: /album/<album_id>/cover/<photo_id>/update.json
Update the cover photo of an album.
Returns the updated album object. | [
"Endpoint",
":",
"/",
"album",
"/",
"<album_id",
">",
"/",
"cover",
"/",
"<photo_id",
">",
"/",
"update",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L24-L42 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.create | def create(self, name, **kwds):
"""
Endpoint: /album/create.json
Creates a new album and returns it.
"""
result = self._client.post("/album/create.json",
name=name, **kwds)["result"]
return Album(self._client, result) | python | def create(self, name, **kwds):
"""
Endpoint: /album/create.json
Creates a new album and returns it.
"""
result = self._client.post("/album/create.json",
name=name, **kwds)["result"]
return Album(self._client, result) | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwds",
")",
":",
"result",
"=",
"self",
".",
"_client",
".",
"post",
"(",
"\"/album/create.json\"",
",",
"name",
"=",
"name",
",",
"*",
"*",
"kwds",
")",
"[",
"\"result\"",
"]",
"return",
"... | Endpoint: /album/create.json
Creates a new album and returns it. | [
"Endpoint",
":",
"/",
"album",
"/",
"create",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L44-L52 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.delete | def delete(self, album, **kwds):
"""
Endpoint: /album/<id>/delete.json
Deletes an album.
Returns True if successful.
Raises a TroveboxError if not.
"""
return self._client.post("/album/%s/delete.json" %
self._extract_id(album),
... | python | def delete(self, album, **kwds):
"""
Endpoint: /album/<id>/delete.json
Deletes an album.
Returns True if successful.
Raises a TroveboxError if not.
"""
return self._client.post("/album/%s/delete.json" %
self._extract_id(album),
... | [
"def",
"delete",
"(",
"self",
",",
"album",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"_client",
".",
"post",
"(",
"\"/album/%s/delete.json\"",
"%",
"self",
".",
"_extract_id",
"(",
"album",
")",
",",
"*",
"*",
"kwds",
")",
"[",
"\"resu... | Endpoint: /album/<id>/delete.json
Deletes an album.
Returns True if successful.
Raises a TroveboxError if not. | [
"Endpoint",
":",
"/",
"album",
"/",
"<id",
">",
"/",
"delete",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L54-L64 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.add | def add(self, album, objects, object_type=None, **kwds):
"""
Endpoint: /album/<id>/<type>/add.json
Add objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatically.
... | python | def add(self, album, objects, object_type=None, **kwds):
"""
Endpoint: /album/<id>/<type>/add.json
Add objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatically.
... | [
"def",
"add",
"(",
"self",
",",
"album",
",",
"objects",
",",
"object_type",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"_add_remove",
"(",
"\"add\"",
",",
"album",
",",
"objects",
",",
"object_type",
",",
"*",
"*",
"kwds",
... | Endpoint: /album/<id>/<type>/add.json
Add objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatically.
Returns the updated album object. | [
"Endpoint",
":",
"/",
"album",
"/",
"<id",
">",
"/",
"<type",
">",
"/",
"add",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L66-L77 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.remove | def remove(self, album, objects, object_type=None, **kwds):
"""
Endpoint: /album/<id>/<type>/remove.json
Remove objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatic... | python | def remove(self, album, objects, object_type=None, **kwds):
"""
Endpoint: /album/<id>/<type>/remove.json
Remove objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatic... | [
"def",
"remove",
"(",
"self",
",",
"album",
",",
"objects",
",",
"object_type",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"_add_remove",
"(",
"\"remove\"",
",",
"album",
",",
"objects",
",",
"object_type",
",",
"*",
"*",
"k... | Endpoint: /album/<id>/<type>/remove.json
Remove objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatically.
Returns the updated album object. | [
"Endpoint",
":",
"/",
"album",
"/",
"<id",
">",
"/",
"<type",
">",
"/",
"remove",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L79-L90 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum._add_remove | def _add_remove(self, action, album, objects, object_type=None,
**kwds):
"""Common code for the add and remove endpoints."""
# Ensure we have an iterable of objects
if not isinstance(objects, collections.Iterable):
objects = [objects]
# Extract the type o... | python | def _add_remove(self, action, album, objects, object_type=None,
**kwds):
"""Common code for the add and remove endpoints."""
# Ensure we have an iterable of objects
if not isinstance(objects, collections.Iterable):
objects = [objects]
# Extract the type o... | [
"def",
"_add_remove",
"(",
"self",
",",
"action",
",",
"album",
",",
"objects",
",",
"object_type",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"# Ensure we have an iterable of objects",
"if",
"not",
"isinstance",
"(",
"objects",
",",
"collections",
".",
"... | Common code for the add and remove endpoints. | [
"Common",
"code",
"for",
"the",
"add",
"and",
"remove",
"endpoints",
"."
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L92-L122 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.update | def update(self, album, **kwds):
"""
Endpoint: /album/<id>/update.json
Updates an album with the specified parameters.
Returns the updated album object.
"""
result = self._client.post("/album/%s/update.json" %
self._extract_id(album),
... | python | def update(self, album, **kwds):
"""
Endpoint: /album/<id>/update.json
Updates an album with the specified parameters.
Returns the updated album object.
"""
result = self._client.post("/album/%s/update.json" %
self._extract_id(album),
... | [
"def",
"update",
"(",
"self",
",",
"album",
",",
"*",
"*",
"kwds",
")",
":",
"result",
"=",
"self",
".",
"_client",
".",
"post",
"(",
"\"/album/%s/update.json\"",
"%",
"self",
".",
"_extract_id",
"(",
"album",
")",
",",
"*",
"*",
"kwds",
")",
"[",
... | Endpoint: /album/<id>/update.json
Updates an album with the specified parameters.
Returns the updated album object. | [
"Endpoint",
":",
"/",
"album",
"/",
"<id",
">",
"/",
"update",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L124-L140 |
photo/openphoto-python | trovebox/api/api_album.py | ApiAlbum.view | def view(self, album, **kwds):
"""
Endpoint: /album/<id>/view.json
Requests all properties of an album.
Returns the requested album object.
"""
result = self._client.get("/album/%s/view.json" %
self._extract_id(album),
... | python | def view(self, album, **kwds):
"""
Endpoint: /album/<id>/view.json
Requests all properties of an album.
Returns the requested album object.
"""
result = self._client.get("/album/%s/view.json" %
self._extract_id(album),
... | [
"def",
"view",
"(",
"self",
",",
"album",
",",
"*",
"*",
"kwds",
")",
":",
"result",
"=",
"self",
".",
"_client",
".",
"get",
"(",
"\"/album/%s/view.json\"",
"%",
"self",
".",
"_extract_id",
"(",
"album",
")",
",",
"*",
"*",
"kwds",
")",
"[",
"\"re... | Endpoint: /album/<id>/view.json
Requests all properties of an album.
Returns the requested album object. | [
"Endpoint",
":",
"/",
"album",
"/",
"<id",
">",
"/",
"view",
".",
"json"
] | train | https://github.com/photo/openphoto-python/blob/209a1da27c8d8c88dbcf4ea6c6f57031ea1bc44b/trovebox/api/api_album.py#L142-L152 |
peopledoc/django-pimpmytheme | pimpmytheme/management/commands/update_themefolder_from_git.py | Command.clone | def clone(self, folder, git_repository):
"""Ensures theme destination folder and clone git specified repo in it.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder
"""
os.makedirs(folder)
git.Git().clone(git_repository,... | python | def clone(self, folder, git_repository):
"""Ensures theme destination folder and clone git specified repo in it.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder
"""
os.makedirs(folder)
git.Git().clone(git_repository,... | [
"def",
"clone",
"(",
"self",
",",
"folder",
",",
"git_repository",
")",
":",
"os",
".",
"makedirs",
"(",
"folder",
")",
"git",
".",
"Git",
"(",
")",
".",
"clone",
"(",
"git_repository",
",",
"folder",
")"
] | Ensures theme destination folder and clone git specified repo in it.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder | [
"Ensures",
"theme",
"destination",
"folder",
"and",
"clone",
"git",
"specified",
"repo",
"in",
"it",
"."
] | train | https://github.com/peopledoc/django-pimpmytheme/blob/302c65bec52bbd9e0a17de68ad337ef4a6205556/pimpmytheme/management/commands/update_themefolder_from_git.py#L90-L97 |
peopledoc/django-pimpmytheme | pimpmytheme/management/commands/update_themefolder_from_git.py | Command.update_git_repository | def update_git_repository(self, folder, git_repository):
"""Updates git remote for the managed theme folder if has changed.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder
"""
# load repo object from path
repo = git... | python | def update_git_repository(self, folder, git_repository):
"""Updates git remote for the managed theme folder if has changed.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder
"""
# load repo object from path
repo = git... | [
"def",
"update_git_repository",
"(",
"self",
",",
"folder",
",",
"git_repository",
")",
":",
"# load repo object from path",
"repo",
"=",
"git",
".",
"Repo",
"(",
"folder",
")",
"# keep local_head_name for to reset folder remote head later",
"local_head_name",
"=",
"repo"... | Updates git remote for the managed theme folder if has changed.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder | [
"Updates",
"git",
"remote",
"for",
"the",
"managed",
"theme",
"folder",
"if",
"has",
"changed",
"."
] | train | https://github.com/peopledoc/django-pimpmytheme/blob/302c65bec52bbd9e0a17de68ad337ef4a6205556/pimpmytheme/management/commands/update_themefolder_from_git.py#L99-L128 |
peopledoc/django-pimpmytheme | pimpmytheme/management/commands/update_themefolder_from_git.py | Command.update | def update(self, folder, git_repository):
"""Creates or updates theme folder according given git repository.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder
"""
# git clone
try:
self.clone(folder, git_rep... | python | def update(self, folder, git_repository):
"""Creates or updates theme folder according given git repository.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder
"""
# git clone
try:
self.clone(folder, git_rep... | [
"def",
"update",
"(",
"self",
",",
"folder",
",",
"git_repository",
")",
":",
"# git clone",
"try",
":",
"self",
".",
"clone",
"(",
"folder",
",",
"git_repository",
")",
"# git update if folder already exist",
"except",
"OSError",
":",
"self",
".",
"update_git_r... | Creates or updates theme folder according given git repository.
:param git_repository: git url of the theme folder
:param folder: path of the git managed theme folder | [
"Creates",
"or",
"updates",
"theme",
"folder",
"according",
"given",
"git",
"repository",
"."
] | train | https://github.com/peopledoc/django-pimpmytheme/blob/302c65bec52bbd9e0a17de68ad337ef4a6205556/pimpmytheme/management/commands/update_themefolder_from_git.py#L137-L149 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | main | def main(argString=None):
"""The main function of the module.
:param argString: the options.
:type argString: list
These are the steps:
1. Prints the options.
2. If there are ``summarized_intensities`` provided, reads the files
(:py:func:`read_summarized_intensities`) and skips to ste... | python | def main(argString=None):
"""The main function of the module.
:param argString: the options.
:type argString: list
These are the steps:
1. Prints the options.
2. If there are ``summarized_intensities`` provided, reads the files
(:py:func:`read_summarized_intensities`) and skips to ste... | [
"def",
"main",
"(",
"argString",
"=",
"None",
")",
":",
"# Getting and checking the options",
"args",
"=",
"parseArgs",
"(",
"argString",
")",
"checkArgs",
"(",
"args",
")",
"data",
"=",
"None",
"if",
"args",
".",
"summarized_intensities",
"is",
"None",
":",
... | The main function of the module.
:param argString: the options.
:type argString: list
These are the steps:
1. Prints the options.
2. If there are ``summarized_intensities`` provided, reads the files
(:py:func:`read_summarized_intensities`) and skips to step 7.
3. Reads the ``bim`` fil... | [
"The",
"main",
"function",
"of",
"the",
"module",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L32-L76 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | read_sex_problems | def read_sex_problems(file_name):
"""Reads the sex problem file.
:param file_name: the name of the file containing sex problems.
:type file_name: str
:returns: a :py:class:`frozenset` containing samples with sex problem.
If there is no ``file_name`` (*i.e.* is ``None``), then an empty
:py:cl... | python | def read_sex_problems(file_name):
"""Reads the sex problem file.
:param file_name: the name of the file containing sex problems.
:type file_name: str
:returns: a :py:class:`frozenset` containing samples with sex problem.
If there is no ``file_name`` (*i.e.* is ``None``), then an empty
:py:cl... | [
"def",
"read_sex_problems",
"(",
"file_name",
")",
":",
"if",
"file_name",
"is",
"None",
":",
"return",
"frozenset",
"(",
")",
"problems",
"=",
"None",
"with",
"open",
"(",
"file_name",
",",
"'r'",
")",
"as",
"input_file",
":",
"header_index",
"=",
"dict",... | Reads the sex problem file.
:param file_name: the name of the file containing sex problems.
:type file_name: str
:returns: a :py:class:`frozenset` containing samples with sex problem.
If there is no ``file_name`` (*i.e.* is ``None``), then an empty
:py:class:`frozenset` is returned. | [
"Reads",
"the",
"sex",
"problem",
"file",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L79-L109 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | encode_chr | def encode_chr(chromosome):
"""Encodes chromosomes.
:param chromosome: the chromosome to encode.
:type chromosome: str
:returns: the encoded chromosome as :py:class:`int`.
It changes ``X``, ``Y``, ``XY`` and ``MT`` to ``23``, ``24``, ``25`` and
``26``, respectively. It changes everything els... | python | def encode_chr(chromosome):
"""Encodes chromosomes.
:param chromosome: the chromosome to encode.
:type chromosome: str
:returns: the encoded chromosome as :py:class:`int`.
It changes ``X``, ``Y``, ``XY`` and ``MT`` to ``23``, ``24``, ``25`` and
``26``, respectively. It changes everything els... | [
"def",
"encode_chr",
"(",
"chromosome",
")",
":",
"if",
"chromosome",
"==",
"\"X\"",
":",
"return",
"23",
"if",
"chromosome",
"==",
"\"Y\"",
":",
"return",
"24",
"if",
"chromosome",
"==",
"\"XY\"",
":",
"return",
"25",
"if",
"chromosome",
"==",
"\"MT\"",
... | Encodes chromosomes.
:param chromosome: the chromosome to encode.
:type chromosome: str
:returns: the encoded chromosome as :py:class:`int`.
It changes ``X``, ``Y``, ``XY`` and ``MT`` to ``23``, ``24``, ``25`` and
``26``, respectively. It changes everything else as :py:class:`int`.
If :py:c... | [
"Encodes",
"chromosomes",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L112-L168 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | read_bim | def read_bim(file_name):
"""Reads the BIM file to gather marker names.
:param file_name: the name of the ``bim`` file.
:type file_name: str
:returns: a :py:class:`dict` containing the chromosomal location of each
marker on the sexual chromosomes.
It uses the :py:func:`encode_chr` t... | python | def read_bim(file_name):
"""Reads the BIM file to gather marker names.
:param file_name: the name of the ``bim`` file.
:type file_name: str
:returns: a :py:class:`dict` containing the chromosomal location of each
marker on the sexual chromosomes.
It uses the :py:func:`encode_chr` t... | [
"def",
"read_bim",
"(",
"file_name",
")",
":",
"marker_names_chr",
"=",
"None",
"with",
"open",
"(",
"file_name",
",",
"'r'",
")",
"as",
"input_file",
":",
"marker_names_chr",
"=",
"dict",
"(",
"[",
"(",
"i",
"[",
"1",
"]",
",",
"encode_chr",
"(",
"i",... | Reads the BIM file to gather marker names.
:param file_name: the name of the ``bim`` file.
:type file_name: str
:returns: a :py:class:`dict` containing the chromosomal location of each
marker on the sexual chromosomes.
It uses the :py:func:`encode_chr` to encode the chromosomes from ``... | [
"Reads",
"the",
"BIM",
"file",
"to",
"gather",
"marker",
"names",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L206-L228 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | read_fam | def read_fam(file_name):
"""Reads the FAM file to gather sample names.
:param file_name: the ``fam`` file to read.
:type file_name: str
:returns: a :py:class:`dict` containing the gender of each samples.
It uses the :py:func:`encode_gender` to encode the gender from ``1``and
``2`` to ``Male`... | python | def read_fam(file_name):
"""Reads the FAM file to gather sample names.
:param file_name: the ``fam`` file to read.
:type file_name: str
:returns: a :py:class:`dict` containing the gender of each samples.
It uses the :py:func:`encode_gender` to encode the gender from ``1``and
``2`` to ``Male`... | [
"def",
"read_fam",
"(",
"file_name",
")",
":",
"sample_names_gender",
"=",
"None",
"with",
"open",
"(",
"file_name",
",",
"'r'",
")",
"as",
"input_file",
":",
"sample_names_gender",
"=",
"dict",
"(",
"[",
"(",
"i",
"[",
"1",
"]",
",",
"encode_gender",
"(... | Reads the FAM file to gather sample names.
:param file_name: the ``fam`` file to read.
:type file_name: str
:returns: a :py:class:`dict` containing the gender of each samples.
It uses the :py:func:`encode_gender` to encode the gender from ``1``and
``2`` to ``Male`` and ``Female``, respectively. | [
"Reads",
"the",
"FAM",
"file",
"to",
"gather",
"sample",
"names",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L231-L251 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | plot_gender | def plot_gender(data, options):
"""Plots the gender.
:param data: the data to plot.
:param options: the options.
:type data: numpy.recarray
:type options: argparse.Namespace
Plots the summarized intensities of the markers on the Y chromosomes in
function of the markers on the X chromosome... | python | def plot_gender(data, options):
"""Plots the gender.
:param data: the data to plot.
:param options: the options.
:type data: numpy.recarray
:type options: argparse.Namespace
Plots the summarized intensities of the markers on the Y chromosomes in
function of the markers on the X chromosome... | [
"def",
"plot_gender",
"(",
"data",
",",
"options",
")",
":",
"if",
"data",
"is",
"None",
":",
"# there is a problem...",
"msg",
"=",
"(",
"\"no data: specify either '--bfile' and '--intensities', or \"",
"\"'--summarized-intensities'\"",
")",
"raise",
"ProgramError",
"(",... | Plots the gender.
:param data: the data to plot.
:param options: the options.
:type data: numpy.recarray
:type options: argparse.Namespace
Plots the summarized intensities of the markers on the Y chromosomes in
function of the markers on the X chromosomes, with problematic samples with
di... | [
"Plots",
"the",
"gender",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L254-L387 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | print_data_to_file | def print_data_to_file(data, file_name):
"""Prints data to file.
:param data: the data to print.
:param file_name: the name of the output file.
:type data: numpy.recarray
:type file_name: str
"""
try:
with open(file_name, 'w') as output_file:
print >>output_file, "\t".... | python | def print_data_to_file(data, file_name):
"""Prints data to file.
:param data: the data to print.
:param file_name: the name of the output file.
:type data: numpy.recarray
:type file_name: str
"""
try:
with open(file_name, 'w') as output_file:
print >>output_file, "\t".... | [
"def",
"print_data_to_file",
"(",
"data",
",",
"file_name",
")",
":",
"try",
":",
"with",
"open",
"(",
"file_name",
",",
"'w'",
")",
"as",
"output_file",
":",
"print",
">>",
"output_file",
",",
"\"\\t\"",
".",
"join",
"(",
"data",
".",
"dtype",
".",
"n... | Prints data to file.
:param data: the data to print.
:param file_name: the name of the output file.
:type data: numpy.recarray
:type file_name: str | [
"Prints",
"data",
"to",
"file",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L390-L407 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | read_summarized_intensities | def read_summarized_intensities(prefix):
"""Reads the summarized intensities from 6 files.
:param prefix: the prefix of the six files.
:type prefix: str
:returns: a :py:class`numpy.recarray` containing the following columns (for
each of the samples): ``sampleID``, ``chr23``, ``chr24``,
... | python | def read_summarized_intensities(prefix):
"""Reads the summarized intensities from 6 files.
:param prefix: the prefix of the six files.
:type prefix: str
:returns: a :py:class`numpy.recarray` containing the following columns (for
each of the samples): ``sampleID``, ``chr23``, ``chr24``,
... | [
"def",
"read_summarized_intensities",
"(",
"prefix",
")",
":",
"data",
"=",
"[",
"]",
"for",
"suffix",
"in",
"{",
"\".ok_females.txt\"",
",",
"\".ok_males.txt\"",
",",
"\".ok_unknowns.txt\"",
",",
"\".problematic_females.txt\"",
",",
"\".problematic_males.txt\"",
",",
... | Reads the summarized intensities from 6 files.
:param prefix: the prefix of the six files.
:type prefix: str
:returns: a :py:class`numpy.recarray` containing the following columns (for
each of the samples): ``sampleID``, ``chr23``, ``chr24``,
``gender`` and ``status``.
In... | [
"Reads",
"the",
"summarized",
"intensities",
"from",
"6",
"files",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L410-L503 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | read_intensities | def read_intensities(file_name, needed_markers_chr, needed_samples_gender,
sex_problems):
"""Reads the intensities from a file.
:param file_name: the name of the input file.
:param needed_markers_chr: the markers that are needed.
:param needed_samples_gender: the gender of all the ... | python | def read_intensities(file_name, needed_markers_chr, needed_samples_gender,
sex_problems):
"""Reads the intensities from a file.
:param file_name: the name of the input file.
:param needed_markers_chr: the markers that are needed.
:param needed_samples_gender: the gender of all the ... | [
"def",
"read_intensities",
"(",
"file_name",
",",
"needed_markers_chr",
",",
"needed_samples_gender",
",",
"sex_problems",
")",
":",
"input_file",
"=",
"None",
"if",
"file_name",
".",
"endswith",
"(",
"\".gz\"",
")",
":",
"input_file",
"=",
"gzip",
".",
"open",
... | Reads the intensities from a file.
:param file_name: the name of the input file.
:param needed_markers_chr: the markers that are needed.
:param needed_samples_gender: the gender of all the samples.
:param sex_problems: the sample with sex problem.
:type file_name: str
:type needed_markers_chr:... | [
"Reads",
"the",
"intensities",
"from",
"a",
"file",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L506-L638 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | checkArgs | def checkArgs(args):
"""Checks the arguments and options.
:param args: an object containing the options of the program.
:type args: argparse.Namespace
:returns: ``True`` if everything was OK.
If there is a problem with an option, an exception is raised using the
:py:class:`ProgramError` clas... | python | def checkArgs(args):
"""Checks the arguments and options.
:param args: an object containing the options of the program.
:type args: argparse.Namespace
:returns: ``True`` if everything was OK.
If there is a problem with an option, an exception is raised using the
:py:class:`ProgramError` clas... | [
"def",
"checkArgs",
"(",
"args",
")",
":",
"# Checking if there are input files",
"if",
"args",
".",
"summarized_intensities",
"is",
"None",
":",
"if",
"args",
".",
"bfile",
"is",
"None",
"and",
"args",
".",
"intensities",
"is",
"None",
":",
"msg",
"=",
"(",... | Checks the arguments and options.
:param args: an object containing the options of the program.
:type args: argparse.Namespace
:returns: ``True`` if everything was OK.
If there is a problem with an option, an exception is raised using the
:py:class:`ProgramError` class, a message is printed to t... | [
"Checks",
"the",
"arguments",
"and",
"options",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L641-L692 |
lemieuxl/pyGenClean | pyGenClean/SexCheck/gender_plot.py | safe_main | def safe_main():
"""A safe version of the main function (that catches ProgramError)."""
try:
main()
except KeyboardInterrupt:
logger.info("Cancelled by user")
sys.exit(0)
except ProgramError as e:
logger.error(e.message)
parser.error(e.message) | python | def safe_main():
"""A safe version of the main function (that catches ProgramError)."""
try:
main()
except KeyboardInterrupt:
logger.info("Cancelled by user")
sys.exit(0)
except ProgramError as e:
logger.error(e.message)
parser.error(e.message) | [
"def",
"safe_main",
"(",
")",
":",
"try",
":",
"main",
"(",
")",
"except",
"KeyboardInterrupt",
":",
"logger",
".",
"info",
"(",
"\"Cancelled by user\"",
")",
"sys",
".",
"exit",
"(",
"0",
")",
"except",
"ProgramError",
"as",
"e",
":",
"logger",
".",
"... | A safe version of the main function (that catches ProgramError). | [
"A",
"safe",
"version",
"of",
"the",
"main",
"function",
"(",
"that",
"catches",
"ProgramError",
")",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L810-L819 |
ilblackdragon/django-misc | misc/managers.py | SoftDeleteManager.filter | def filter(self, *args, **kwargs):
"""If id or pk was specified as a kwargs, return even if it's deleteted."""
if 'pk' in kwargs or 'id' in kwargs:
return self.all_with_deleted().filter(*args, **kwargs)
return self.get_query_set().filter(*args, **kwargs) | python | def filter(self, *args, **kwargs):
"""If id or pk was specified as a kwargs, return even if it's deleteted."""
if 'pk' in kwargs or 'id' in kwargs:
return self.all_with_deleted().filter(*args, **kwargs)
return self.get_query_set().filter(*args, **kwargs) | [
"def",
"filter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'pk'",
"in",
"kwargs",
"or",
"'id'",
"in",
"kwargs",
":",
"return",
"self",
".",
"all_with_deleted",
"(",
")",
".",
"filter",
"(",
"*",
"args",
",",
"*",
"*... | If id or pk was specified as a kwargs, return even if it's deleteted. | [
"If",
"id",
"or",
"pk",
"was",
"specified",
"as",
"a",
"kwargs",
"return",
"even",
"if",
"it",
"s",
"deleteted",
"."
] | train | https://github.com/ilblackdragon/django-misc/blob/0accd2dc97de656a1c9e275be81e817f78a2eb9d/misc/managers.py#L43-L47 |
mozilla/popcoder | popcoder/video.py | Video.preprocess | def preprocess(self, data):
"""
Processes popcorn JSON and builds a sane data model out of it
@param data : The popcorn editor project json blob
"""
print 'Beginning pre-process...'
for url, video in data['media'][0]['clipData'].iteritems():
print 'Downloadin... | python | def preprocess(self, data):
"""
Processes popcorn JSON and builds a sane data model out of it
@param data : The popcorn editor project json blob
"""
print 'Beginning pre-process...'
for url, video in data['media'][0]['clipData'].iteritems():
print 'Downloadin... | [
"def",
"preprocess",
"(",
"self",
",",
"data",
")",
":",
"print",
"'Beginning pre-process...'",
"for",
"url",
",",
"video",
"in",
"data",
"[",
"'media'",
"]",
"[",
"0",
"]",
"[",
"'clipData'",
"]",
".",
"iteritems",
"(",
")",
":",
"print",
"'Downloading ... | Processes popcorn JSON and builds a sane data model out of it
@param data : The popcorn editor project json blob | [
"Processes",
"popcorn",
"JSON",
"and",
"builds",
"a",
"sane",
"data",
"model",
"out",
"of",
"it"
] | train | https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/video.py#L205-L272 |
mozilla/popcoder | popcoder/video.py | Video.parse_duration | def parse_duration(self):
"""
Corrects for any offsets that may have been created by loop and skip
events
"""
for edit in self.track_edits:
if edit.edit_type == 'loopPlugin':
self.duration += (
(edit.options['end'] -
... | python | def parse_duration(self):
"""
Corrects for any offsets that may have been created by loop and skip
events
"""
for edit in self.track_edits:
if edit.edit_type == 'loopPlugin':
self.duration += (
(edit.options['end'] -
... | [
"def",
"parse_duration",
"(",
"self",
")",
":",
"for",
"edit",
"in",
"self",
".",
"track_edits",
":",
"if",
"edit",
".",
"edit_type",
"==",
"'loopPlugin'",
":",
"self",
".",
"duration",
"+=",
"(",
"(",
"edit",
".",
"options",
"[",
"'end'",
"]",
"-",
... | Corrects for any offsets that may have been created by loop and skip
events | [
"Corrects",
"for",
"any",
"offsets",
"that",
"may",
"have",
"been",
"created",
"by",
"loop",
"and",
"skip",
"events"
] | train | https://github.com/mozilla/popcoder/blob/9b1b99a14b942e5dbfa76bc6de7c7074afa736e8/popcoder/video.py#L274-L285 |
lemieuxl/pyGenClean | pyGenClean/LaTeX/utils.py | wrap_lines | def wrap_lines(content, length=80):
"""Wraps long lines to a maximum length of 80.
:param content: the content to wrap.
:param legnth: the maximum length to wrap the content.
:type content: str
:type length: int
:returns: a string containing the wrapped content.
:rtype: str
"""
r... | python | def wrap_lines(content, length=80):
"""Wraps long lines to a maximum length of 80.
:param content: the content to wrap.
:param legnth: the maximum length to wrap the content.
:type content: str
:type length: int
:returns: a string containing the wrapped content.
:rtype: str
"""
r... | [
"def",
"wrap_lines",
"(",
"content",
",",
"length",
"=",
"80",
")",
":",
"return",
"\"\\n\"",
".",
"join",
"(",
"textwrap",
".",
"wrap",
"(",
"content",
",",
"length",
",",
"break_long_words",
"=",
"False",
")",
")"
] | Wraps long lines to a maximum length of 80.
:param content: the content to wrap.
:param legnth: the maximum length to wrap the content.
:type content: str
:type length: int
:returns: a string containing the wrapped content.
:rtype: str | [
"Wraps",
"long",
"lines",
"to",
"a",
"maximum",
"length",
"of",
"80",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/utils.py#L155-L168 |
lemieuxl/pyGenClean | pyGenClean/LaTeX/utils.py | format_numbers | def format_numbers(number, prefix=""):
"""Formats number in the scientific notation for LaTeX.
:param number: the number to format.
:param prefix: a prefix to add before the number (e.g. "p < ").
:type number: str
:type prefix: str
:returns: a string containing the scientific notation of the ... | python | def format_numbers(number, prefix=""):
"""Formats number in the scientific notation for LaTeX.
:param number: the number to format.
:param prefix: a prefix to add before the number (e.g. "p < ").
:type number: str
:type prefix: str
:returns: a string containing the scientific notation of the ... | [
"def",
"format_numbers",
"(",
"number",
",",
"prefix",
"=",
"\"\"",
")",
":",
"# Matching",
"r",
"=",
"re",
".",
"match",
"(",
"r\"^([-+]?\\d*\\.\\d+|\\d+)e([-+]?\\d+)$\"",
",",
"number",
")",
"# Nothing matched",
"if",
"not",
"r",
":",
"if",
"prefix",
"!=",
... | Formats number in the scientific notation for LaTeX.
:param number: the number to format.
:param prefix: a prefix to add before the number (e.g. "p < ").
:type number: str
:type prefix: str
:returns: a string containing the scientific notation of the number.
:rtype: str | [
"Formats",
"number",
"in",
"the",
"scientific",
"notation",
"for",
"LaTeX",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/utils.py#L171-L198 |
lemieuxl/pyGenClean | pyGenClean/LaTeX/utils.py | sanitize_fig_name | def sanitize_fig_name(name):
"""Sanitizes the name of a file (for including graphics in LaTeX).
:param name: the name of the file to sanitize.
:type name: str
:returns: the sanitized name.
For example, if the name of the graphic file is ``test.1.png``, the
sanitized version of it for LaTeX is... | python | def sanitize_fig_name(name):
"""Sanitizes the name of a file (for including graphics in LaTeX).
:param name: the name of the file to sanitize.
:type name: str
:returns: the sanitized name.
For example, if the name of the graphic file is ``test.1.png``, the
sanitized version of it for LaTeX is... | [
"def",
"sanitize_fig_name",
"(",
"name",
")",
":",
"name",
",",
"extension",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"name",
")",
"return",
"\"{\"",
"+",
"name",
"+",
"\"}\"",
"+",
"extension"
] | Sanitizes the name of a file (for including graphics in LaTeX).
:param name: the name of the file to sanitize.
:type name: str
:returns: the sanitized name.
For example, if the name of the graphic file is ``test.1.png``, the
sanitized version of it for LaTeX is ``{test.1}.png``. | [
"Sanitizes",
"the",
"name",
"of",
"a",
"file",
"(",
"for",
"including",
"graphics",
"in",
"LaTeX",
")",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/utils.py#L201-L214 |
lemieuxl/pyGenClean | pyGenClean/LaTeX/utils.py | sanitize_tex | def sanitize_tex(original_text):
"""Sanitize TeX text.
:param original_text: the text to sanitize for LaTeX.
:type original_text: str
:returns: the sanitize text.
Text is sanitized by following these steps:
1. Replaces ``\\` by ``\\textbackslash``
2. Escapes certain characters (such as ... | python | def sanitize_tex(original_text):
"""Sanitize TeX text.
:param original_text: the text to sanitize for LaTeX.
:type original_text: str
:returns: the sanitize text.
Text is sanitized by following these steps:
1. Replaces ``\\` by ``\\textbackslash``
2. Escapes certain characters (such as ... | [
"def",
"sanitize_tex",
"(",
"original_text",
")",
":",
"# The backslashes",
"sanitized_tex",
"=",
"original_text",
".",
"replace",
"(",
"\"\\\\\"",
",",
"r\"\\textbackslash \"",
")",
"# Escaping",
"sanitized_tex",
"=",
"re",
".",
"sub",
"(",
"r\"([{}])\"",
".",
"f... | Sanitize TeX text.
:param original_text: the text to sanitize for LaTeX.
:type original_text: str
:returns: the sanitize text.
Text is sanitized by following these steps:
1. Replaces ``\\` by ``\\textbackslash``
2. Escapes certain characters (such as ``$``, ``%``, ``_``, ``}``, ``{``,
... | [
"Sanitize",
"TeX",
"text",
"."
] | train | https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/utils.py#L217-L246 |
gasparka/pyhacores | under_construction/fsk_modulator/model.py | FSKModulator.main | def main(self, symbol):
"""
:param symbol: Bit to modulate
:return: Modulated signal in baseband
:rtype: Complex
"""
if symbol:
phase_step = self.sensitivity_pos
else:
phase_step = self.sensitivity_neg
cout = self.nco.main(phase_st... | python | def main(self, symbol):
"""
:param symbol: Bit to modulate
:return: Modulated signal in baseband
:rtype: Complex
"""
if symbol:
phase_step = self.sensitivity_pos
else:
phase_step = self.sensitivity_neg
cout = self.nco.main(phase_st... | [
"def",
"main",
"(",
"self",
",",
"symbol",
")",
":",
"if",
"symbol",
":",
"phase_step",
"=",
"self",
".",
"sensitivity_pos",
"else",
":",
"phase_step",
"=",
"self",
".",
"sensitivity_neg",
"cout",
"=",
"self",
".",
"nco",
".",
"main",
"(",
"phase_step",
... | :param symbol: Bit to modulate
:return: Modulated signal in baseband
:rtype: Complex | [
":",
"param",
"symbol",
":",
"Bit",
"to",
"modulate",
":",
"return",
":",
"Modulated",
"signal",
"in",
"baseband",
":",
"rtype",
":",
"Complex"
] | train | https://github.com/gasparka/pyhacores/blob/16c186fbbf90385f2ba3498395123e79b6fcf340/under_construction/fsk_modulator/model.py#L36-L48 |
radjkarl/fancyWidgets | fancywidgets/pyQtBased/CodeEditor.py | _CodeTextEdit.contextMenuEvent | def contextMenuEvent(self, event):
"""
Add menu action:
* 'Show line numbers'
* 'Save to file'
"""
menu = QtWidgets.QPlainTextEdit.createStandardContextMenu(self)
mg = self.getGlobalsMenu()
a0 = menu.actions()[0]
menu.insertMenu(a0, mg)
me... | python | def contextMenuEvent(self, event):
"""
Add menu action:
* 'Show line numbers'
* 'Save to file'
"""
menu = QtWidgets.QPlainTextEdit.createStandardContextMenu(self)
mg = self.getGlobalsMenu()
a0 = menu.actions()[0]
menu.insertMenu(a0, mg)
me... | [
"def",
"contextMenuEvent",
"(",
"self",
",",
"event",
")",
":",
"menu",
"=",
"QtWidgets",
".",
"QPlainTextEdit",
".",
"createStandardContextMenu",
"(",
"self",
")",
"mg",
"=",
"self",
".",
"getGlobalsMenu",
"(",
")",
"a0",
"=",
"menu",
".",
"actions",
"(",... | Add menu action:
* 'Show line numbers'
* 'Save to file' | [
"Add",
"menu",
"action",
":",
"*",
"Show",
"line",
"numbers",
"*",
"Save",
"to",
"file"
] | train | https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/CodeEditor.py#L278-L304 |
radjkarl/fancyWidgets | fancywidgets/pyQtBased/CodeEditor.py | _CodeTextEdit.saveToFile | def saveToFile(self):
"""
Save the current text to file
"""
filename = self.codeEditor.dialog.getSaveFileName()
if filename and filename != '.':
with open(filename, 'w') as f:
f.write(self.toPlainText())
print('saved script under %s' % file... | python | def saveToFile(self):
"""
Save the current text to file
"""
filename = self.codeEditor.dialog.getSaveFileName()
if filename and filename != '.':
with open(filename, 'w') as f:
f.write(self.toPlainText())
print('saved script under %s' % file... | [
"def",
"saveToFile",
"(",
"self",
")",
":",
"filename",
"=",
"self",
".",
"codeEditor",
".",
"dialog",
".",
"getSaveFileName",
"(",
")",
"if",
"filename",
"and",
"filename",
"!=",
"'.'",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",... | Save the current text to file | [
"Save",
"the",
"current",
"text",
"to",
"file"
] | train | https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/CodeEditor.py#L306-L314 |
radjkarl/fancyWidgets | fancywidgets/pyQtBased/CodeEditor.py | _LineNumberArea._updateNumbers | def _updateNumbers(self, linenumers):
"""
add/remove line numbers
"""
b = self.blockCount()
c = b - linenumers
if c > 0:
# remove lines numbers
for _ in range(c):
# remove last line:
self.setFocus()
s... | python | def _updateNumbers(self, linenumers):
"""
add/remove line numbers
"""
b = self.blockCount()
c = b - linenumers
if c > 0:
# remove lines numbers
for _ in range(c):
# remove last line:
self.setFocus()
s... | [
"def",
"_updateNumbers",
"(",
"self",
",",
"linenumers",
")",
":",
"b",
"=",
"self",
".",
"blockCount",
"(",
")",
"c",
"=",
"b",
"-",
"linenumers",
"if",
"c",
">",
"0",
":",
"# remove lines numbers",
"for",
"_",
"in",
"range",
"(",
"c",
")",
":",
"... | add/remove line numbers | [
"add",
"/",
"remove",
"line",
"numbers"
] | train | https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/fancywidgets/pyQtBased/CodeEditor.py#L349-L376 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.