partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | TreeNode.add_feature | Add or update a node's feature. | toytree/etemini.py | def add_feature(self, pr_name, pr_value):
""" Add or update a node's feature. """
setattr(self, pr_name, pr_value)
self.features.add(pr_name) | def add_feature(self, pr_name, pr_value):
""" Add or update a node's feature. """
setattr(self, pr_name, pr_value)
self.features.add(pr_name) | [
"Add",
"or",
"update",
"a",
"node",
"s",
"feature",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L218-L221 | [
"def",
"add_feature",
"(",
"self",
",",
"pr_name",
",",
"pr_value",
")",
":",
"setattr",
"(",
"self",
",",
"pr_name",
",",
"pr_value",
")",
"self",
".",
"features",
".",
"add",
"(",
"pr_name",
")"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.add_features | Add or update several features. | toytree/etemini.py | def add_features(self, **features):
""" Add or update several features. """
for fname, fvalue in six.iteritems(features):
setattr(self, fname, fvalue)
self.features.add(fname) | def add_features(self, **features):
""" Add or update several features. """
for fname, fvalue in six.iteritems(features):
setattr(self, fname, fvalue)
self.features.add(fname) | [
"Add",
"or",
"update",
"several",
"features",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L224-L228 | [
"def",
"add_features",
"(",
"self",
",",
"*",
"*",
"features",
")",
":",
"for",
"fname",
",",
"fvalue",
"in",
"six",
".",
"iteritems",
"(",
"features",
")",
":",
"setattr",
"(",
"self",
",",
"fname",
",",
"fvalue",
")",
"self",
".",
"features",
".",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.del_feature | Permanently deletes a node's feature. | toytree/etemini.py | def del_feature(self, pr_name):
""" Permanently deletes a node's feature."""
if hasattr(self, pr_name):
delattr(self, pr_name)
self.features.remove(pr_name) | def del_feature(self, pr_name):
""" Permanently deletes a node's feature."""
if hasattr(self, pr_name):
delattr(self, pr_name)
self.features.remove(pr_name) | [
"Permanently",
"deletes",
"a",
"node",
"s",
"feature",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L231-L235 | [
"def",
"del_feature",
"(",
"self",
",",
"pr_name",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"pr_name",
")",
":",
"delattr",
"(",
"self",
",",
"pr_name",
")",
"self",
".",
"features",
".",
"remove",
"(",
"pr_name",
")"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.add_child | Adds a new child to this node. If child node is not suplied
as an argument, a new node instance will be created.
Parameters
----------
child:
the node instance to be added as a child.
name:
the name that will be given to the child.
dist... | toytree/etemini.py | def add_child(self, child=None, name=None, dist=None, support=None):
"""
Adds a new child to this node. If child node is not suplied
as an argument, a new node instance will be created.
Parameters
----------
child:
the node instance to be added as a... | def add_child(self, child=None, name=None, dist=None, support=None):
"""
Adds a new child to this node. If child node is not suplied
as an argument, a new node instance will be created.
Parameters
----------
child:
the node instance to be added as a... | [
"Adds",
"a",
"new",
"child",
"to",
"this",
"node",
".",
"If",
"child",
"node",
"is",
"not",
"suplied",
"as",
"an",
"argument",
"a",
"new",
"node",
"instance",
"will",
"be",
"created",
".",
"Parameters",
"----------"
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L241-L274 | [
"def",
"add_child",
"(",
"self",
",",
"child",
"=",
"None",
",",
"name",
"=",
"None",
",",
"dist",
"=",
"None",
",",
"support",
"=",
"None",
")",
":",
"if",
"child",
"is",
"None",
":",
"child",
"=",
"self",
".",
"__class__",
"(",
")",
"if",
"name... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.remove_child | Removes a child from this node (parent and child
nodes still exit but are no longer connected). | toytree/etemini.py | def remove_child(self, child):
"""
Removes a child from this node (parent and child
nodes still exit but are no longer connected).
"""
try:
self.children.remove(child)
except ValueError as e:
raise TreeError("child not found")
else:
... | def remove_child(self, child):
"""
Removes a child from this node (parent and child
nodes still exit but are no longer connected).
"""
try:
self.children.remove(child)
except ValueError as e:
raise TreeError("child not found")
else:
... | [
"Removes",
"a",
"child",
"from",
"this",
"node",
"(",
"parent",
"and",
"child",
"nodes",
"still",
"exit",
"but",
"are",
"no",
"longer",
"connected",
")",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L277-L288 | [
"def",
"remove_child",
"(",
"self",
",",
"child",
")",
":",
"try",
":",
"self",
".",
"children",
".",
"remove",
"(",
"child",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"TreeError",
"(",
"\"child not found\"",
")",
"else",
":",
"child",
".",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.add_sister | Adds a sister to this node. If sister node is not supplied
as an argument, a new TreeNode instance will be created and
returned. | toytree/etemini.py | def add_sister(self, sister=None, name=None, dist=None):
"""
Adds a sister to this node. If sister node is not supplied
as an argument, a new TreeNode instance will be created and
returned.
"""
if self.up == None:
raise TreeError("A parent node is required to ... | def add_sister(self, sister=None, name=None, dist=None):
"""
Adds a sister to this node. If sister node is not supplied
as an argument, a new TreeNode instance will be created and
returned.
"""
if self.up == None:
raise TreeError("A parent node is required to ... | [
"Adds",
"a",
"sister",
"to",
"this",
"node",
".",
"If",
"sister",
"node",
"is",
"not",
"supplied",
"as",
"an",
"argument",
"a",
"new",
"TreeNode",
"instance",
"will",
"be",
"created",
"and",
"returned",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L291-L300 | [
"def",
"add_sister",
"(",
"self",
",",
"sister",
"=",
"None",
",",
"name",
"=",
"None",
",",
"dist",
"=",
"None",
")",
":",
"if",
"self",
".",
"up",
"==",
"None",
":",
"raise",
"TreeError",
"(",
"\"A parent node is required to add a sister\"",
")",
"else",... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.remove_sister | Removes a sister node. It has the same effect as
**`TreeNode.up.remove_child(sister)`**
If a sister node is not supplied, the first sister will be deleted
and returned.
:argument sister: A node instance
:return: The node removed | toytree/etemini.py | def remove_sister(self, sister=None):
"""
Removes a sister node. It has the same effect as
**`TreeNode.up.remove_child(sister)`**
If a sister node is not supplied, the first sister will be deleted
and returned.
:argument sister: A node instance
:return: The nod... | def remove_sister(self, sister=None):
"""
Removes a sister node. It has the same effect as
**`TreeNode.up.remove_child(sister)`**
If a sister node is not supplied, the first sister will be deleted
and returned.
:argument sister: A node instance
:return: The nod... | [
"Removes",
"a",
"sister",
"node",
".",
"It",
"has",
"the",
"same",
"effect",
"as",
"**",
"TreeNode",
".",
"up",
".",
"remove_child",
"(",
"sister",
")",
"**"
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L303-L319 | [
"def",
"remove_sister",
"(",
"self",
",",
"sister",
"=",
"None",
")",
":",
"sisters",
"=",
"self",
".",
"get_sisters",
"(",
")",
"if",
"len",
"(",
"sisters",
")",
">",
"0",
":",
"if",
"sister",
"is",
"None",
":",
"sister",
"=",
"sisters",
".",
"pop... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.delete | Deletes node from the tree structure. Notice that this method
makes 'disappear' the node from the tree structure. This means
that children from the deleted node are transferred to the
next available parent.
Parameters:
-----------
prevent_nondicotomic:
When ... | toytree/etemini.py | def delete(self, prevent_nondicotomic=True, preserve_branch_length=False):
"""
Deletes node from the tree structure. Notice that this method
makes 'disappear' the node from the tree structure. This means
that children from the deleted node are transferred to the
next available pa... | def delete(self, prevent_nondicotomic=True, preserve_branch_length=False):
"""
Deletes node from the tree structure. Notice that this method
makes 'disappear' the node from the tree structure. This means
that children from the deleted node are transferred to the
next available pa... | [
"Deletes",
"node",
"from",
"the",
"tree",
"structure",
".",
"Notice",
"that",
"this",
"method",
"makes",
"disappear",
"the",
"node",
"from",
"the",
"tree",
"structure",
".",
"This",
"means",
"that",
"children",
"from",
"the",
"deleted",
"node",
"are",
"trans... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L322-L374 | [
"def",
"delete",
"(",
"self",
",",
"prevent_nondicotomic",
"=",
"True",
",",
"preserve_branch_length",
"=",
"False",
")",
":",
"parent",
"=",
"self",
".",
"up",
"if",
"parent",
":",
"if",
"preserve_branch_length",
":",
"if",
"len",
"(",
"self",
".",
"child... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.detach | Detachs this node (and all its descendants) from its parent
and returns the referent to itself.
Detached node conserves all its structure of descendants, and can
be attached to another node through the 'add_child' function. This
mechanism can be seen as a cut and paste. | toytree/etemini.py | def detach(self):
"""
Detachs this node (and all its descendants) from its parent
and returns the referent to itself.
Detached node conserves all its structure of descendants, and can
be attached to another node through the 'add_child' function. This
mechanism can be see... | def detach(self):
"""
Detachs this node (and all its descendants) from its parent
and returns the referent to itself.
Detached node conserves all its structure of descendants, and can
be attached to another node through the 'add_child' function. This
mechanism can be see... | [
"Detachs",
"this",
"node",
"(",
"and",
"all",
"its",
"descendants",
")",
"from",
"its",
"parent",
"and",
"returns",
"the",
"referent",
"to",
"itself",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L377-L389 | [
"def",
"detach",
"(",
"self",
")",
":",
"if",
"self",
".",
"up",
":",
"self",
".",
"up",
".",
"children",
".",
"remove",
"(",
"self",
")",
"self",
".",
"up",
"=",
"None",
"return",
"self"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.prune | Prunes the topology of a node to conserve only a selected list of leaf
internal nodes. The minimum number of nodes that conserve the
topological relationships among the requested nodes will be
retained. Root node is always conserved.
Parameters:
-----------
nodes:
... | toytree/etemini.py | def prune(self, nodes, preserve_branch_length=False):
"""
Prunes the topology of a node to conserve only a selected list of leaf
internal nodes. The minimum number of nodes that conserve the
topological relationships among the requested nodes will be
retained. Root node is always... | def prune(self, nodes, preserve_branch_length=False):
"""
Prunes the topology of a node to conserve only a selected list of leaf
internal nodes. The minimum number of nodes that conserve the
topological relationships among the requested nodes will be
retained. Root node is always... | [
"Prunes",
"the",
"topology",
"of",
"a",
"node",
"to",
"conserve",
"only",
"a",
"selected",
"list",
"of",
"leaf",
"internal",
"nodes",
".",
"The",
"minimum",
"number",
"of",
"nodes",
"that",
"conserve",
"the",
"topological",
"relationships",
"among",
"the",
"... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L392-L522 | [
"def",
"prune",
"(",
"self",
",",
"nodes",
",",
"preserve_branch_length",
"=",
"False",
")",
":",
"def",
"cmp_nodes",
"(",
"x",
",",
"y",
")",
":",
"# if several nodes are in the same path of two kept nodes,",
"# only one should be maintained. This prioritize internal",
"... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_sisters | Returns an indepent list of sister nodes. | toytree/etemini.py | def get_sisters(self):
""" Returns an indepent list of sister nodes."""
if self.up != None:
return [ch for ch in self.up.children if ch != self]
else:
return [] | def get_sisters(self):
""" Returns an indepent list of sister nodes."""
if self.up != None:
return [ch for ch in self.up.children if ch != self]
else:
return [] | [
"Returns",
"an",
"indepent",
"list",
"of",
"sister",
"nodes",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L539-L544 | [
"def",
"get_sisters",
"(",
"self",
")",
":",
"if",
"self",
".",
"up",
"!=",
"None",
":",
"return",
"[",
"ch",
"for",
"ch",
"in",
"self",
".",
"up",
".",
"children",
"if",
"ch",
"!=",
"self",
"]",
"else",
":",
"return",
"[",
"]"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_leaves | Returns an iterator over the leaves under this node. | toytree/etemini.py | def iter_leaves(self, is_leaf_fn=None):
""" Returns an iterator over the leaves under this node."""
for n in self.traverse(strategy="preorder", is_leaf_fn=is_leaf_fn):
if not is_leaf_fn:
if n.is_leaf():
yield n
else:
if is_leaf_... | def iter_leaves(self, is_leaf_fn=None):
""" Returns an iterator over the leaves under this node."""
for n in self.traverse(strategy="preorder", is_leaf_fn=is_leaf_fn):
if not is_leaf_fn:
if n.is_leaf():
yield n
else:
if is_leaf_... | [
"Returns",
"an",
"iterator",
"over",
"the",
"leaves",
"under",
"this",
"node",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L547-L555 | [
"def",
"iter_leaves",
"(",
"self",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"for",
"n",
"in",
"self",
".",
"traverse",
"(",
"strategy",
"=",
"\"preorder\"",
",",
"is_leaf_fn",
"=",
"is_leaf_fn",
")",
":",
"if",
"not",
"is_leaf_fn",
":",
"if",
"n",
"."... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_leaf_names | Returns an iterator over the leaf names under this node. | toytree/etemini.py | def iter_leaf_names(self, is_leaf_fn=None):
"""Returns an iterator over the leaf names under this node."""
for n in self.iter_leaves(is_leaf_fn=is_leaf_fn):
yield n.name | def iter_leaf_names(self, is_leaf_fn=None):
"""Returns an iterator over the leaf names under this node."""
for n in self.iter_leaves(is_leaf_fn=is_leaf_fn):
yield n.name | [
"Returns",
"an",
"iterator",
"over",
"the",
"leaf",
"names",
"under",
"this",
"node",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L563-L566 | [
"def",
"iter_leaf_names",
"(",
"self",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"for",
"n",
"in",
"self",
".",
"iter_leaves",
"(",
"is_leaf_fn",
"=",
"is_leaf_fn",
")",
":",
"yield",
"n",
".",
"name"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_descendants | Returns an iterator over all descendant nodes. | toytree/etemini.py | def iter_descendants(self, strategy="levelorder", is_leaf_fn=None):
""" Returns an iterator over all descendant nodes."""
for n in self.traverse(strategy=strategy, is_leaf_fn=is_leaf_fn):
if n is not self:
yield n | def iter_descendants(self, strategy="levelorder", is_leaf_fn=None):
""" Returns an iterator over all descendant nodes."""
for n in self.traverse(strategy=strategy, is_leaf_fn=is_leaf_fn):
if n is not self:
yield n | [
"Returns",
"an",
"iterator",
"over",
"all",
"descendant",
"nodes",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L574-L578 | [
"def",
"iter_descendants",
"(",
"self",
",",
"strategy",
"=",
"\"levelorder\"",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"for",
"n",
"in",
"self",
".",
"traverse",
"(",
"strategy",
"=",
"strategy",
",",
"is_leaf_fn",
"=",
"is_leaf_fn",
")",
":",
"if",
"... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_descendants | Returns a list of all (leaves and internal) descendant nodes. | toytree/etemini.py | def get_descendants(self, strategy="levelorder", is_leaf_fn=None):
""" Returns a list of all (leaves and internal) descendant nodes."""
return [n for n in self.iter_descendants(
strategy=strategy, is_leaf_fn=is_leaf_fn)] | def get_descendants(self, strategy="levelorder", is_leaf_fn=None):
""" Returns a list of all (leaves and internal) descendant nodes."""
return [n for n in self.iter_descendants(
strategy=strategy, is_leaf_fn=is_leaf_fn)] | [
"Returns",
"a",
"list",
"of",
"all",
"(",
"leaves",
"and",
"internal",
")",
"descendant",
"nodes",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L581-L584 | [
"def",
"get_descendants",
"(",
"self",
",",
"strategy",
"=",
"\"levelorder\"",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"return",
"[",
"n",
"for",
"n",
"in",
"self",
".",
"iter_descendants",
"(",
"strategy",
"=",
"strategy",
",",
"is_leaf_fn",
"=",
"is_le... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.traverse | Returns an iterator to traverse tree under this node.
Parameters:
-----------
strategy:
set the way in which tree will be traversed. Possible
values are: "preorder" (first parent and then children)
'postorder' (first children and the parent) and
... | toytree/etemini.py | def traverse(self, strategy="levelorder", is_leaf_fn=None):
""" Returns an iterator to traverse tree under this node.
Parameters:
-----------
strategy:
set the way in which tree will be traversed. Possible
values are: "preorder" (first parent and then c... | def traverse(self, strategy="levelorder", is_leaf_fn=None):
""" Returns an iterator to traverse tree under this node.
Parameters:
-----------
strategy:
set the way in which tree will be traversed. Possible
values are: "preorder" (first parent and then c... | [
"Returns",
"an",
"iterator",
"to",
"traverse",
"tree",
"under",
"this",
"node",
".",
"Parameters",
":",
"-----------",
"strategy",
":",
"set",
"the",
"way",
"in",
"which",
"tree",
"will",
"be",
"traversed",
".",
"Possible",
"values",
"are",
":",
"preorder",
... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L587-L611 | [
"def",
"traverse",
"(",
"self",
",",
"strategy",
"=",
"\"levelorder\"",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"if",
"strategy",
"==",
"\"preorder\"",
":",
"return",
"self",
".",
"_iter_descendants_preorder",
"(",
"is_leaf_fn",
"=",
"is_leaf_fn",
")",
"elif... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_prepostorder | Iterate over all nodes in a tree yielding every node in both
pre and post order. Each iteration returns a postorder flag
(True if node is being visited in postorder) and a node
instance. | toytree/etemini.py | def iter_prepostorder(self, is_leaf_fn=None):
"""
Iterate over all nodes in a tree yielding every node in both
pre and post order. Each iteration returns a postorder flag
(True if node is being visited in postorder) and a node
instance.
"""
to_visit = [self]
... | def iter_prepostorder(self, is_leaf_fn=None):
"""
Iterate over all nodes in a tree yielding every node in both
pre and post order. Each iteration returns a postorder flag
(True if node is being visited in postorder) and a node
instance.
"""
to_visit = [self]
... | [
"Iterate",
"over",
"all",
"nodes",
"in",
"a",
"tree",
"yielding",
"every",
"node",
"in",
"both",
"pre",
"and",
"post",
"order",
".",
"Each",
"iteration",
"returns",
"a",
"postorder",
"flag",
"(",
"True",
"if",
"node",
"is",
"being",
"visited",
"in",
"pos... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L614-L639 | [
"def",
"iter_prepostorder",
"(",
"self",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"to_visit",
"=",
"[",
"self",
"]",
"if",
"is_leaf_fn",
"is",
"not",
"None",
":",
"_leaf",
"=",
"is_leaf_fn",
"else",
":",
"_leaf",
"=",
"self",
".",
"__class__",
".",
"i... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode._iter_descendants_levelorder | Iterate over all desdecendant nodes. | toytree/etemini.py | def _iter_descendants_levelorder(self, is_leaf_fn=None):
""" Iterate over all desdecendant nodes."""
tovisit = deque([self])
while len(tovisit) > 0:
node = tovisit.popleft()
yield node
if not is_leaf_fn or not is_leaf_fn(node):
tovisit.extend(n... | def _iter_descendants_levelorder(self, is_leaf_fn=None):
""" Iterate over all desdecendant nodes."""
tovisit = deque([self])
while len(tovisit) > 0:
node = tovisit.popleft()
yield node
if not is_leaf_fn or not is_leaf_fn(node):
tovisit.extend(n... | [
"Iterate",
"over",
"all",
"desdecendant",
"nodes",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L665-L672 | [
"def",
"_iter_descendants_levelorder",
"(",
"self",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"tovisit",
"=",
"deque",
"(",
"[",
"self",
"]",
")",
"while",
"len",
"(",
"tovisit",
")",
">",
"0",
":",
"node",
"=",
"tovisit",
".",
"popleft",
"(",
")",
"... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode._iter_descendants_preorder | Iterator over all descendant nodes. | toytree/etemini.py | def _iter_descendants_preorder(self, is_leaf_fn=None):
""" Iterator over all descendant nodes. """
to_visit = deque()
node = self
while node is not None:
yield node
if not is_leaf_fn or not is_leaf_fn(node):
to_visit.extendleft(reversed(node.childr... | def _iter_descendants_preorder(self, is_leaf_fn=None):
""" Iterator over all descendant nodes. """
to_visit = deque()
node = self
while node is not None:
yield node
if not is_leaf_fn or not is_leaf_fn(node):
to_visit.extendleft(reversed(node.childr... | [
"Iterator",
"over",
"all",
"descendant",
"nodes",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L675-L686 | [
"def",
"_iter_descendants_preorder",
"(",
"self",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"to_visit",
"=",
"deque",
"(",
")",
"node",
"=",
"self",
"while",
"node",
"is",
"not",
"None",
":",
"yield",
"node",
"if",
"not",
"is_leaf_fn",
"or",
"not",
"is_l... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_ancestors | Iterates over the list of all ancestor nodes from
current node to the current tree root. | toytree/etemini.py | def iter_ancestors(self):
"""
Iterates over the list of all ancestor nodes from
current node to the current tree root.
"""
node = self
while node.up is not None:
yield node.up
node = node.up | def iter_ancestors(self):
"""
Iterates over the list of all ancestor nodes from
current node to the current tree root.
"""
node = self
while node.up is not None:
yield node.up
node = node.up | [
"Iterates",
"over",
"the",
"list",
"of",
"all",
"ancestor",
"nodes",
"from",
"current",
"node",
"to",
"the",
"current",
"tree",
"root",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L689-L697 | [
"def",
"iter_ancestors",
"(",
"self",
")",
":",
"node",
"=",
"self",
"while",
"node",
".",
"up",
"is",
"not",
"None",
":",
"yield",
"node",
".",
"up",
"node",
"=",
"node",
".",
"up"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.write | Returns the newick representation of current node. Several
arguments control the way in which extra data is shown for
every node:
Parameters:
-----------
features:
a list of feature names to be exported using the Extended Newick
Format (i.e. features=["... | toytree/etemini.py | def write(self,
features=None,
outfile=None,
format=0,
is_leaf_fn=None,
format_root_node=False,
dist_formatter=None,
support_formatter=None,
name_formatter=None):
"""
Returns the newick representation of current node. Several
... | def write(self,
features=None,
outfile=None,
format=0,
is_leaf_fn=None,
format_root_node=False,
dist_formatter=None,
support_formatter=None,
name_formatter=None):
"""
Returns the newick representation of current node. Several
... | [
"Returns",
"the",
"newick",
"representation",
"of",
"current",
"node",
".",
"Several",
"arguments",
"control",
"the",
"way",
"in",
"which",
"extra",
"data",
"is",
"shown",
"for",
"every",
"node",
":"
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L708-L759 | [
"def",
"write",
"(",
"self",
",",
"features",
"=",
"None",
",",
"outfile",
"=",
"None",
",",
"format",
"=",
"0",
",",
"is_leaf_fn",
"=",
"None",
",",
"format_root_node",
"=",
"False",
",",
"dist_formatter",
"=",
"None",
",",
"support_formatter",
"=",
"No... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_tree_root | Returns the absolute root node of current tree structure. | toytree/etemini.py | def get_tree_root(self):
""" Returns the absolute root node of current tree structure."""
root = self
while root.up is not None:
root = root.up
return root | def get_tree_root(self):
""" Returns the absolute root node of current tree structure."""
root = self
while root.up is not None:
root = root.up
return root | [
"Returns",
"the",
"absolute",
"root",
"node",
"of",
"current",
"tree",
"structure",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L762-L767 | [
"def",
"get_tree_root",
"(",
"self",
")",
":",
"root",
"=",
"self",
"while",
"root",
".",
"up",
"is",
"not",
"None",
":",
"root",
"=",
"root",
".",
"up",
"return",
"root"
] | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_common_ancestor | Returns the first common ancestor between this node and a given
list of 'target_nodes'.
**Examples:**
t = tree.Tree("(((A:0.1, B:0.01):0.001, C:0.0001):1.0[&&NHX:name=common], (D:0.00001):0.000001):2.0[&&NHX:name=root];")
A = t.get_descendants_by_name("A")[0]
C = t.get_des... | toytree/etemini.py | def get_common_ancestor(self, *target_nodes, **kargs):
"""
Returns the first common ancestor between this node and a given
list of 'target_nodes'.
**Examples:**
t = tree.Tree("(((A:0.1, B:0.01):0.001, C:0.0001):1.0[&&NHX:name=common], (D:0.00001):0.000001):2.0[&&NHX:name=root]... | def get_common_ancestor(self, *target_nodes, **kargs):
"""
Returns the first common ancestor between this node and a given
list of 'target_nodes'.
**Examples:**
t = tree.Tree("(((A:0.1, B:0.01):0.001, C:0.0001):1.0[&&NHX:name=common], (D:0.00001):0.000001):2.0[&&NHX:name=root]... | [
"Returns",
"the",
"first",
"common",
"ancestor",
"between",
"this",
"node",
"and",
"a",
"given",
"list",
"of",
"target_nodes",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L770-L825 | [
"def",
"get_common_ancestor",
"(",
"self",
",",
"*",
"target_nodes",
",",
"*",
"*",
"kargs",
")",
":",
"get_path",
"=",
"kargs",
".",
"get",
"(",
"\"get_path\"",
",",
"False",
")",
"if",
"len",
"(",
"target_nodes",
")",
"==",
"1",
"and",
"type",
"(",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_search_nodes | Search nodes in an interative way. Matches are being yield as
they are being found. This avoids to scan the full tree
topology before returning the first matches. Useful when
dealing with huge trees. | toytree/etemini.py | def iter_search_nodes(self, **conditions):
"""
Search nodes in an interative way. Matches are being yield as
they are being found. This avoids to scan the full tree
topology before returning the first matches. Useful when
dealing with huge trees.
"""
for n in self... | def iter_search_nodes(self, **conditions):
"""
Search nodes in an interative way. Matches are being yield as
they are being found. This avoids to scan the full tree
topology before returning the first matches. Useful when
dealing with huge trees.
"""
for n in self... | [
"Search",
"nodes",
"in",
"an",
"interative",
"way",
".",
"Matches",
"are",
"being",
"yield",
"as",
"they",
"are",
"being",
"found",
".",
"This",
"avoids",
"to",
"scan",
"the",
"full",
"tree",
"topology",
"before",
"returning",
"the",
"first",
"matches",
".... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L828-L841 | [
"def",
"iter_search_nodes",
"(",
"self",
",",
"*",
"*",
"conditions",
")",
":",
"for",
"n",
"in",
"self",
".",
"traverse",
"(",
")",
":",
"conditions_passed",
"=",
"0",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"conditions",
")",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.search_nodes | Returns the list of nodes matching a given set of conditions.
**Example:**
tree.search_nodes(dist=0.0, name="human") | toytree/etemini.py | def search_nodes(self, **conditions):
"""
Returns the list of nodes matching a given set of conditions.
**Example:**
tree.search_nodes(dist=0.0, name="human")
"""
matching_nodes = []
for n in self.iter_search_nodes(**conditions):
matching_nodes.append(... | def search_nodes(self, **conditions):
"""
Returns the list of nodes matching a given set of conditions.
**Example:**
tree.search_nodes(dist=0.0, name="human")
"""
matching_nodes = []
for n in self.iter_search_nodes(**conditions):
matching_nodes.append(... | [
"Returns",
"the",
"list",
"of",
"nodes",
"matching",
"a",
"given",
"set",
"of",
"conditions",
".",
"**",
"Example",
":",
"**",
"tree",
".",
"search_nodes",
"(",
"dist",
"=",
"0",
".",
"0",
"name",
"=",
"human",
")"
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L844-L853 | [
"def",
"search_nodes",
"(",
"self",
",",
"*",
"*",
"conditions",
")",
":",
"matching_nodes",
"=",
"[",
"]",
"for",
"n",
"in",
"self",
".",
"iter_search_nodes",
"(",
"*",
"*",
"conditions",
")",
":",
"matching_nodes",
".",
"append",
"(",
"n",
")",
"retu... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_distance | Returns the distance between two nodes. If only one target is
specified, it returns the distance bewtween the target and the
current node.
Parameters:
-----------
target:
a node within the same tree structure.
target2:
a node within the sam... | toytree/etemini.py | def get_distance(self, target, target2=None, topology_only=False):
"""
Returns the distance between two nodes. If only one target is
specified, it returns the distance bewtween the target and the
current node.
Parameters:
-----------
target:
a no... | def get_distance(self, target, target2=None, topology_only=False):
"""
Returns the distance between two nodes. If only one target is
specified, it returns the distance bewtween the target and the
current node.
Parameters:
-----------
target:
a no... | [
"Returns",
"the",
"distance",
"between",
"two",
"nodes",
".",
"If",
"only",
"one",
"target",
"is",
"specified",
"it",
"returns",
"the",
"distance",
"bewtween",
"the",
"target",
"and",
"the",
"current",
"node",
".",
"Parameters",
":",
"-----------",
"target",
... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L879-L923 | [
"def",
"get_distance",
"(",
"self",
",",
"target",
",",
"target2",
"=",
"None",
",",
"topology_only",
"=",
"False",
")",
":",
"if",
"target2",
"is",
"None",
":",
"target2",
"=",
"self",
"root",
"=",
"self",
".",
"get_tree_root",
"(",
")",
"else",
":",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_farthest_node | Returns the node's farthest descendant or ancestor node, and the
distance to it.
:argument False topology_only: If set to True, distance
between nodes will be referred to the number of nodes
between them. In other words, topological distance will be
used instead of branch ... | toytree/etemini.py | def get_farthest_node(self, topology_only=False):
"""
Returns the node's farthest descendant or ancestor node, and the
distance to it.
:argument False topology_only: If set to True, distance
between nodes will be referred to the number of nodes
between them. In other... | def get_farthest_node(self, topology_only=False):
"""
Returns the node's farthest descendant or ancestor node, and the
distance to it.
:argument False topology_only: If set to True, distance
between nodes will be referred to the number of nodes
between them. In other... | [
"Returns",
"the",
"node",
"s",
"farthest",
"descendant",
"or",
"ancestor",
"node",
"and",
"the",
"distance",
"to",
"it",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L926-L969 | [
"def",
"get_farthest_node",
"(",
"self",
",",
"topology_only",
"=",
"False",
")",
":",
"# Init fasthest node to current farthest leaf",
"farthest_node",
",",
"farthest_dist",
"=",
"self",
".",
"get_farthest_leaf",
"(",
"topology_only",
"=",
"topology_only",
")",
"prev",... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_farthest_leaf | Returns node's farthest descendant node (which is always a leaf), and the
distance to it.
:argument False topology_only: If set to True, distance
between nodes will be referred to the number of nodes
between them. In other words, topological distance will be
used instead o... | toytree/etemini.py | def get_farthest_leaf(self, topology_only=False, is_leaf_fn=None):
"""
Returns node's farthest descendant node (which is always a leaf), and the
distance to it.
:argument False topology_only: If set to True, distance
between nodes will be referred to the number of nodes
... | def get_farthest_leaf(self, topology_only=False, is_leaf_fn=None):
"""
Returns node's farthest descendant node (which is always a leaf), and the
distance to it.
:argument False topology_only: If set to True, distance
between nodes will be referred to the number of nodes
... | [
"Returns",
"node",
"s",
"farthest",
"descendant",
"node",
"(",
"which",
"is",
"always",
"a",
"leaf",
")",
"and",
"the",
"distance",
"to",
"it",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1001-L1016 | [
"def",
"get_farthest_leaf",
"(",
"self",
",",
"topology_only",
"=",
"False",
",",
"is_leaf_fn",
"=",
"None",
")",
":",
"min_node",
",",
"min_dist",
",",
"max_node",
",",
"max_dist",
"=",
"self",
".",
"_get_farthest_and_closest_leaves",
"(",
"topology_only",
"=",... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_midpoint_outgroup | Returns the node that divides the current tree into two
distance-balanced partitions. | toytree/etemini.py | def get_midpoint_outgroup(self):
"""
Returns the node that divides the current tree into two
distance-balanced partitions.
"""
# Gets the farthest node to the current root
root = self.get_tree_root()
nA, r2A_dist = root.get_farthest_leaf()
nB, A2B_dist = ... | def get_midpoint_outgroup(self):
"""
Returns the node that divides the current tree into two
distance-balanced partitions.
"""
# Gets the farthest node to the current root
root = self.get_tree_root()
nA, r2A_dist = root.get_farthest_leaf()
nB, A2B_dist = ... | [
"Returns",
"the",
"node",
"that",
"divides",
"the",
"current",
"tree",
"into",
"two",
"distance",
"-",
"balanced",
"partitions",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1038-L1058 | [
"def",
"get_midpoint_outgroup",
"(",
"self",
")",
":",
"# Gets the farthest node to the current root",
"root",
"=",
"self",
".",
"get_tree_root",
"(",
")",
"nA",
",",
"r2A_dist",
"=",
"root",
".",
"get_farthest_leaf",
"(",
")",
"nB",
",",
"A2B_dist",
"=",
"nA",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.populate | Generates a random topology by populating current node.
:argument None names_library: If provided, names library
(list, set, dict, etc.) will be used to name nodes.
:argument False reuse_names: If True, node names will not be
necessarily unique, which makes the process a bit more
... | toytree/etemini.py | def populate(self,
size,
names_library=None,
reuse_names=False,
random_branches=False,
branch_range=(0, 1),
support_range=(0, 1)):
"""
Generates a random topology by populating current node.
:argument None names_library: If provided, names lib... | def populate(self,
size,
names_library=None,
reuse_names=False,
random_branches=False,
branch_range=(0, 1),
support_range=(0, 1)):
"""
Generates a random topology by populating current node.
:argument None names_library: If provided, names lib... | [
"Generates",
"a",
"random",
"topology",
"by",
"populating",
"current",
"node",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1061-L1137 | [
"def",
"populate",
"(",
"self",
",",
"size",
",",
"names_library",
"=",
"None",
",",
"reuse_names",
"=",
"False",
",",
"random_branches",
"=",
"False",
",",
"branch_range",
"=",
"(",
"0",
",",
"1",
")",
",",
"support_range",
"=",
"(",
"0",
",",
"1",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.set_outgroup | Sets a descendant node as the outgroup of a tree. This function
can be used to root a tree or even an internal node.
Parameters:
-----------
outgroup:
a node instance within the same tree structure that will be
used as a basal node. | toytree/etemini.py | def set_outgroup(self, outgroup):
"""
Sets a descendant node as the outgroup of a tree. This function
can be used to root a tree or even an internal node.
Parameters:
-----------
outgroup:
a node instance within the same tree structure that will be
... | def set_outgroup(self, outgroup):
"""
Sets a descendant node as the outgroup of a tree. This function
can be used to root a tree or even an internal node.
Parameters:
-----------
outgroup:
a node instance within the same tree structure that will be
... | [
"Sets",
"a",
"descendant",
"node",
"as",
"the",
"outgroup",
"of",
"a",
"tree",
".",
"This",
"function",
"can",
"be",
"used",
"to",
"root",
"a",
"tree",
"or",
"even",
"an",
"internal",
"node",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1140-L1226 | [
"def",
"set_outgroup",
"(",
"self",
",",
"outgroup",
")",
":",
"outgroup",
"=",
"_translate_nodes",
"(",
"self",
",",
"outgroup",
")",
"if",
"self",
"==",
"outgroup",
":",
"##return",
"## why raise an error for this?",
"raise",
"TreeError",
"(",
"\"Cannot set myse... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.unroot | Unroots current node. This function is expected to be used on
the absolute tree root node, but it can be also be applied to
any other internal node. It will convert a split into a
multifurcation. | toytree/etemini.py | def unroot(self):
"""
Unroots current node. This function is expected to be used on
the absolute tree root node, but it can be also be applied to
any other internal node. It will convert a split into a
multifurcation.
"""
if len(self.children)==2:
if n... | def unroot(self):
"""
Unroots current node. This function is expected to be used on
the absolute tree root node, but it can be also be applied to
any other internal node. It will convert a split into a
multifurcation.
"""
if len(self.children)==2:
if n... | [
"Unroots",
"current",
"node",
".",
"This",
"function",
"is",
"expected",
"to",
"be",
"used",
"on",
"the",
"absolute",
"tree",
"root",
"node",
"but",
"it",
"can",
"be",
"also",
"be",
"applied",
"to",
"any",
"other",
"internal",
"node",
".",
"It",
"will",
... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1229-L1242 | [
"def",
"unroot",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"children",
")",
"==",
"2",
":",
"if",
"not",
"self",
".",
"children",
"[",
"0",
"]",
".",
"is_leaf",
"(",
")",
":",
"self",
".",
"children",
"[",
"0",
"]",
".",
"delete",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode._asciiArt | Returns the ASCII representation of the tree.
Code based on the PyCogent GPL project. | toytree/etemini.py | def _asciiArt(self, char1='-', show_internal=True, compact=False, attributes=None):
"""
Returns the ASCII representation of the tree.
Code based on the PyCogent GPL project.
"""
if not attributes:
attributes = ["name"]
# toytree edit:
# remove... | def _asciiArt(self, char1='-', show_internal=True, compact=False, attributes=None):
"""
Returns the ASCII representation of the tree.
Code based on the PyCogent GPL project.
"""
if not attributes:
attributes = ["name"]
# toytree edit:
# remove... | [
"Returns",
"the",
"ASCII",
"representation",
"of",
"the",
"tree",
".",
"Code",
"based",
"on",
"the",
"PyCogent",
"GPL",
"project",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1245-L1291 | [
"def",
"_asciiArt",
"(",
"self",
",",
"char1",
"=",
"'-'",
",",
"show_internal",
"=",
"True",
",",
"compact",
"=",
"False",
",",
"attributes",
"=",
"None",
")",
":",
"if",
"not",
"attributes",
":",
"attributes",
"=",
"[",
"\"name\"",
"]",
"# toytree edit... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_ascii | Returns a string containing an ascii drawing of the tree.
Parameters:
-----------
show_internal:
include internal edge names.
compact:
use exactly one line per tip.
attributes:
A list of node attributes to shown in the ASCII represe... | toytree/etemini.py | def get_ascii(self, show_internal=True, compact=False, attributes=None):
"""
Returns a string containing an ascii drawing of the tree.
Parameters:
-----------
show_internal:
include internal edge names.
compact:
use exactly one line per ... | def get_ascii(self, show_internal=True, compact=False, attributes=None):
"""
Returns a string containing an ascii drawing of the tree.
Parameters:
-----------
show_internal:
include internal edge names.
compact:
use exactly one line per ... | [
"Returns",
"a",
"string",
"containing",
"an",
"ascii",
"drawing",
"of",
"the",
"tree",
".",
"Parameters",
":",
"-----------",
"show_internal",
":",
"include",
"internal",
"edge",
"names",
".",
"compact",
":",
"use",
"exactly",
"one",
"line",
"per",
"tip",
".... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1294-L1310 | [
"def",
"get_ascii",
"(",
"self",
",",
"show_internal",
"=",
"True",
",",
"compact",
"=",
"False",
",",
"attributes",
"=",
"None",
")",
":",
"(",
"lines",
",",
"mid",
")",
"=",
"self",
".",
"_asciiArt",
"(",
"show_internal",
"=",
"show_internal",
",",
"... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.ladderize | Sort the branches of a given tree (swapping children nodes)
according to the size of each partition. | toytree/etemini.py | def ladderize(self, direction=0):
"""
Sort the branches of a given tree (swapping children nodes)
according to the size of each partition.
"""
if not self.is_leaf():
n2s = {}
for n in self.get_children():
s = n.ladderize(direction=direction... | def ladderize(self, direction=0):
"""
Sort the branches of a given tree (swapping children nodes)
according to the size of each partition.
"""
if not self.is_leaf():
n2s = {}
for n in self.get_children():
s = n.ladderize(direction=direction... | [
"Sort",
"the",
"branches",
"of",
"a",
"given",
"tree",
"(",
"swapping",
"children",
"nodes",
")",
"according",
"to",
"the",
"size",
"of",
"each",
"partition",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1313-L1330 | [
"def",
"ladderize",
"(",
"self",
",",
"direction",
"=",
"0",
")",
":",
"if",
"not",
"self",
".",
"is_leaf",
"(",
")",
":",
"n2s",
"=",
"{",
"}",
"for",
"n",
"in",
"self",
".",
"get_children",
"(",
")",
":",
"s",
"=",
"n",
".",
"ladderize",
"(",... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.sort_descendants | This function sort the branches of a given tree by
considerening node names. After the tree is sorted, nodes are
labeled using ascendent numbers. This can be used to ensure
that nodes in a tree with the same node names are always
labeled in the same way. Note that if duplicated names ar... | toytree/etemini.py | def sort_descendants(self, attr="name"):
"""
This function sort the branches of a given tree by
considerening node names. After the tree is sorted, nodes are
labeled using ascendent numbers. This can be used to ensure
that nodes in a tree with the same node names are always
... | def sort_descendants(self, attr="name"):
"""
This function sort the branches of a given tree by
considerening node names. After the tree is sorted, nodes are
labeled using ascendent numbers. This can be used to ensure
that nodes in a tree with the same node names are always
... | [
"This",
"function",
"sort",
"the",
"branches",
"of",
"a",
"given",
"tree",
"by",
"considerening",
"node",
"names",
".",
"After",
"the",
"tree",
"is",
"sorted",
"nodes",
"are",
"labeled",
"using",
"ascendent",
"numbers",
".",
"This",
"can",
"be",
"used",
"t... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1333-L1347 | [
"def",
"sort_descendants",
"(",
"self",
",",
"attr",
"=",
"\"name\"",
")",
":",
"node2content",
"=",
"self",
".",
"get_cached_content",
"(",
"store_attr",
"=",
"attr",
",",
"container_type",
"=",
"list",
")",
"for",
"n",
"in",
"self",
".",
"traverse",
"(",... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_cached_content | Returns a dictionary pointing to the preloaded content of each
internal node under this tree. Such a dictionary is intended
to work as a cache for operations that require many traversal
operations.
Parameters:
-----------
store_attr:
Specifies the no... | toytree/etemini.py | def get_cached_content(self, store_attr=None, container_type=set, _store=None):
"""
Returns a dictionary pointing to the preloaded content of each
internal node under this tree. Such a dictionary is intended
to work as a cache for operations that require many traversal
operations... | def get_cached_content(self, store_attr=None, container_type=set, _store=None):
"""
Returns a dictionary pointing to the preloaded content of each
internal node under this tree. Such a dictionary is intended
to work as a cache for operations that require many traversal
operations... | [
"Returns",
"a",
"dictionary",
"pointing",
"to",
"the",
"preloaded",
"content",
"of",
"each",
"internal",
"node",
"under",
"this",
"tree",
".",
"Such",
"a",
"dictionary",
"is",
"intended",
"to",
"work",
"as",
"a",
"cache",
"for",
"operations",
"that",
"requir... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1350-L1385 | [
"def",
"get_cached_content",
"(",
"self",
",",
"store_attr",
"=",
"None",
",",
"container_type",
"=",
"set",
",",
"_store",
"=",
"None",
")",
":",
"if",
"_store",
"is",
"None",
":",
"_store",
"=",
"{",
"}",
"for",
"ch",
"in",
"self",
".",
"children",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.robinson_foulds | Returns the Robinson-Foulds symmetric distance between current
tree and a different tree instance.
Parameters:
-----------
t2:
reference tree
attr_t1:
Compare trees using a custom node attribute as a node name.
attr_t2:
Compare tree... | toytree/etemini.py | def robinson_foulds(self,
t2,
attr_t1="name",
attr_t2="name",
unrooted_trees=False,
expand_polytomies=False,
polytomy_size_limit=5,
skip_large_polytomies=False,
correct_by_polytomy_size=False,
min_support_t1=0.0,
min_support_t2=0.0):
... | def robinson_foulds(self,
t2,
attr_t1="name",
attr_t2="name",
unrooted_trees=False,
expand_polytomies=False,
polytomy_size_limit=5,
skip_large_polytomies=False,
correct_by_polytomy_size=False,
min_support_t1=0.0,
min_support_t2=0.0):
... | [
"Returns",
"the",
"Robinson",
"-",
"Foulds",
"symmetric",
"distance",
"between",
"current",
"tree",
"and",
"a",
"different",
"tree",
"instance",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1391-L1567 | [
"def",
"robinson_foulds",
"(",
"self",
",",
"t2",
",",
"attr_t1",
"=",
"\"name\"",
",",
"attr_t2",
"=",
"\"name\"",
",",
"unrooted_trees",
"=",
"False",
",",
"expand_polytomies",
"=",
"False",
",",
"polytomy_size_limit",
"=",
"5",
",",
"skip_large_polytomies",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.iter_edges | Iterate over the list of edges of a tree. Each egde is represented as a
tuple of two elements, each containing the list of nodes separated by
the edge. | toytree/etemini.py | def iter_edges(self, cached_content=None):
"""
Iterate over the list of edges of a tree. Each egde is represented as a
tuple of two elements, each containing the list of nodes separated by
the edge.
"""
if not cached_content:
cached_content = self.get_cached_c... | def iter_edges(self, cached_content=None):
"""
Iterate over the list of edges of a tree. Each egde is represented as a
tuple of two elements, each containing the list of nodes separated by
the edge.
"""
if not cached_content:
cached_content = self.get_cached_c... | [
"Iterate",
"over",
"the",
"list",
"of",
"edges",
"of",
"a",
"tree",
".",
"Each",
"egde",
"is",
"represented",
"as",
"a",
"tuple",
"of",
"two",
"elements",
"each",
"containing",
"the",
"list",
"of",
"nodes",
"separated",
"by",
"the",
"edge",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1755-L1765 | [
"def",
"iter_edges",
"(",
"self",
",",
"cached_content",
"=",
"None",
")",
":",
"if",
"not",
"cached_content",
":",
"cached_content",
"=",
"self",
".",
"get_cached_content",
"(",
")",
"all_leaves",
"=",
"cached_content",
"[",
"self",
"]",
"for",
"n",
",",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_topology_id | Returns the unique ID representing the topology of the current tree.
Two trees with the same topology will produce the same id. If trees are
unrooted, make sure that the root node is not binary or use the
tree.unroot() function before generating the topology id.
This is useful to detec... | toytree/etemini.py | def get_topology_id(self, attr="name"):
"""
Returns the unique ID representing the topology of the current tree.
Two trees with the same topology will produce the same id. If trees are
unrooted, make sure that the root node is not binary or use the
tree.unroot() function before ... | def get_topology_id(self, attr="name"):
"""
Returns the unique ID representing the topology of the current tree.
Two trees with the same topology will produce the same id. If trees are
unrooted, make sure that the root node is not binary or use the
tree.unroot() function before ... | [
"Returns",
"the",
"unique",
"ID",
"representing",
"the",
"topology",
"of",
"the",
"current",
"tree",
".",
"Two",
"trees",
"with",
"the",
"same",
"topology",
"will",
"produce",
"the",
"same",
"id",
".",
"If",
"trees",
"are",
"unrooted",
"make",
"sure",
"tha... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1789-L1807 | [
"def",
"get_topology_id",
"(",
"self",
",",
"attr",
"=",
"\"name\"",
")",
":",
"edge_keys",
"=",
"[",
"]",
"for",
"s1",
",",
"s2",
"in",
"self",
".",
"get_edges",
"(",
")",
":",
"k1",
"=",
"sorted",
"(",
"[",
"getattr",
"(",
"e",
",",
"attr",
")"... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.check_monophyly | Returns True if a given target attribute is monophyletic under
this node for the provided set of values.
If not all values are represented in the current tree
structure, a ValueError exception will be raised to warn that
strict monophyly could never be reached (this behaviour can be
... | toytree/etemini.py | def check_monophyly(self,
values,
target_attr,
ignore_missing=False,
unrooted=False):
"""
Returns True if a given target attribute is monophyletic under
this node for the provided set of values.
If not all values are represented in the current tree
... | def check_monophyly(self,
values,
target_attr,
ignore_missing=False,
unrooted=False):
"""
Returns True if a given target attribute is monophyletic under
this node for the provided set of values.
If not all values are represented in the current tree
... | [
"Returns",
"True",
"if",
"a",
"given",
"target",
"attribute",
"is",
"monophyletic",
"under",
"this",
"node",
"for",
"the",
"provided",
"set",
"of",
"values",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1845-L1939 | [
"def",
"check_monophyly",
"(",
"self",
",",
"values",
",",
"target_attr",
",",
"ignore_missing",
"=",
"False",
",",
"unrooted",
"=",
"False",
")",
":",
"if",
"type",
"(",
"values",
")",
"!=",
"set",
":",
"values",
"=",
"set",
"(",
"values",
")",
"# Thi... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.get_monophyletic | Returns a list of nodes matching the provided monophyly
criteria. For a node to be considered a match, all
`target_attr` values within and node, and exclusively them,
should be grouped.
:param values: a set of values for which monophyly is
expected.
:param target_at... | toytree/etemini.py | def get_monophyletic(self, values, target_attr):
"""
Returns a list of nodes matching the provided monophyly
criteria. For a node to be considered a match, all
`target_attr` values within and node, and exclusively them,
should be grouped.
:param values: a set of values f... | def get_monophyletic(self, values, target_attr):
"""
Returns a list of nodes matching the provided monophyly
criteria. For a node to be considered a match, all
`target_attr` values within and node, and exclusively them,
should be grouped.
:param values: a set of values f... | [
"Returns",
"a",
"list",
"of",
"nodes",
"matching",
"the",
"provided",
"monophyly",
"criteria",
".",
"For",
"a",
"node",
"to",
"be",
"considered",
"a",
"match",
"all",
"target_attr",
"values",
"within",
"and",
"node",
"and",
"exclusively",
"them",
"should",
"... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1942-L1964 | [
"def",
"get_monophyletic",
"(",
"self",
",",
"values",
",",
"target_attr",
")",
":",
"if",
"type",
"(",
"values",
")",
"!=",
"set",
":",
"values",
"=",
"set",
"(",
"values",
")",
"n2values",
"=",
"self",
".",
"get_cached_content",
"(",
"store_attr",
"=",... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.expand_polytomies | Given a tree with one or more polytomies, this functions returns the
list of all trees (in newick format) resulting from the combination of
all possible solutions of the multifurcated nodes.
.. warning:
Please note that the number of of possible binary trees grows
exponen... | toytree/etemini.py | def expand_polytomies(self,
map_attr="name",
polytomy_size_limit=5,
skip_large_polytomies=False):
"""
Given a tree with one or more polytomies, this functions returns the
list of all trees (in newick format) resulting from the combination of
all possible solutio... | def expand_polytomies(self,
map_attr="name",
polytomy_size_limit=5,
skip_large_polytomies=False):
"""
Given a tree with one or more polytomies, this functions returns the
list of all trees (in newick format) resulting from the combination of
all possible solutio... | [
"Given",
"a",
"tree",
"with",
"one",
"or",
"more",
"polytomies",
"this",
"functions",
"returns",
"the",
"list",
"of",
"all",
"trees",
"(",
"in",
"newick",
"format",
")",
"resulting",
"from",
"the",
"combination",
"of",
"all",
"possible",
"solutions",
"of",
... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L1967-L2029 | [
"def",
"expand_polytomies",
"(",
"self",
",",
"map_attr",
"=",
"\"name\"",
",",
"polytomy_size_limit",
"=",
"5",
",",
"skip_large_polytomies",
"=",
"False",
")",
":",
"class",
"TipTuple",
"(",
"tuple",
")",
":",
"pass",
"def",
"add_leaf",
"(",
"tree",
",",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | TreeNode.resolve_polytomy | Resolve all polytomies under current node by creating an
arbitrary dicotomic structure among the affected nodes. This
function randomly modifies current tree topology and should
only be used for compatibility reasons (i.e. programs
rejecting multifurcated node in the newick representatio... | toytree/etemini.py | def resolve_polytomy(self,
default_dist=0.0,
default_support=0.0,
recursive=True):
"""
Resolve all polytomies under current node by creating an
arbitrary dicotomic structure among the affected nodes. This
function randomly modifies current tree topology and shou... | def resolve_polytomy(self,
default_dist=0.0,
default_support=0.0,
recursive=True):
"""
Resolve all polytomies under current node by creating an
arbitrary dicotomic structure among the affected nodes. This
function randomly modifies current tree topology and shou... | [
"Resolve",
"all",
"polytomies",
"under",
"current",
"node",
"by",
"creating",
"an",
"arbitrary",
"dicotomic",
"structure",
"among",
"the",
"affected",
"nodes",
".",
"This",
"function",
"randomly",
"modifies",
"current",
"tree",
"topology",
"and",
"should",
"only",... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L2032-L2071 | [
"def",
"resolve_polytomy",
"(",
"self",
",",
"default_dist",
"=",
"0.0",
",",
"default_support",
"=",
"0.0",
",",
"recursive",
"=",
"True",
")",
":",
"def",
"_resolve",
"(",
"node",
")",
":",
"if",
"len",
"(",
"node",
".",
"children",
")",
">",
"2",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | truncate_empty_lines | Removes all empty lines from above and below the text.
We can't just use text.strip() because that would remove the leading
space for the table.
Parameters
----------
lines : list of str
Returns
-------
lines : list of str
The text lines without empty lines above or below | dashtable/simple2data/truncate_empty_lines.py | def truncate_empty_lines(lines):
"""
Removes all empty lines from above and below the text.
We can't just use text.strip() because that would remove the leading
space for the table.
Parameters
----------
lines : list of str
Returns
-------
lines : list of str
The text ... | def truncate_empty_lines(lines):
"""
Removes all empty lines from above and below the text.
We can't just use text.strip() because that would remove the leading
space for the table.
Parameters
----------
lines : list of str
Returns
-------
lines : list of str
The text ... | [
"Removes",
"all",
"empty",
"lines",
"from",
"above",
"and",
"below",
"the",
"text",
"."
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/simple2data/truncate_empty_lines.py#L1-L21 | [
"def",
"truncate_empty_lines",
"(",
"lines",
")",
":",
"while",
"lines",
"[",
"0",
"]",
".",
"rstrip",
"(",
")",
"==",
"''",
":",
"lines",
".",
"pop",
"(",
"0",
")",
"while",
"lines",
"[",
"len",
"(",
"lines",
")",
"-",
"1",
"]",
".",
"rstrip",
... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | jstimestamp_slow | Convert a date or datetime object into a javsacript timestamp | dynts/lib/fallback/dates.py | def jstimestamp_slow(dte):
'''Convert a date or datetime object into a javsacript timestamp'''
year, month, day, hour, minute, second = dte.timetuple()[:6]
days = date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
hours = days*24 + hour
minutes = hours*60 + minute
seconds = minutes*60... | def jstimestamp_slow(dte):
'''Convert a date or datetime object into a javsacript timestamp'''
year, month, day, hour, minute, second = dte.timetuple()[:6]
days = date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
hours = days*24 + hour
minutes = hours*60 + minute
seconds = minutes*60... | [
"Convert",
"a",
"date",
"or",
"datetime",
"object",
"into",
"a",
"javsacript",
"timestamp"
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/lib/fallback/dates.py#L7-L17 | [
"def",
"jstimestamp_slow",
"(",
"dte",
")",
":",
"year",
",",
"month",
",",
"day",
",",
"hour",
",",
"minute",
",",
"second",
"=",
"dte",
".",
"timetuple",
"(",
")",
"[",
":",
"6",
"]",
"days",
"=",
"date",
"(",
"year",
",",
"month",
",",
"1",
... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | jstimestamp | Convert a date or datetime object into a javsacript timestamp. | dynts/lib/fallback/dates.py | def jstimestamp(dte):
'''Convert a date or datetime object into a javsacript timestamp.'''
days = date(dte.year, dte.month, 1).toordinal() - _EPOCH_ORD + dte.day - 1
hours = days*24
if isinstance(dte,datetime):
hours += dte.hour
minutes = hours*60 + dte.minute
second... | def jstimestamp(dte):
'''Convert a date or datetime object into a javsacript timestamp.'''
days = date(dte.year, dte.month, 1).toordinal() - _EPOCH_ORD + dte.day - 1
hours = days*24
if isinstance(dte,datetime):
hours += dte.hour
minutes = hours*60 + dte.minute
second... | [
"Convert",
"a",
"date",
"or",
"datetime",
"object",
"into",
"a",
"javsacript",
"timestamp",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/lib/fallback/dates.py#L21-L32 | [
"def",
"jstimestamp",
"(",
"dte",
")",
":",
"days",
"=",
"date",
"(",
"dte",
".",
"year",
",",
"dte",
".",
"month",
",",
"1",
")",
".",
"toordinal",
"(",
")",
"-",
"_EPOCH_ORD",
"+",
"dte",
".",
"day",
"-",
"1",
"hours",
"=",
"days",
"*",
"24",... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | html2rst | Convert a string or html file to an rst table string.
Parameters
----------
html_string : str
Either the html string, or the filepath to the html
force_headers : bool
Make the first row become headers, whether or not they are
headers in the html file.
center_cells : bool
... | dashtable/html2rst.py | def html2rst(html_string, force_headers=False, center_cells=False,
center_headers=False):
"""
Convert a string or html file to an rst table string.
Parameters
----------
html_string : str
Either the html string, or the filepath to the html
force_headers : bool
Make ... | def html2rst(html_string, force_headers=False, center_cells=False,
center_headers=False):
"""
Convert a string or html file to an rst table string.
Parameters
----------
html_string : str
Either the html string, or the filepath to the html
force_headers : bool
Make ... | [
"Convert",
"a",
"string",
"or",
"html",
"file",
"to",
"an",
"rst",
"table",
"string",
"."
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/html2rst.py#L6-L91 | [
"def",
"html2rst",
"(",
"html_string",
",",
"force_headers",
"=",
"False",
",",
"center_cells",
"=",
"False",
",",
"center_headers",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"html_string",
")",
":",
"file",
"=",
"open",
"(",
... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | make_span | Create a list of rows and columns that will make up a span
Parameters
----------
row : int
The row of the first cell in the span
column : int
The column of the first cell in the span
extra_rows : int
The number of rows that make up the span
extra_columns : int
Th... | dashtable/dashutils/make_span.py | def make_span(row, column, extra_rows, extra_columns):
"""
Create a list of rows and columns that will make up a span
Parameters
----------
row : int
The row of the first cell in the span
column : int
The column of the first cell in the span
extra_rows : int
The numb... | def make_span(row, column, extra_rows, extra_columns):
"""
Create a list of rows and columns that will make up a span
Parameters
----------
row : int
The row of the first cell in the span
column : int
The column of the first cell in the span
extra_rows : int
The numb... | [
"Create",
"a",
"list",
"of",
"rows",
"and",
"columns",
"that",
"will",
"make",
"up",
"a",
"span"
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/dashutils/make_span.py#L1-L30 | [
"def",
"make_span",
"(",
"row",
",",
"column",
",",
"extra_rows",
",",
"extra_columns",
")",
":",
"span",
"=",
"[",
"[",
"row",
",",
"column",
"]",
"]",
"for",
"r",
"in",
"range",
"(",
"row",
",",
"row",
"+",
"extra_rows",
"+",
"1",
")",
":",
"sp... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | make_cell | Convert the contents of a span of the table to a grid table cell
Parameters
----------
table : list of lists of str
The table of rows containg strings to convert to a grid table
span : list of lists of int
list of [row, column] pairs that make up a span in the table
widths : list of... | dashtable/data2rst/make_cell.py | def make_cell(table, span, widths, heights, use_headers):
"""
Convert the contents of a span of the table to a grid table cell
Parameters
----------
table : list of lists of str
The table of rows containg strings to convert to a grid table
span : list of lists of int
list of [ro... | def make_cell(table, span, widths, heights, use_headers):
"""
Convert the contents of a span of the table to a grid table cell
Parameters
----------
table : list of lists of str
The table of rows containg strings to convert to a grid table
span : list of lists of int
list of [ro... | [
"Convert",
"the",
"contents",
"of",
"a",
"span",
"of",
"the",
"table",
"to",
"a",
"grid",
"table",
"cell"
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/data2rst/make_cell.py#L9-L70 | [
"def",
"make_cell",
"(",
"table",
",",
"span",
",",
"widths",
",",
"heights",
",",
"use_headers",
")",
":",
"width",
"=",
"get_span_char_width",
"(",
"span",
",",
"widths",
")",
"height",
"=",
"get_span_char_height",
"(",
"span",
",",
"heights",
")",
"text... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | InvenioDB.init_app | Initialize application object. | invenio_db/ext.py | def init_app(self, app, **kwargs):
"""Initialize application object."""
self.init_db(app, **kwargs)
app.config.setdefault('ALEMBIC', {
'script_location': pkg_resources.resource_filename(
'invenio_db', 'alembic'
),
'version_locations': [
... | def init_app(self, app, **kwargs):
"""Initialize application object."""
self.init_db(app, **kwargs)
app.config.setdefault('ALEMBIC', {
'script_location': pkg_resources.resource_filename(
'invenio_db', 'alembic'
),
'version_locations': [
... | [
"Initialize",
"application",
"object",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/ext.py#L34-L53 | [
"def",
"init_app",
"(",
"self",
",",
"app",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"init_db",
"(",
"app",
",",
"*",
"*",
"kwargs",
")",
"app",
".",
"config",
".",
"setdefault",
"(",
"'ALEMBIC'",
",",
"{",
"'script_location'",
":",
"pkg_resou... | 9009a4cf79574083e129909cf3d2656568550184 |
train | InvenioDB.init_db | Initialize Flask-SQLAlchemy extension. | invenio_db/ext.py | def init_db(self, app, entry_point_group='invenio_db.models', **kwargs):
"""Initialize Flask-SQLAlchemy extension."""
# Setup SQLAlchemy
app.config.setdefault(
'SQLALCHEMY_DATABASE_URI',
'sqlite:///' + os.path.join(app.instance_path, app.name + '.db')
)
ap... | def init_db(self, app, entry_point_group='invenio_db.models', **kwargs):
"""Initialize Flask-SQLAlchemy extension."""
# Setup SQLAlchemy
app.config.setdefault(
'SQLALCHEMY_DATABASE_URI',
'sqlite:///' + os.path.join(app.instance_path, app.name + '.db')
)
ap... | [
"Initialize",
"Flask",
"-",
"SQLAlchemy",
"extension",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/ext.py#L55-L88 | [
"def",
"init_db",
"(",
"self",
",",
"app",
",",
"entry_point_group",
"=",
"'invenio_db.models'",
",",
"*",
"*",
"kwargs",
")",
":",
"# Setup SQLAlchemy",
"app",
".",
"config",
".",
"setdefault",
"(",
"'SQLALCHEMY_DATABASE_URI'",
",",
"'sqlite:///'",
"+",
"os",
... | 9009a4cf79574083e129909cf3d2656568550184 |
train | InvenioDB.init_versioning | Initialize the versioning support using SQLAlchemy-Continuum. | invenio_db/ext.py | def init_versioning(self, app, database, versioning_manager=None):
"""Initialize the versioning support using SQLAlchemy-Continuum."""
try:
pkg_resources.get_distribution('sqlalchemy_continuum')
except pkg_resources.DistributionNotFound: # pragma: no cover
default_versio... | def init_versioning(self, app, database, versioning_manager=None):
"""Initialize the versioning support using SQLAlchemy-Continuum."""
try:
pkg_resources.get_distribution('sqlalchemy_continuum')
except pkg_resources.DistributionNotFound: # pragma: no cover
default_versio... | [
"Initialize",
"the",
"versioning",
"support",
"using",
"SQLAlchemy",
"-",
"Continuum",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/ext.py#L90-L142 | [
"def",
"init_versioning",
"(",
"self",
",",
"app",
",",
"database",
",",
"versioning_manager",
"=",
"None",
")",
":",
"try",
":",
"pkg_resources",
".",
"get_distribution",
"(",
"'sqlalchemy_continuum'",
")",
"except",
"pkg_resources",
".",
"DistributionNotFound",
... | 9009a4cf79574083e129909cf3d2656568550184 |
train | extract_table | Convert an html string to data table
Parameters
----------
html_string : str
row_count : int
column_count : int
Returns
-------
data_table : list of lists of str | dashtable/html2data/extract_table.py | def extract_table(html_string, row_count, column_count):
"""
Convert an html string to data table
Parameters
----------
html_string : str
row_count : int
column_count : int
Returns
-------
data_table : list of lists of str
"""
try:
from bs4 import BeautifulSoup
... | def extract_table(html_string, row_count, column_count):
"""
Convert an html string to data table
Parameters
----------
html_string : str
row_count : int
column_count : int
Returns
-------
data_table : list of lists of str
"""
try:
from bs4 import BeautifulSoup
... | [
"Convert",
"an",
"html",
"string",
"to",
"data",
"table"
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/html2data/extract_table.py#L4-L92 | [
"def",
"extract_table",
"(",
"html_string",
",",
"row_count",
",",
"column_count",
")",
":",
"try",
":",
"from",
"bs4",
"import",
"BeautifulSoup",
"from",
"bs4",
".",
"element",
"import",
"Tag",
"except",
"ImportError",
":",
"print",
"(",
"\"ERROR: You must have... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | do_sqlite_connect | Ensure SQLite checks foreign key constraints.
For further details see "Foreign key support" sections on
https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#foreign-key-support | invenio_db/shared.py | def do_sqlite_connect(dbapi_connection, connection_record):
"""Ensure SQLite checks foreign key constraints.
For further details see "Foreign key support" sections on
https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#foreign-key-support
"""
# Enable foreign key constraint checking
curs... | def do_sqlite_connect(dbapi_connection, connection_record):
"""Ensure SQLite checks foreign key constraints.
For further details see "Foreign key support" sections on
https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#foreign-key-support
"""
# Enable foreign key constraint checking
curs... | [
"Ensure",
"SQLite",
"checks",
"foreign",
"key",
"constraints",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/shared.py#L82-L91 | [
"def",
"do_sqlite_connect",
"(",
"dbapi_connection",
",",
"connection_record",
")",
":",
"# Enable foreign key constraint checking",
"cursor",
"=",
"dbapi_connection",
".",
"cursor",
"(",
")",
"cursor",
".",
"execute",
"(",
"'PRAGMA foreign_keys=ON'",
")",
"cursor",
"."... | 9009a4cf79574083e129909cf3d2656568550184 |
train | SQLAlchemy.apply_driver_hacks | Call before engine creation. | invenio_db/shared.py | def apply_driver_hacks(self, app, info, options):
"""Call before engine creation."""
# Don't forget to apply hacks defined on parent object.
super(SQLAlchemy, self).apply_driver_hacks(app, info, options)
if info.drivername == 'sqlite':
connect_args = options.setdefault('conn... | def apply_driver_hacks(self, app, info, options):
"""Call before engine creation."""
# Don't forget to apply hacks defined on parent object.
super(SQLAlchemy, self).apply_driver_hacks(app, info, options)
if info.drivername == 'sqlite':
connect_args = options.setdefault('conn... | [
"Call",
"before",
"engine",
"creation",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/shared.py#L32-L79 | [
"def",
"apply_driver_hacks",
"(",
"self",
",",
"app",
",",
"info",
",",
"options",
")",
":",
"# Don't forget to apply hacks defined on parent object.",
"super",
"(",
"SQLAlchemy",
",",
"self",
")",
".",
"apply_driver_hacks",
"(",
"app",
",",
"info",
",",
"options"... | 9009a4cf79574083e129909cf3d2656568550184 |
train | create | Create tables. | invenio_db/cli.py | def create(verbose):
"""Create tables."""
click.secho('Creating all tables!', fg='yellow', bold=True)
with click.progressbar(_db.metadata.sorted_tables) as bar:
for table in bar:
if verbose:
click.echo(' Creating table {0}'.format(table))
table.create(bind=_db... | def create(verbose):
"""Create tables."""
click.secho('Creating all tables!', fg='yellow', bold=True)
with click.progressbar(_db.metadata.sorted_tables) as bar:
for table in bar:
if verbose:
click.echo(' Creating table {0}'.format(table))
table.create(bind=_db... | [
"Create",
"tables",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/cli.py#L49-L58 | [
"def",
"create",
"(",
"verbose",
")",
":",
"click",
".",
"secho",
"(",
"'Creating all tables!'",
",",
"fg",
"=",
"'yellow'",
",",
"bold",
"=",
"True",
")",
"with",
"click",
".",
"progressbar",
"(",
"_db",
".",
"metadata",
".",
"sorted_tables",
")",
"as",... | 9009a4cf79574083e129909cf3d2656568550184 |
train | drop | Drop tables. | invenio_db/cli.py | def drop(verbose):
"""Drop tables."""
click.secho('Dropping all tables!', fg='red', bold=True)
with click.progressbar(reversed(_db.metadata.sorted_tables)) as bar:
for table in bar:
if verbose:
click.echo(' Dropping table {0}'.format(table))
table.drop(bind=_d... | def drop(verbose):
"""Drop tables."""
click.secho('Dropping all tables!', fg='red', bold=True)
with click.progressbar(reversed(_db.metadata.sorted_tables)) as bar:
for table in bar:
if verbose:
click.echo(' Dropping table {0}'.format(table))
table.drop(bind=_d... | [
"Drop",
"tables",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/cli.py#L67-L76 | [
"def",
"drop",
"(",
"verbose",
")",
":",
"click",
".",
"secho",
"(",
"'Dropping all tables!'",
",",
"fg",
"=",
"'red'",
",",
"bold",
"=",
"True",
")",
"with",
"click",
".",
"progressbar",
"(",
"reversed",
"(",
"_db",
".",
"metadata",
".",
"sorted_tables"... | 9009a4cf79574083e129909cf3d2656568550184 |
train | init | Create database. | invenio_db/cli.py | def init():
"""Create database."""
click.secho('Creating database {0}'.format(_db.engine.url),
fg='green')
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url)) | def init():
"""Create database."""
click.secho('Creating database {0}'.format(_db.engine.url),
fg='green')
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url)) | [
"Create",
"database",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/cli.py#L81-L86 | [
"def",
"init",
"(",
")",
":",
"click",
".",
"secho",
"(",
"'Creating database {0}'",
".",
"format",
"(",
"_db",
".",
"engine",
".",
"url",
")",
",",
"fg",
"=",
"'green'",
")",
"if",
"not",
"database_exists",
"(",
"str",
"(",
"_db",
".",
"engine",
"."... | 9009a4cf79574083e129909cf3d2656568550184 |
train | destroy | Drop database. | invenio_db/cli.py | def destroy():
"""Drop database."""
click.secho('Destroying database {0}'.format(_db.engine.url),
fg='red', bold=True)
if _db.engine.name == 'sqlite':
try:
drop_database(_db.engine.url)
except FileNotFoundError as e:
click.secho('Sqlite database has no... | def destroy():
"""Drop database."""
click.secho('Destroying database {0}'.format(_db.engine.url),
fg='red', bold=True)
if _db.engine.name == 'sqlite':
try:
drop_database(_db.engine.url)
except FileNotFoundError as e:
click.secho('Sqlite database has no... | [
"Drop",
"database",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/cli.py#L94-L105 | [
"def",
"destroy",
"(",
")",
":",
"click",
".",
"secho",
"(",
"'Destroying database {0}'",
".",
"format",
"(",
"_db",
".",
"engine",
".",
"url",
")",
",",
"fg",
"=",
"'red'",
",",
"bold",
"=",
"True",
")",
"if",
"_db",
".",
"engine",
".",
"name",
"=... | 9009a4cf79574083e129909cf3d2656568550184 |
train | rollingOperation.rolling | Fast rolling operation with O(log n) updates where n is the
window size | dynts/stats/rolling.py | def rolling(self, op):
"""Fast rolling operation with O(log n) updates where n is the
window size
"""
missing = self.missing
ismissing = self.ismissing
window = self.window
it = iter(self.iterable)
queue = deque(islice(it, window))
ol = self.skip... | def rolling(self, op):
"""Fast rolling operation with O(log n) updates where n is the
window size
"""
missing = self.missing
ismissing = self.ismissing
window = self.window
it = iter(self.iterable)
queue = deque(islice(it, window))
ol = self.skip... | [
"Fast",
"rolling",
"operation",
"with",
"O",
"(",
"log",
"n",
")",
"updates",
"where",
"n",
"is",
"the",
"window",
"size"
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/rolling.py#L65-L83 | [
"def",
"rolling",
"(",
"self",
",",
"op",
")",
":",
"missing",
"=",
"self",
".",
"missing",
"ismissing",
"=",
"self",
".",
"ismissing",
"window",
"=",
"self",
".",
"window",
"it",
"=",
"iter",
"(",
"self",
".",
"iterable",
")",
"queue",
"=",
"deque",... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | get_span_column_count | Find the length of a colspan.
Parameters
----------
span : list of lists of int
The [row, column] pairs that make up the span
Returns
-------
columns : int
The number of columns included in the span
Example
-------
Consider this table::
+------+-----------... | dashtable/dashutils/get_span_column_count.py | def get_span_column_count(span):
"""
Find the length of a colspan.
Parameters
----------
span : list of lists of int
The [row, column] pairs that make up the span
Returns
-------
columns : int
The number of columns included in the span
Example
-------
Consi... | def get_span_column_count(span):
"""
Find the length of a colspan.
Parameters
----------
span : list of lists of int
The [row, column] pairs that make up the span
Returns
-------
columns : int
The number of columns included in the span
Example
-------
Consi... | [
"Find",
"the",
"length",
"of",
"a",
"colspan",
"."
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/dashutils/get_span_column_count.py#L1-L39 | [
"def",
"get_span_column_count",
"(",
"span",
")",
":",
"columns",
"=",
"1",
"first_column",
"=",
"span",
"[",
"0",
"]",
"[",
"1",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"span",
")",
")",
":",
"if",
"span",
"[",
"i",
"]",
"[",
"1",
"]"... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | TreeStyle.to_dict | returns self as a dictionary with _underscore subdicts corrected. | toytree/TreeStyle.py | def to_dict(self):
"returns self as a dictionary with _underscore subdicts corrected."
ndict = {}
for key, val in self.__dict__.items():
if key[0] == "_":
ndict[key[1:]] = val
else:
ndict[key] = val
return ndict | def to_dict(self):
"returns self as a dictionary with _underscore subdicts corrected."
ndict = {}
for key, val in self.__dict__.items():
if key[0] == "_":
ndict[key[1:]] = val
else:
ndict[key] = val
return ndict | [
"returns",
"self",
"as",
"a",
"dictionary",
"with",
"_underscore",
"subdicts",
"corrected",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/TreeStyle.py#L164-L172 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"ndict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"self",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"key",
"[",
"0",
"]",
"==",
"\"_\"",
":",
"ndict",
"[",
"key",
"[",
"1",
":",
"]",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | get_span_char_width | Sum the widths of the columns that make up the span, plus the extra.
Parameters
----------
span : list of lists of int
list of [row, column] pairs that make up the span
column_widths : list of int
The widths of the columns that make up the table
Returns
-------
total_width ... | dashtable/dashutils/get_span_char_width.py | def get_span_char_width(span, column_widths):
"""
Sum the widths of the columns that make up the span, plus the extra.
Parameters
----------
span : list of lists of int
list of [row, column] pairs that make up the span
column_widths : list of int
The widths of the columns that m... | def get_span_char_width(span, column_widths):
"""
Sum the widths of the columns that make up the span, plus the extra.
Parameters
----------
span : list of lists of int
list of [row, column] pairs that make up the span
column_widths : list of int
The widths of the columns that m... | [
"Sum",
"the",
"widths",
"of",
"the",
"columns",
"that",
"make",
"up",
"the",
"span",
"plus",
"the",
"extra",
"."
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/dashutils/get_span_char_width.py#L4-L30 | [
"def",
"get_span_char_width",
"(",
"span",
",",
"column_widths",
")",
":",
"start_column",
"=",
"span",
"[",
"0",
"]",
"[",
"1",
"]",
"column_count",
"=",
"get_span_column_count",
"(",
"span",
")",
"total_width",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | rebuild_encrypted_properties | Rebuild a model's EncryptedType properties when the SECRET_KEY is changed.
:param old_key: old SECRET_KEY.
:param model: the affected db model.
:param properties: list of properties to rebuild. | invenio_db/utils.py | def rebuild_encrypted_properties(old_key, model, properties):
"""Rebuild a model's EncryptedType properties when the SECRET_KEY is changed.
:param old_key: old SECRET_KEY.
:param model: the affected db model.
:param properties: list of properties to rebuild.
"""
inspector = reflection.Inspector... | def rebuild_encrypted_properties(old_key, model, properties):
"""Rebuild a model's EncryptedType properties when the SECRET_KEY is changed.
:param old_key: old SECRET_KEY.
:param model: the affected db model.
:param properties: list of properties to rebuild.
"""
inspector = reflection.Inspector... | [
"Rebuild",
"a",
"model",
"s",
"EncryptedType",
"properties",
"when",
"the",
"SECRET_KEY",
"is",
"changed",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/utils.py#L21-L58 | [
"def",
"rebuild_encrypted_properties",
"(",
"old_key",
",",
"model",
",",
"properties",
")",
":",
"inspector",
"=",
"reflection",
".",
"Inspector",
".",
"from_engine",
"(",
"db",
".",
"engine",
")",
"primary_key_names",
"=",
"inspector",
".",
"get_primary_keys",
... | 9009a4cf79574083e129909cf3d2656568550184 |
train | create_alembic_version_table | Create alembic_version table. | invenio_db/utils.py | def create_alembic_version_table():
"""Create alembic_version table."""
alembic = current_app.extensions['invenio-db'].alembic
if not alembic.migration_context._has_version_table():
alembic.migration_context._ensure_version_table()
for head in alembic.script_directory.revision_map._real_head... | def create_alembic_version_table():
"""Create alembic_version table."""
alembic = current_app.extensions['invenio-db'].alembic
if not alembic.migration_context._has_version_table():
alembic.migration_context._ensure_version_table()
for head in alembic.script_directory.revision_map._real_head... | [
"Create",
"alembic_version",
"table",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/utils.py#L61-L67 | [
"def",
"create_alembic_version_table",
"(",
")",
":",
"alembic",
"=",
"current_app",
".",
"extensions",
"[",
"'invenio-db'",
"]",
".",
"alembic",
"if",
"not",
"alembic",
".",
"migration_context",
".",
"_has_version_table",
"(",
")",
":",
"alembic",
".",
"migrati... | 9009a4cf79574083e129909cf3d2656568550184 |
train | drop_alembic_version_table | Drop alembic_version table. | invenio_db/utils.py | def drop_alembic_version_table():
"""Drop alembic_version table."""
if _db.engine.dialect.has_table(_db.engine, 'alembic_version'):
alembic_version = _db.Table('alembic_version', _db.metadata,
autoload_with=_db.engine)
alembic_version.drop(bind=_db.engine) | def drop_alembic_version_table():
"""Drop alembic_version table."""
if _db.engine.dialect.has_table(_db.engine, 'alembic_version'):
alembic_version = _db.Table('alembic_version', _db.metadata,
autoload_with=_db.engine)
alembic_version.drop(bind=_db.engine) | [
"Drop",
"alembic_version",
"table",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/utils.py#L70-L75 | [
"def",
"drop_alembic_version_table",
"(",
")",
":",
"if",
"_db",
".",
"engine",
".",
"dialect",
".",
"has_table",
"(",
"_db",
".",
"engine",
",",
"'alembic_version'",
")",
":",
"alembic_version",
"=",
"_db",
".",
"Table",
"(",
"'alembic_version'",
",",
"_db"... | 9009a4cf79574083e129909cf3d2656568550184 |
train | versioning_model_classname | Get the name of the versioned model class. | invenio_db/utils.py | def versioning_model_classname(manager, model):
"""Get the name of the versioned model class."""
if manager.options.get('use_module_name', True):
return '%s%sVersion' % (
model.__module__.title().replace('.', ''), model.__name__)
else:
return '%sVersion' % (model.__name__,) | def versioning_model_classname(manager, model):
"""Get the name of the versioned model class."""
if manager.options.get('use_module_name', True):
return '%s%sVersion' % (
model.__module__.title().replace('.', ''), model.__name__)
else:
return '%sVersion' % (model.__name__,) | [
"Get",
"the",
"name",
"of",
"the",
"versioned",
"model",
"class",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/utils.py#L78-L84 | [
"def",
"versioning_model_classname",
"(",
"manager",
",",
"model",
")",
":",
"if",
"manager",
".",
"options",
".",
"get",
"(",
"'use_module_name'",
",",
"True",
")",
":",
"return",
"'%s%sVersion'",
"%",
"(",
"model",
".",
"__module__",
".",
"title",
"(",
"... | 9009a4cf79574083e129909cf3d2656568550184 |
train | versioning_models_registered | Return True if all versioning models have been registered. | invenio_db/utils.py | def versioning_models_registered(manager, base):
"""Return True if all versioning models have been registered."""
declared_models = base._decl_class_registry.keys()
return all(versioning_model_classname(manager, c) in declared_models
for c in manager.pending_classes) | def versioning_models_registered(manager, base):
"""Return True if all versioning models have been registered."""
declared_models = base._decl_class_registry.keys()
return all(versioning_model_classname(manager, c) in declared_models
for c in manager.pending_classes) | [
"Return",
"True",
"if",
"all",
"versioning",
"models",
"have",
"been",
"registered",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/utils.py#L87-L91 | [
"def",
"versioning_models_registered",
"(",
"manager",
",",
"base",
")",
":",
"declared_models",
"=",
"base",
".",
"_decl_class_registry",
".",
"keys",
"(",
")",
"return",
"all",
"(",
"versioning_model_classname",
"(",
"manager",
",",
"c",
")",
"in",
"declared_m... | 9009a4cf79574083e129909cf3d2656568550184 |
train | vector_to_symmetric | Convert an iterable into a symmetric matrix. | dynts/stats/variates.py | def vector_to_symmetric(v):
'''Convert an iterable into a symmetric matrix.'''
np = len(v)
N = (int(sqrt(1 + 8*np)) - 1)//2
if N*(N+1)//2 != np:
raise ValueError('Cannot convert vector to symmetric matrix')
sym = ndarray((N,N))
iterable = iter(v)
for r in range(N):
f... | def vector_to_symmetric(v):
'''Convert an iterable into a symmetric matrix.'''
np = len(v)
N = (int(sqrt(1 + 8*np)) - 1)//2
if N*(N+1)//2 != np:
raise ValueError('Cannot convert vector to symmetric matrix')
sym = ndarray((N,N))
iterable = iter(v)
for r in range(N):
f... | [
"Convert",
"an",
"iterable",
"into",
"a",
"symmetric",
"matrix",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/variates.py#L7-L18 | [
"def",
"vector_to_symmetric",
"(",
"v",
")",
":",
"np",
"=",
"len",
"(",
"v",
")",
"N",
"=",
"(",
"int",
"(",
"sqrt",
"(",
"1",
"+",
"8",
"*",
"np",
")",
")",
"-",
"1",
")",
"//",
"2",
"if",
"N",
"*",
"(",
"N",
"+",
"1",
")",
"//",
"2",... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | Variates.cov | The covariance matrix from the aggregate sample. It accepts an
optional parameter for the degree of freedoms.
:parameter ddof: If not ``None`` normalization is by (N - ddof), where N is
the number of observations; this overrides the value implied by bias.
The default value ... | dynts/stats/variates.py | def cov(self, ddof=None, bias=0):
'''The covariance matrix from the aggregate sample. It accepts an
optional parameter for the degree of freedoms.
:parameter ddof: If not ``None`` normalization is by (N - ddof), where N is
the number of observations; this overrides the value im... | def cov(self, ddof=None, bias=0):
'''The covariance matrix from the aggregate sample. It accepts an
optional parameter for the degree of freedoms.
:parameter ddof: If not ``None`` normalization is by (N - ddof), where N is
the number of observations; this overrides the value im... | [
"The",
"covariance",
"matrix",
"from",
"the",
"aggregate",
"sample",
".",
"It",
"accepts",
"an",
"optional",
"parameter",
"for",
"the",
"degree",
"of",
"freedoms",
".",
":",
"parameter",
"ddof",
":",
"If",
"not",
"None",
"normalization",
"is",
"by",
"(",
"... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/variates.py#L60-L71 | [
"def",
"cov",
"(",
"self",
",",
"ddof",
"=",
"None",
",",
"bias",
"=",
"0",
")",
":",
"N",
"=",
"self",
".",
"n",
"M",
"=",
"N",
"if",
"bias",
"else",
"N",
"-",
"1",
"M",
"=",
"M",
"if",
"ddof",
"is",
"None",
"else",
"N",
"-",
"ddof",
"re... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | Variates.corr | The correlation matrix | dynts/stats/variates.py | def corr(self):
'''The correlation matrix'''
cov = self.cov()
N = cov.shape[0]
corr = ndarray((N,N))
for r in range(N):
for c in range(r):
corr[r,c] = corr[c,r] = cov[r,c]/sqrt(cov[r,r]*cov[c,c])
corr[r,r] = 1.
return corr | def corr(self):
'''The correlation matrix'''
cov = self.cov()
N = cov.shape[0]
corr = ndarray((N,N))
for r in range(N):
for c in range(r):
corr[r,c] = corr[c,r] = cov[r,c]/sqrt(cov[r,r]*cov[c,c])
corr[r,r] = 1.
return corr | [
"The",
"correlation",
"matrix"
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/variates.py#L73-L82 | [
"def",
"corr",
"(",
"self",
")",
":",
"cov",
"=",
"self",
".",
"cov",
"(",
")",
"N",
"=",
"cov",
".",
"shape",
"[",
"0",
"]",
"corr",
"=",
"ndarray",
"(",
"(",
"N",
",",
"N",
")",
")",
"for",
"r",
"in",
"range",
"(",
"N",
")",
":",
"for",... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | calmar | Calculate the Calmar ratio for a Weiner process
@param sharpe: Annualized Sharpe ratio
@param T: Time interval in years | dynts/stats/functions.py | def calmar(sharpe, T = 1.0):
'''
Calculate the Calmar ratio for a Weiner process
@param sharpe: Annualized Sharpe ratio
@param T: Time interval in years
'''
x = 0.5*T*sharpe*sharpe
return x/qp(x) | def calmar(sharpe, T = 1.0):
'''
Calculate the Calmar ratio for a Weiner process
@param sharpe: Annualized Sharpe ratio
@param T: Time interval in years
'''
x = 0.5*T*sharpe*sharpe
return x/qp(x) | [
"Calculate",
"the",
"Calmar",
"ratio",
"for",
"a",
"Weiner",
"process"
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/functions.py#L9-L17 | [
"def",
"calmar",
"(",
"sharpe",
",",
"T",
"=",
"1.0",
")",
":",
"x",
"=",
"0.5",
"*",
"T",
"*",
"sharpe",
"*",
"sharpe",
"return",
"x",
"/",
"qp",
"(",
"x",
")"
] | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | calmarnorm | Multiplicator for normalizing calmar ratio to period tau | dynts/stats/functions.py | def calmarnorm(sharpe, T, tau = 1.0):
'''
Multiplicator for normalizing calmar ratio to period tau
'''
return calmar(sharpe,tau)/calmar(sharpe,T) | def calmarnorm(sharpe, T, tau = 1.0):
'''
Multiplicator for normalizing calmar ratio to period tau
'''
return calmar(sharpe,tau)/calmar(sharpe,T) | [
"Multiplicator",
"for",
"normalizing",
"calmar",
"ratio",
"to",
"period",
"tau"
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/functions.py#L20-L24 | [
"def",
"calmarnorm",
"(",
"sharpe",
",",
"T",
",",
"tau",
"=",
"1.0",
")",
":",
"return",
"calmar",
"(",
"sharpe",
",",
"tau",
")",
"/",
"calmar",
"(",
"sharpe",
",",
"T",
")"
] | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | upgrade | Upgrade database. | invenio_db/alembic/35c1075e6360_force_naming_convention.py | def upgrade():
"""Upgrade database."""
op.execute('COMMIT') # See https://bitbucket.org/zzzeek/alembic/issue/123
ctx = op.get_context()
metadata = ctx.opts['target_metadata']
metadata.naming_convention = NAMING_CONVENTION
metadata.bind = ctx.connection.engine
insp = Inspector.from_engine(ct... | def upgrade():
"""Upgrade database."""
op.execute('COMMIT') # See https://bitbucket.org/zzzeek/alembic/issue/123
ctx = op.get_context()
metadata = ctx.opts['target_metadata']
metadata.naming_convention = NAMING_CONVENTION
metadata.bind = ctx.connection.engine
insp = Inspector.from_engine(ct... | [
"Upgrade",
"database",
"."
] | inveniosoftware/invenio-db | python | https://github.com/inveniosoftware/invenio-db/blob/9009a4cf79574083e129909cf3d2656568550184/invenio_db/alembic/35c1075e6360_force_naming_convention.py#L31-L98 | [
"def",
"upgrade",
"(",
")",
":",
"op",
".",
"execute",
"(",
"'COMMIT'",
")",
"# See https://bitbucket.org/zzzeek/alembic/issue/123",
"ctx",
"=",
"op",
".",
"get_context",
"(",
")",
"metadata",
"=",
"ctx",
".",
"opts",
"[",
"'target_metadata'",
"]",
"metadata",
... | 9009a4cf79574083e129909cf3d2656568550184 |
train | data2simplerst | Convert table data to a simple rst table
Parameters
----------
table : list of lists of str
A table of strings.
spans : list of lists of lists of int
A list of spans. A span is a list of [Row, Column] pairs of
table cells that are joined together.
use_headers : bool, optiona... | dashtable/data2simplerst/data2simplerst.py | def data2simplerst(table, spans=[[[0, 0]]], use_headers=True, headers_row=0):
"""
Convert table data to a simple rst table
Parameters
----------
table : list of lists of str
A table of strings.
spans : list of lists of lists of int
A list of spans. A span is a list of [Row, Colu... | def data2simplerst(table, spans=[[[0, 0]]], use_headers=True, headers_row=0):
"""
Convert table data to a simple rst table
Parameters
----------
table : list of lists of str
A table of strings.
spans : list of lists of lists of int
A list of spans. A span is a list of [Row, Colu... | [
"Convert",
"table",
"data",
"to",
"a",
"simple",
"rst",
"table"
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/data2simplerst/data2simplerst.py#L13-L153 | [
"def",
"data2simplerst",
"(",
"table",
",",
"spans",
"=",
"[",
"[",
"[",
"0",
",",
"0",
"]",
"]",
"]",
",",
"use_headers",
"=",
"True",
",",
"headers_row",
"=",
"0",
")",
":",
"table",
"=",
"copy",
".",
"deepcopy",
"(",
"table",
")",
"table_ok",
... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | add_links | Add the links to the bottom of the text | dashtable/html2data/restructify/add_links.py | def add_links(converted_text, html):
"""
Add the links to the bottom of the text
"""
soup = BeautifulSoup(html, 'html.parser')
link_exceptions = [
'footnote-reference',
'fn-backref',
'citation-reference'
]
footnotes = {}
citations = {}
backrefs = {}
lin... | def add_links(converted_text, html):
"""
Add the links to the bottom of the text
"""
soup = BeautifulSoup(html, 'html.parser')
link_exceptions = [
'footnote-reference',
'fn-backref',
'citation-reference'
]
footnotes = {}
citations = {}
backrefs = {}
lin... | [
"Add",
"the",
"links",
"to",
"the",
"bottom",
"of",
"the",
"text"
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/html2data/restructify/add_links.py#L5-L65 | [
"def",
"add_links",
"(",
"converted_text",
",",
"html",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"html",
",",
"'html.parser'",
")",
"link_exceptions",
"=",
"[",
"'footnote-reference'",
",",
"'fn-backref'",
",",
"'citation-reference'",
"]",
"footnotes",
"=",
... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | TimeSerieLoader.load | Load symbols data.
:keyword providers: Dictionary of registered data providers.
:keyword symbols: list of symbols to load.
:keyword start: start date.
:keyword end: end date.
:keyword logger: instance of :class:`logging.Logger` or ``None``.
:keyword backend: :clas... | dynts/data/__init__.py | def load(self, providers, symbols, start, end, logger, backend, **kwargs):
'''Load symbols data.
:keyword providers: Dictionary of registered data providers.
:keyword symbols: list of symbols to load.
:keyword start: start date.
:keyword end: end date.
:keyword lo... | def load(self, providers, symbols, start, end, logger, backend, **kwargs):
'''Load symbols data.
:keyword providers: Dictionary of registered data providers.
:keyword symbols: list of symbols to load.
:keyword start: start date.
:keyword end: end date.
:keyword lo... | [
"Load",
"symbols",
"data",
".",
":",
"keyword",
"providers",
":",
"Dictionary",
"of",
"registered",
"data",
"providers",
".",
":",
"keyword",
"symbols",
":",
"list",
"of",
"symbols",
"to",
"load",
".",
":",
"keyword",
"start",
":",
"start",
"date",
".",
... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L90-L133 | [
"def",
"load",
"(",
"self",
",",
"providers",
",",
"symbols",
",",
"start",
",",
"end",
",",
"logger",
",",
"backend",
",",
"*",
"*",
"kwargs",
")",
":",
"# Preconditioning on dates\r",
"logger",
"=",
"logger",
"or",
"logging",
".",
"getLogger",
"(",
"se... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | TimeSerieLoader.dates | Internal function which perform pre-conditioning on dates:
:keyword start: start date.
:keyword end: end date.
This function makes sure the *start* and *end* date are consistent.
It *never fails* and always return a two-element tuple
containing *start*, *end* with *start* less or equal *end*
and *end* never a... | dynts/data/__init__.py | def dates(self, start, end):
'''Internal function which perform pre-conditioning on dates:
:keyword start: start date.
:keyword end: end date.
This function makes sure the *start* and *end* date are consistent.
It *never fails* and always return a two-element tuple
containing *start*, *end* with *star... | def dates(self, start, end):
'''Internal function which perform pre-conditioning on dates:
:keyword start: start date.
:keyword end: end date.
This function makes sure the *start* and *end* date are consistent.
It *never fails* and always return a two-element tuple
containing *start*, *end* with *star... | [
"Internal",
"function",
"which",
"perform",
"pre",
"-",
"conditioning",
"on",
"dates",
":",
":",
"keyword",
"start",
":",
"start",
"date",
".",
":",
"keyword",
"end",
":",
"end",
"date",
".",
"This",
"function",
"makes",
"sure",
"the",
"*",
"start",
"*",... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L135-L153 | [
"def",
"dates",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"td",
"=",
"date",
".",
"today",
"(",
")",
"end",
"=",
"safetodate",
"(",
"end",
")",
"or",
"td",
"end",
"=",
"end",
"if",
"end",
"<=",
"td",
"else",
"td",
"start",
"=",
"safetoda... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | TimeSerieLoader.parse_symbol | Parse a symbol to obtain information regarding ticker,
field and provider. Must return an instance of :attr:`symboldata`.
:keyword symbol: string associated with market data to load.
:keyword providers: dictionary of :class:`dynts.data.DataProvider`
instances av... | dynts/data/__init__.py | def parse_symbol(self, symbol, providers):
'''Parse a symbol to obtain information regarding ticker,
field and provider. Must return an instance of :attr:`symboldata`.
:keyword symbol: string associated with market data to load.
:keyword providers: dictionary of :class:`dynts.data.... | def parse_symbol(self, symbol, providers):
'''Parse a symbol to obtain information regarding ticker,
field and provider. Must return an instance of :attr:`symboldata`.
:keyword symbol: string associated with market data to load.
:keyword providers: dictionary of :class:`dynts.data.... | [
"Parse",
"a",
"symbol",
"to",
"obtain",
"information",
"regarding",
"ticker",
"field",
"and",
"provider",
".",
"Must",
"return",
"an",
"instance",
"of",
":",
"attr",
":",
"symboldata",
".",
":",
"keyword",
"symbol",
":",
"string",
"associated",
"with",
"mark... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L155-L210 | [
"def",
"parse_symbol",
"(",
"self",
",",
"symbol",
",",
"providers",
")",
":",
"separator",
"=",
"settings",
".",
"field_separator",
"symbol",
"=",
"str",
"(",
"symbol",
")",
"bits",
"=",
"symbol",
".",
"split",
"(",
"separator",
")",
"pnames",
"=",
"pro... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | TimeSerieLoader.symbol_for_ticker | Return an instance of *symboldata* containing
information about the data provider, the data provider ticker name
and the data provider field. | dynts/data/__init__.py | def symbol_for_ticker(self, ticker, field, provider, providers):
'''Return an instance of *symboldata* containing
information about the data provider, the data provider ticker name
and the data provider field.'''
provider = provider or settings.default_provider
if provider:
pro... | def symbol_for_ticker(self, ticker, field, provider, providers):
'''Return an instance of *symboldata* containing
information about the data provider, the data provider ticker name
and the data provider field.'''
provider = provider or settings.default_provider
if provider:
pro... | [
"Return",
"an",
"instance",
"of",
"*",
"symboldata",
"*",
"containing",
"information",
"about",
"the",
"data",
"provider",
"the",
"data",
"provider",
"ticker",
"name",
"and",
"the",
"data",
"provider",
"field",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L212-L219 | [
"def",
"symbol_for_ticker",
"(",
"self",
",",
"ticker",
",",
"field",
",",
"provider",
",",
"providers",
")",
":",
"provider",
"=",
"provider",
"or",
"settings",
".",
"default_provider",
"if",
"provider",
":",
"provider",
"=",
"providers",
".",
"get",
"(",
... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | TimeSerieLoader.preprocess | Preprocess **hook**. This is first loading hook and it is
**called before requesting data** from a dataprovider.
It must return an instance of :attr:`TimeSerieLoader.preprocessdata`.
By default it returns::
self.preprocessdata(intervals = ((start,end),))
It could be overritten to modify the intervals.
If ... | dynts/data/__init__.py | def preprocess(self, ticker, start, end, logger, backend, **kwargs):
'''Preprocess **hook**. This is first loading hook and it is
**called before requesting data** from a dataprovider.
It must return an instance of :attr:`TimeSerieLoader.preprocessdata`.
By default it returns::
self.preprocessdata(in... | def preprocess(self, ticker, start, end, logger, backend, **kwargs):
'''Preprocess **hook**. This is first loading hook and it is
**called before requesting data** from a dataprovider.
It must return an instance of :attr:`TimeSerieLoader.preprocessdata`.
By default it returns::
self.preprocessdata(in... | [
"Preprocess",
"**",
"hook",
"**",
".",
"This",
"is",
"first",
"loading",
"hook",
"and",
"it",
"is",
"**",
"called",
"before",
"requesting",
"data",
"**",
"from",
"a",
"dataprovider",
".",
"It",
"must",
"return",
"an",
"instance",
"of",
":",
"attr",
":",
... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L230-L244 | [
"def",
"preprocess",
"(",
"self",
",",
"ticker",
",",
"start",
",",
"end",
",",
"logger",
",",
"backend",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"preprocessdata",
"(",
"intervals",
"=",
"(",
"(",
"start",
",",
"end",
")",
",",
")... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | DataProviders.register | Register a new data provider. *provider* must be an instance of
DataProvider. If provider name is already available, it will be replaced. | dynts/data/__init__.py | def register(self, provider):
'''Register a new data provider. *provider* must be an instance of
DataProvider. If provider name is already available, it will be replaced.'''
if isinstance(provider,type):
provider = provider()
self[provider.code] = provider | def register(self, provider):
'''Register a new data provider. *provider* must be an instance of
DataProvider. If provider name is already available, it will be replaced.'''
if isinstance(provider,type):
provider = provider()
self[provider.code] = provider | [
"Register",
"a",
"new",
"data",
"provider",
".",
"*",
"provider",
"*",
"must",
"be",
"an",
"instance",
"of",
"DataProvider",
".",
"If",
"provider",
"name",
"is",
"already",
"available",
"it",
"will",
"be",
"replaced",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L274-L279 | [
"def",
"register",
"(",
"self",
",",
"provider",
")",
":",
"if",
"isinstance",
"(",
"provider",
",",
"type",
")",
":",
"provider",
"=",
"provider",
"(",
")",
"self",
"[",
"provider",
".",
"code",
"]",
"=",
"provider"
] | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | DataProviders.unregister | Unregister an existing data provider.
*provider* must be an instance of DataProvider.
If provider name is already available, it will be replaced. | dynts/data/__init__.py | def unregister(self, provider):
'''Unregister an existing data provider.
*provider* must be an instance of DataProvider.
If provider name is already available, it will be replaced.
'''
if isinstance(provider, type):
provider = provider()
if isinstance... | def unregister(self, provider):
'''Unregister an existing data provider.
*provider* must be an instance of DataProvider.
If provider name is already available, it will be replaced.
'''
if isinstance(provider, type):
provider = provider()
if isinstance... | [
"Unregister",
"an",
"existing",
"data",
"provider",
".",
"*",
"provider",
"*",
"must",
"be",
"an",
"instance",
"of",
"DataProvider",
".",
"If",
"provider",
"name",
"is",
"already",
"available",
"it",
"will",
"be",
"replaced",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/data/__init__.py#L281-L291 | [
"def",
"unregister",
"(",
"self",
",",
"provider",
")",
":",
"if",
"isinstance",
"(",
"provider",
",",
"type",
")",
":",
"provider",
"=",
"provider",
"(",
")",
"if",
"isinstance",
"(",
"provider",
",",
"DataProvider",
")",
":",
"provider",
"=",
"provider... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | parse | Function for parsing :ref:`timeseries expressions <dsl-script>`.
If succesful, it returns an instance of :class:`dynts.dsl.Expr` which
can be used to to populate timeseries or scatters once data is available.
Parsing is implemented using the ply_ module,
an implementation of lex and yacc parsing t... | dynts/dsl/__init__.py | def parse(timeseries_expression, method=None, functions=None, debug=False):
'''Function for parsing :ref:`timeseries expressions <dsl-script>`.
If succesful, it returns an instance of :class:`dynts.dsl.Expr` which
can be used to to populate timeseries or scatters once data is available.
Parsing is... | def parse(timeseries_expression, method=None, functions=None, debug=False):
'''Function for parsing :ref:`timeseries expressions <dsl-script>`.
If succesful, it returns an instance of :class:`dynts.dsl.Expr` which
can be used to to populate timeseries or scatters once data is available.
Parsing is... | [
"Function",
"for",
"parsing",
":",
"ref",
":",
"timeseries",
"expressions",
"<dsl",
"-",
"script",
">",
".",
"If",
"succesful",
"it",
"returns",
"an",
"instance",
"of",
":",
"class",
":",
"dynts",
".",
"dsl",
".",
"Expr",
"which",
"can",
"be",
"used",
... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/dsl/__init__.py#L18-L43 | [
"def",
"parse",
"(",
"timeseries_expression",
",",
"method",
"=",
"None",
",",
"functions",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"if",
"not",
"parsefunc",
":",
"raise",
"ExpressionError",
"(",
"'Could not parse. No parser installed.'",
")",
"functi... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | evaluate | Evaluate a timeseries ``expression`` into
an instance of :class:`dynts.dsl.dslresult` which can be used
to obtain timeseries and/or scatters.
This is probably the most used function of the library.
:parameter expression: A timeseries expression string or an instance
of :class:`dynts.dsl.E... | dynts/dsl/__init__.py | def evaluate(expression, start=None, end=None, loader=None, logger=None,
backend=None, **kwargs):
'''Evaluate a timeseries ``expression`` into
an instance of :class:`dynts.dsl.dslresult` which can be used
to obtain timeseries and/or scatters.
This is probably the most used function of ... | def evaluate(expression, start=None, end=None, loader=None, logger=None,
backend=None, **kwargs):
'''Evaluate a timeseries ``expression`` into
an instance of :class:`dynts.dsl.dslresult` which can be used
to obtain timeseries and/or scatters.
This is probably the most used function of ... | [
"Evaluate",
"a",
"timeseries",
"expression",
"into",
"an",
"instance",
"of",
":",
"class",
":",
"dynts",
".",
"dsl",
".",
"dslresult",
"which",
"can",
"be",
"used",
"to",
"obtain",
"timeseries",
"and",
"/",
"or",
"scatters",
".",
"This",
"is",
"probably",
... | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/dsl/__init__.py#L46-L90 | [
"def",
"evaluate",
"(",
"expression",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"loader",
"=",
"None",
",",
"logger",
"=",
"None",
",",
"backend",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"expression",
... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | grid2data | Convert Grid table to data (the kind used by Dashtable)
Parameters
----------
text : str
The text must be a valid rst table
Returns
-------
table : list of lists of str
spans : list of lists of lists of int
A span is a list of [row, column] pairs that define a group of
... | dashtable/grid2data/grid2data.py | def grid2data(text):
"""
Convert Grid table to data (the kind used by Dashtable)
Parameters
----------
text : str
The text must be a valid rst table
Returns
-------
table : list of lists of str
spans : list of lists of lists of int
A span is a list of [row, column] p... | def grid2data(text):
"""
Convert Grid table to data (the kind used by Dashtable)
Parameters
----------
text : str
The text must be a valid rst table
Returns
-------
table : list of lists of str
spans : list of lists of lists of int
A span is a list of [row, column] p... | [
"Convert",
"Grid",
"table",
"to",
"data",
"(",
"the",
"kind",
"used",
"by",
"Dashtable",
")"
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/grid2data/grid2data.py#L6-L108 | [
"def",
"grid2data",
"(",
"text",
")",
":",
"try",
":",
"import",
"docutils",
".",
"statemachine",
"import",
"docutils",
".",
"parsers",
".",
"rst",
".",
"tableparser",
"except",
"ImportError",
":",
"print",
"(",
"\"ERROR: You must install the docutils library to use... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | MultiTree.get_consensus_tree | Returns an extended majority rule consensus tree as a Toytree object.
Node labels include 'support' values showing the occurrence of clades
in the consensus tree across trees in the input treelist.
Clades with support below 'cutoff' are collapsed into polytomies.
If you enter an option... | toytree/Multitree.py | def get_consensus_tree(self, cutoff=0.0, best_tree=None):
"""
Returns an extended majority rule consensus tree as a Toytree object.
Node labels include 'support' values showing the occurrence of clades
in the consensus tree across trees in the input treelist.
Clades with suppor... | def get_consensus_tree(self, cutoff=0.0, best_tree=None):
"""
Returns an extended majority rule consensus tree as a Toytree object.
Node labels include 'support' values showing the occurrence of clades
in the consensus tree across trees in the input treelist.
Clades with suppor... | [
"Returns",
"an",
"extended",
"majority",
"rule",
"consensus",
"tree",
"as",
"a",
"Toytree",
"object",
".",
"Node",
"labels",
"include",
"support",
"values",
"showing",
"the",
"occurrence",
"of",
"clades",
"in",
"the",
"consensus",
"tree",
"across",
"trees",
"i... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L172-L196 | [
"def",
"get_consensus_tree",
"(",
"self",
",",
"cutoff",
"=",
"0.0",
",",
"best_tree",
"=",
"None",
")",
":",
"if",
"best_tree",
":",
"raise",
"NotImplementedError",
"(",
"\"best_tree option not yet supported.\"",
")",
"cons",
"=",
"ConsensusTree",
"(",
"self",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | MultiTree.draw_tree_grid | Draw a slice of x*y trees into a x,y grid non-overlapping.
Parameters:
-----------
x (int):
Number of grid cells in x dimension. Default=automatically set.
y (int):
Number of grid cells in y dimension. Default=automatically set.
start (int):
... | toytree/Multitree.py | def draw_tree_grid(self,
nrows=None,
ncols=None,
start=0,
fixed_order=False,
shared_axis=False,
**kwargs):
"""
Draw a slice of x*y trees into a x,y grid non-overlapping.
Parameters:
-----------
x (int):
N... | def draw_tree_grid(self,
nrows=None,
ncols=None,
start=0,
fixed_order=False,
shared_axis=False,
**kwargs):
"""
Draw a slice of x*y trees into a x,y grid non-overlapping.
Parameters:
-----------
x (int):
N... | [
"Draw",
"a",
"slice",
"of",
"x",
"*",
"y",
"trees",
"into",
"a",
"x",
"y",
"grid",
"non",
"-",
"overlapping",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L201-L280 | [
"def",
"draw_tree_grid",
"(",
"self",
",",
"nrows",
"=",
"None",
",",
"ncols",
"=",
"None",
",",
"start",
"=",
"0",
",",
"fixed_order",
"=",
"False",
",",
"shared_axis",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# return nothing if tree is empty",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | MultiTree.draw_cloud_tree | Draw a series of trees overlapping each other in coordinate space.
The order of tip_labels is fixed in cloud trees so that trees with
discordant relationships can be seen in conflict. To change the tip
order use the 'fixed_order' argument in toytree.mtree() when creating
the MultiTree o... | toytree/Multitree.py | def draw_cloud_tree(self,
axes=None,
html=False,
fixed_order=True,
**kwargs):
"""
Draw a series of trees overlapping each other in coordinate space.
The order of tip_labels is fixed in cloud trees so that trees with
discordant relationships can be seen ... | def draw_cloud_tree(self,
axes=None,
html=False,
fixed_order=True,
**kwargs):
"""
Draw a series of trees overlapping each other in coordinate space.
The order of tip_labels is fixed in cloud trees so that trees with
discordant relationships can be seen ... | [
"Draw",
"a",
"series",
"of",
"trees",
"overlapping",
"each",
"other",
"in",
"coordinate",
"space",
".",
"The",
"order",
"of",
"tip_labels",
"is",
"fixed",
"in",
"cloud",
"trees",
"so",
"that",
"trees",
"with",
"discordant",
"relationships",
"can",
"be",
"see... | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L283-L363 | [
"def",
"draw_cloud_tree",
"(",
"self",
",",
"axes",
"=",
"None",
",",
"html",
"=",
"False",
",",
"fixed_order",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# return nothing if tree is empty",
"if",
"not",
"self",
".",
"treelist",
":",
"print",
"(",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | ConsensusTree.hash_trees | hash ladderized tree topologies | toytree/Multitree.py | def hash_trees(self):
"hash ladderized tree topologies"
observed = {}
for idx, tree in enumerate(self.treelist):
nwk = tree.write(tree_format=9)
hashed = md5(nwk.encode("utf-8")).hexdigest()
if hashed not in observed:
observed[hashed] = ... | def hash_trees(self):
"hash ladderized tree topologies"
observed = {}
for idx, tree in enumerate(self.treelist):
nwk = tree.write(tree_format=9)
hashed = md5(nwk.encode("utf-8")).hexdigest()
if hashed not in observed:
observed[hashed] = ... | [
"hash",
"ladderized",
"tree",
"topologies"
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L407-L418 | [
"def",
"hash_trees",
"(",
"self",
")",
":",
"observed",
"=",
"{",
"}",
"for",
"idx",
",",
"tree",
"in",
"enumerate",
"(",
"self",
".",
"treelist",
")",
":",
"nwk",
"=",
"tree",
".",
"write",
"(",
"tree_format",
"=",
"9",
")",
"hashed",
"=",
"md5",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | ConsensusTree.find_clades | Count clade occurrences. | toytree/Multitree.py | def find_clades(self):
"Count clade occurrences."
# index names from the first tree
ndict = {j: i for i, j in enumerate(self.names)}
namedict = {i: j for i, j in enumerate(self.names)}
# store counts
clade_counts = {}
for tidx, ncopies in self.treedict.items():
... | def find_clades(self):
"Count clade occurrences."
# index names from the first tree
ndict = {j: i for i, j in enumerate(self.names)}
namedict = {i: j for i, j in enumerate(self.names)}
# store counts
clade_counts = {}
for tidx, ncopies in self.treedict.items():
... | [
"Count",
"clade",
"occurrences",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L421-L462 | [
"def",
"find_clades",
"(",
"self",
")",
":",
"# index names from the first tree",
"ndict",
"=",
"{",
"j",
":",
"i",
"for",
"i",
",",
"j",
"in",
"enumerate",
"(",
"self",
".",
"names",
")",
"}",
"namedict",
"=",
"{",
"i",
":",
"j",
"for",
"i",
",",
... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | ConsensusTree.filter_clades | Remove conflicting clades and those < cutoff to get majority rule | toytree/Multitree.py | def filter_clades(self):
"Remove conflicting clades and those < cutoff to get majority rule"
passed = []
carrs = np.array([list(i[0]) for i in self.clade_counts], dtype=int)
freqs = np.array([i[1] for i in self.clade_counts])
for idx in range(carrs.shape[0]):
conflic... | def filter_clades(self):
"Remove conflicting clades and those < cutoff to get majority rule"
passed = []
carrs = np.array([list(i[0]) for i in self.clade_counts], dtype=int)
freqs = np.array([i[1] for i in self.clade_counts])
for idx in range(carrs.shape[0]):
conflic... | [
"Remove",
"conflicting",
"clades",
"and",
"those",
"<",
"cutoff",
"to",
"get",
"majority",
"rule"
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L465-L492 | [
"def",
"filter_clades",
"(",
"self",
")",
":",
"passed",
"=",
"[",
"]",
"carrs",
"=",
"np",
".",
"array",
"(",
"[",
"list",
"(",
"i",
"[",
"0",
"]",
")",
"for",
"i",
"in",
"self",
".",
"clade_counts",
"]",
",",
"dtype",
"=",
"int",
")",
"freqs"... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | ConsensusTree.build_trees | Build an unrooted consensus tree from filtered clade counts. | toytree/Multitree.py | def build_trees(self):
"Build an unrooted consensus tree from filtered clade counts."
# storage
nodes = {}
idxarr = np.arange(len(self.fclade_counts[0][0]))
queue = []
## create dict of clade counts and set keys
countdict = defaultdict(int)
for clade, co... | def build_trees(self):
"Build an unrooted consensus tree from filtered clade counts."
# storage
nodes = {}
idxarr = np.arange(len(self.fclade_counts[0][0]))
queue = []
## create dict of clade counts and set keys
countdict = defaultdict(int)
for clade, co... | [
"Build",
"an",
"unrooted",
"consensus",
"tree",
"from",
"filtered",
"clade",
"counts",
"."
] | eaton-lab/toytree | python | https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L495-L557 | [
"def",
"build_trees",
"(",
"self",
")",
":",
"# storage",
"nodes",
"=",
"{",
"}",
"idxarr",
"=",
"np",
".",
"arange",
"(",
"len",
"(",
"self",
".",
"fclade_counts",
"[",
"0",
"]",
"[",
"0",
"]",
")",
")",
"queue",
"=",
"[",
"]",
"## create dict of ... | 0347ed2098acc5f707fadf52a0ecd411a6d1859c |
train | PhoneticAlgorithm.sounds_like | Compare the phonetic representations of 2 words, and return a boolean value. | pyphonetics/phonetics/phonetic_algorithm.py | def sounds_like(self, word1, word2):
"""Compare the phonetic representations of 2 words, and return a boolean value."""
return self.phonetics(word1) == self.phonetics(word2) | def sounds_like(self, word1, word2):
"""Compare the phonetic representations of 2 words, and return a boolean value."""
return self.phonetics(word1) == self.phonetics(word2) | [
"Compare",
"the",
"phonetic",
"representations",
"of",
"2",
"words",
"and",
"return",
"a",
"boolean",
"value",
"."
] | Lilykos/pyphonetics | python | https://github.com/Lilykos/pyphonetics/blob/7f55cccc1135e6015520a895eb6859318a4b6111/pyphonetics/phonetics/phonetic_algorithm.py#L20-L22 | [
"def",
"sounds_like",
"(",
"self",
",",
"word1",
",",
"word2",
")",
":",
"return",
"self",
".",
"phonetics",
"(",
"word1",
")",
"==",
"self",
".",
"phonetics",
"(",
"word2",
")"
] | 7f55cccc1135e6015520a895eb6859318a4b6111 |
train | PhoneticAlgorithm.distance | Get the similarity of the words, using the supported distance metrics. | pyphonetics/phonetics/phonetic_algorithm.py | def distance(self, word1, word2, metric='levenshtein'):
"""Get the similarity of the words, using the supported distance metrics."""
if metric in self.distances:
distance_func = self.distances[metric]
return distance_func(self.phonetics(word1), self.phonetics(word2))
else... | def distance(self, word1, word2, metric='levenshtein'):
"""Get the similarity of the words, using the supported distance metrics."""
if metric in self.distances:
distance_func = self.distances[metric]
return distance_func(self.phonetics(word1), self.phonetics(word2))
else... | [
"Get",
"the",
"similarity",
"of",
"the",
"words",
"using",
"the",
"supported",
"distance",
"metrics",
"."
] | Lilykos/pyphonetics | python | https://github.com/Lilykos/pyphonetics/blob/7f55cccc1135e6015520a895eb6859318a4b6111/pyphonetics/phonetics/phonetic_algorithm.py#L24-L30 | [
"def",
"distance",
"(",
"self",
",",
"word1",
",",
"word2",
",",
"metric",
"=",
"'levenshtein'",
")",
":",
"if",
"metric",
"in",
"self",
".",
"distances",
":",
"distance_func",
"=",
"self",
".",
"distances",
"[",
"metric",
"]",
"return",
"distance_func",
... | 7f55cccc1135e6015520a895eb6859318a4b6111 |
train | get_output_row_heights | Get the heights of the rows of the output table.
Parameters
----------
table : list of lists of str
spans : list of lists of int
Returns
-------
heights : list of int
The heights of each row in the output table | dashtable/data2rst/get_output_row_heights.py | def get_output_row_heights(table, spans):
"""
Get the heights of the rows of the output table.
Parameters
----------
table : list of lists of str
spans : list of lists of int
Returns
-------
heights : list of int
The heights of each row in the output table
"""
heigh... | def get_output_row_heights(table, spans):
"""
Get the heights of the rows of the output table.
Parameters
----------
table : list of lists of str
spans : list of lists of int
Returns
-------
heights : list of int
The heights of each row in the output table
"""
heigh... | [
"Get",
"the",
"heights",
"of",
"the",
"rows",
"of",
"the",
"output",
"table",
"."
] | doakey3/DashTable | python | https://github.com/doakey3/DashTable/blob/744cfb6a717fa75a8092c83ebcd49b2668023681/dashtable/data2rst/get_output_row_heights.py#L5-L53 | [
"def",
"get_output_row_heights",
"(",
"table",
",",
"spans",
")",
":",
"heights",
"=",
"[",
"]",
"for",
"row",
"in",
"table",
":",
"heights",
".",
"append",
"(",
"-",
"1",
")",
"for",
"row",
"in",
"range",
"(",
"len",
"(",
"table",
")",
")",
":",
... | 744cfb6a717fa75a8092c83ebcd49b2668023681 |
train | smedian | Generalised media for odd and even number of samples | dynts/lib/fallback/operators.py | def smedian(olist,nobs):
'''Generalised media for odd and even number of samples'''
if nobs:
rem = nobs % 2
midpoint = nobs // 2
me = olist[midpoint]
if not rem:
me = 0.5 * (me + olist[midpoint-1])
return me
else:
return NaN | def smedian(olist,nobs):
'''Generalised media for odd and even number of samples'''
if nobs:
rem = nobs % 2
midpoint = nobs // 2
me = olist[midpoint]
if not rem:
me = 0.5 * (me + olist[midpoint-1])
return me
else:
return NaN | [
"Generalised",
"media",
"for",
"odd",
"and",
"even",
"number",
"of",
"samples"
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/lib/fallback/operators.py#L41-L51 | [
"def",
"smedian",
"(",
"olist",
",",
"nobs",
")",
":",
"if",
"nobs",
":",
"rem",
"=",
"nobs",
"%",
"2",
"midpoint",
"=",
"nobs",
"//",
"2",
"me",
"=",
"olist",
"[",
"midpoint",
"]",
"if",
"not",
"rem",
":",
"me",
"=",
"0.5",
"*",
"(",
"me",
"... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | roll_mean | Apply a rolling mean function to an array.
This is a simple rolling aggregation. | dynts/lib/fallback/operators.py | def roll_mean(input, window):
'''Apply a rolling mean function to an array.
This is a simple rolling aggregation.'''
nobs, i, j, sum_x = 0,0,0,0.
N = len(input)
if window > N:
raise ValueError('Out of bound')
output = np.ndarray(N-window+1,dtype=input.dtype)
for val in inpu... | def roll_mean(input, window):
'''Apply a rolling mean function to an array.
This is a simple rolling aggregation.'''
nobs, i, j, sum_x = 0,0,0,0.
N = len(input)
if window > N:
raise ValueError('Out of bound')
output = np.ndarray(N-window+1,dtype=input.dtype)
for val in inpu... | [
"Apply",
"a",
"rolling",
"mean",
"function",
"to",
"an",
"array",
".",
"This",
"is",
"a",
"simple",
"rolling",
"aggregation",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/lib/fallback/operators.py#L76-L107 | [
"def",
"roll_mean",
"(",
"input",
",",
"window",
")",
":",
"nobs",
",",
"i",
",",
"j",
",",
"sum_x",
"=",
"0",
",",
"0",
",",
"0",
",",
"0.",
"N",
"=",
"len",
"(",
"input",
")",
"if",
"window",
">",
"N",
":",
"raise",
"ValueError",
"(",
"'Out... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
train | roll_sd | Apply a rolling standard deviation function
to an array. This is a simple rolling aggregation of squared
sums. | dynts/lib/fallback/operators.py | def roll_sd(input, window, scale = 1.0, ddof = 0):
'''Apply a rolling standard deviation function
to an array. This is a simple rolling aggregation of squared
sums.'''
nobs, i, j, sx, sxx = 0,0,0,0.,0.
N = len(input)
sqrt = np.sqrt
if window > N:
raise ValueError('Out of bound')
... | def roll_sd(input, window, scale = 1.0, ddof = 0):
'''Apply a rolling standard deviation function
to an array. This is a simple rolling aggregation of squared
sums.'''
nobs, i, j, sx, sxx = 0,0,0,0.,0.
N = len(input)
sqrt = np.sqrt
if window > N:
raise ValueError('Out of bound')
... | [
"Apply",
"a",
"rolling",
"standard",
"deviation",
"function",
"to",
"an",
"array",
".",
"This",
"is",
"a",
"simple",
"rolling",
"aggregation",
"of",
"squared",
"sums",
"."
] | quantmind/dynts | python | https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/lib/fallback/operators.py#L110-L148 | [
"def",
"roll_sd",
"(",
"input",
",",
"window",
",",
"scale",
"=",
"1.0",
",",
"ddof",
"=",
"0",
")",
":",
"nobs",
",",
"i",
",",
"j",
",",
"sx",
",",
"sxx",
"=",
"0",
",",
"0",
",",
"0",
",",
"0.",
",",
"0.",
"N",
"=",
"len",
"(",
"input"... | 21ac57c648bfec402fa6b1fe569496cf098fb5e8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.