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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | NaturalNamingInterface._set_details_tree_node | Renames a given `instance` based on `parent_node` and `name`.
Adds meta information like depth as well. | pypet/naturalnaming.py | def _set_details_tree_node(self, parent_node, name, instance):
"""Renames a given `instance` based on `parent_node` and `name`.
Adds meta information like depth as well.
"""
depth = parent_node._depth + 1
if parent_node.v_is_root:
branch = name # We add below root
... | def _set_details_tree_node(self, parent_node, name, instance):
"""Renames a given `instance` based on `parent_node` and `name`.
Adds meta information like depth as well.
"""
depth = parent_node._depth + 1
if parent_node.v_is_root:
branch = name # We add below root
... | [
"Renames",
"a",
"given",
"instance",
"based",
"on",
"parent_node",
"and",
"name",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1652-L1668 | [
"def",
"_set_details_tree_node",
"(",
"self",
",",
"parent_node",
",",
"name",
",",
"instance",
")",
":",
"depth",
"=",
"parent_node",
".",
"_depth",
"+",
"1",
"if",
"parent_node",
".",
"v_is_root",
":",
"branch",
"=",
"name",
"# We add below root",
"else",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._iter_nodes | Returns an iterator over nodes hanging below a given start node.
:param node:
Start node
:param recursive:
Whether recursively also iterate over the children of the start node's children
:param max_depth:
Maximum depth to search for
:param in_se... | pypet/naturalnaming.py | def _iter_nodes(self, node, recursive=False, max_depth=float('inf'),
with_links=True, in_search=False, predicate=None):
"""Returns an iterator over nodes hanging below a given start node.
:param node:
Start node
:param recursive:
Whether recursivel... | def _iter_nodes(self, node, recursive=False, max_depth=float('inf'),
with_links=True, in_search=False, predicate=None):
"""Returns an iterator over nodes hanging below a given start node.
:param node:
Start node
:param recursive:
Whether recursivel... | [
"Returns",
"an",
"iterator",
"over",
"nodes",
"hanging",
"below",
"a",
"given",
"start",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1678-L1742 | [
"def",
"_iter_nodes",
"(",
"self",
",",
"node",
",",
"recursive",
"=",
"False",
",",
"max_depth",
"=",
"float",
"(",
"'inf'",
")",
",",
"with_links",
"=",
"True",
",",
"in_search",
"=",
"False",
",",
"predicate",
"=",
"None",
")",
":",
"def",
"_run_pre... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._to_dict | Returns a dictionary with pairings of (full) names as keys and instances as values.
:param fast_access:
If true parameter or result values are returned instead of the
instances.
:param short_names:
If true keys are not full names but only the names.
Ra... | pypet/naturalnaming.py | def _to_dict(self, node, fast_access=True, short_names=False, nested=False,
copy=True, with_links=True):
""" Returns a dictionary with pairings of (full) names as keys and instances as values.
:param fast_access:
If true parameter or result values are returned instead of t... | def _to_dict(self, node, fast_access=True, short_names=False, nested=False,
copy=True, with_links=True):
""" Returns a dictionary with pairings of (full) names as keys and instances as values.
:param fast_access:
If true parameter or result values are returned instead of t... | [
"Returns",
"a",
"dictionary",
"with",
"pairings",
"of",
"(",
"full",
")",
"names",
"as",
"keys",
"and",
"instances",
"as",
"values",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1744-L1821 | [
"def",
"_to_dict",
"(",
"self",
",",
"node",
",",
"fast_access",
"=",
"True",
",",
"short_names",
"=",
"False",
",",
"nested",
"=",
"False",
",",
"copy",
"=",
"True",
",",
"with_links",
"=",
"True",
")",
":",
"if",
"(",
"fast_access",
"or",
"short_name... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._make_child_iterator | Returns an iterator over a node's children.
In case of using a trajectory as a run (setting 'v_crun') some sub branches
that do not belong to the run are blinded out. | pypet/naturalnaming.py | def _make_child_iterator(node, with_links, current_depth=0):
"""Returns an iterator over a node's children.
In case of using a trajectory as a run (setting 'v_crun') some sub branches
that do not belong to the run are blinded out.
"""
cdp1 = current_depth + 1
if with_li... | def _make_child_iterator(node, with_links, current_depth=0):
"""Returns an iterator over a node's children.
In case of using a trajectory as a run (setting 'v_crun') some sub branches
that do not belong to the run are blinded out.
"""
cdp1 = current_depth + 1
if with_li... | [
"Returns",
"an",
"iterator",
"over",
"a",
"node",
"s",
"children",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1824-L1838 | [
"def",
"_make_child_iterator",
"(",
"node",
",",
"with_links",
",",
"current_depth",
"=",
"0",
")",
":",
"cdp1",
"=",
"current_depth",
"+",
"1",
"if",
"with_links",
":",
"iterator",
"=",
"(",
"(",
"cdp1",
",",
"x",
"[",
"0",
"]",
",",
"x",
"[",
"1",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._recursive_traversal_bfs | Iterator function traversing the tree below `node` in breadth first search manner.
If `run_name` is given only sub branches of this run are considered and the rest is
blinded out. | pypet/naturalnaming.py | def _recursive_traversal_bfs(node, linked_by=None,
max_depth=float('inf'),
with_links=True, in_search=False, predicate=None):
"""Iterator function traversing the tree below `node` in breadth first search manner.
If `run_name` is given on... | def _recursive_traversal_bfs(node, linked_by=None,
max_depth=float('inf'),
with_links=True, in_search=False, predicate=None):
"""Iterator function traversing the tree below `node` in breadth first search manner.
If `run_name` is given on... | [
"Iterator",
"function",
"traversing",
"the",
"tree",
"below",
"node",
"in",
"breadth",
"first",
"search",
"manner",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1841-L1888 | [
"def",
"_recursive_traversal_bfs",
"(",
"node",
",",
"linked_by",
"=",
"None",
",",
"max_depth",
"=",
"float",
"(",
"'inf'",
")",
",",
"with_links",
"=",
"True",
",",
"in_search",
"=",
"False",
",",
"predicate",
"=",
"None",
")",
":",
"if",
"predicate",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._very_fast_search | Fast search for a node in the tree.
The tree is not traversed but the reference dictionaries are searched.
:param node:
Parent node to start from
:param key:
Name of node to find
:param max_depth:
Maximum depth.
:param with_links:
... | pypet/naturalnaming.py | def _very_fast_search(self, node, key, max_depth, with_links, crun):
"""Fast search for a node in the tree.
The tree is not traversed but the reference dictionaries are searched.
:param node:
Parent node to start from
:param key:
Name of node to find
... | def _very_fast_search(self, node, key, max_depth, with_links, crun):
"""Fast search for a node in the tree.
The tree is not traversed but the reference dictionaries are searched.
:param node:
Parent node to start from
:param key:
Name of node to find
... | [
"Fast",
"search",
"for",
"a",
"node",
"in",
"the",
"tree",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1914-L1987 | [
"def",
"_very_fast_search",
"(",
"self",
",",
"node",
",",
"key",
",",
"max_depth",
",",
"with_links",
",",
"crun",
")",
":",
"if",
"key",
"in",
"self",
".",
"_links_count",
":",
"return",
"parent_full_name",
"=",
"node",
".",
"v_full_name",
"starting_depth"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._search | Searches for an item in the tree below `node`
:param node:
The parent node below which the search is performed
:param key:
Name to search for. Can be the short name, the full name or parts of it
:param max_depth:
maximum search depth.
:param wit... | pypet/naturalnaming.py | def _search(self, node, key, max_depth=float('inf'), with_links=True, crun=None):
""" Searches for an item in the tree below `node`
:param node:
The parent node below which the search is performed
:param key:
Name to search for. Can be the short name, the full name or... | def _search(self, node, key, max_depth=float('inf'), with_links=True, crun=None):
""" Searches for an item in the tree below `node`
:param node:
The parent node below which the search is performed
:param key:
Name to search for. Can be the short name, the full name or... | [
"Searches",
"for",
"an",
"item",
"in",
"the",
"tree",
"below",
"node"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1989-L2057 | [
"def",
"_search",
"(",
"self",
",",
"node",
",",
"key",
",",
"max_depth",
"=",
"float",
"(",
"'inf'",
")",
",",
"with_links",
"=",
"True",
",",
"crun",
"=",
"None",
")",
":",
"# If we find it directly there is no need for an exhaustive search",
"if",
"key",
"i... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._backwards_search | Performs a backwards search from the terminal node back to the start node
:param start_node:
The node from where search starts, or here better way where backwards search should
end.
:param split_name:
List of names
:param max_depth:
Maximum s... | pypet/naturalnaming.py | def _backwards_search(self, start_node, split_name, max_depth=float('inf'), shortcuts=True):
""" Performs a backwards search from the terminal node back to the start node
:param start_node:
The node from where search starts, or here better way where backwards search should
end.... | def _backwards_search(self, start_node, split_name, max_depth=float('inf'), shortcuts=True):
""" Performs a backwards search from the terminal node back to the start node
:param start_node:
The node from where search starts, or here better way where backwards search should
end.... | [
"Performs",
"a",
"backwards",
"search",
"from",
"the",
"terminal",
"node",
"back",
"to",
"the",
"start",
"node"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2059-L2138 | [
"def",
"_backwards_search",
"(",
"self",
",",
"start_node",
",",
"split_name",
",",
"max_depth",
"=",
"float",
"(",
"'inf'",
")",
",",
"shortcuts",
"=",
"True",
")",
":",
"result_list",
"=",
"[",
"]",
"# Result list of all found items",
"full_name_set",
"=",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._get_all | Searches for all occurrences of `name` under `node`.
:param node:
Start node
:param name:
Name what to look for can be longer and separated by colons, i.e.
`mygroupA.mygroupB.myparam`.
:param max_depth:
Maximum depth to search for relative to... | pypet/naturalnaming.py | def _get_all(self, node, name, max_depth, shortcuts):
""" Searches for all occurrences of `name` under `node`.
:param node:
Start node
:param name:
Name what to look for can be longer and separated by colons, i.e.
`mygroupA.mygroupB.myparam`.
:par... | def _get_all(self, node, name, max_depth, shortcuts):
""" Searches for all occurrences of `name` under `node`.
:param node:
Start node
:param name:
Name what to look for can be longer and separated by colons, i.e.
`mygroupA.mygroupB.myparam`.
:par... | [
"Searches",
"for",
"all",
"occurrences",
"of",
"name",
"under",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2140-L2183 | [
"def",
"_get_all",
"(",
"self",
",",
"node",
",",
"name",
",",
"max_depth",
",",
"shortcuts",
")",
":",
"if",
"max_depth",
"is",
"None",
":",
"max_depth",
"=",
"float",
"(",
"'inf'",
")",
"if",
"isinstance",
"(",
"name",
",",
"list",
")",
":",
"split... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._get | Searches for an item (parameter/result/group node) with the given `name`.
:param node: The node below which the search is performed
:param name: Name of the item (full name or parts of the full name)
:param fast_access: If the result is a parameter, whether fast access should be applied.
... | pypet/naturalnaming.py | def _get(self, node, name, fast_access,
shortcuts, max_depth, auto_load, with_links):
"""Searches for an item (parameter/result/group node) with the given `name`.
:param node: The node below which the search is performed
:param name: Name of the item (full name or parts of the ful... | def _get(self, node, name, fast_access,
shortcuts, max_depth, auto_load, with_links):
"""Searches for an item (parameter/result/group node) with the given `name`.
:param node: The node below which the search is performed
:param name: Name of the item (full name or parts of the ful... | [
"Searches",
"for",
"an",
"item",
"(",
"parameter",
"/",
"result",
"/",
"group",
"node",
")",
"with",
"the",
"given",
"name",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2205-L2335 | [
"def",
"_get",
"(",
"self",
",",
"node",
",",
"name",
",",
"fast_access",
",",
"shortcuts",
",",
"max_depth",
",",
"auto_load",
",",
"with_links",
")",
":",
"if",
"auto_load",
"and",
"not",
"with_links",
":",
"raise",
"ValueError",
"(",
"'If you allow auto-l... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NaturalNamingInterface._perform_get | Searches for an item (parameter/result/group node) with the given `name`.
:param node: The node below which the search is performed
:param split_name: Name split into list according to '.'
:param fast_access: If the result is a parameter, whether fast access should be applied.
:param... | pypet/naturalnaming.py | def _perform_get(self, node, split_name, fast_access,
shortcuts, max_depth, auto_load, with_links,
try_auto_load_directly):
"""Searches for an item (parameter/result/group node) with the given `name`.
:param node: The node below which the search is performed
... | def _perform_get(self, node, split_name, fast_access,
shortcuts, max_depth, auto_load, with_links,
try_auto_load_directly):
"""Searches for an item (parameter/result/group node) with the given `name`.
:param node: The node below which the search is performed
... | [
"Searches",
"for",
"an",
"item",
"(",
"parameter",
"/",
"result",
"/",
"group",
"node",
")",
"with",
"the",
"given",
"name",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2337-L2453 | [
"def",
"_perform_get",
"(",
"self",
",",
"node",
",",
"split_name",
",",
"fast_access",
",",
"shortcuts",
",",
"max_depth",
",",
"auto_load",
",",
"with_links",
",",
"try_auto_load_directly",
")",
":",
"result",
"=",
"None",
"name",
"=",
"'.'",
".",
"join",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.kids | Alternative naming, you can use `node.kids.name` instead of `node.name`
for easier tab completion. | pypet/naturalnaming.py | def kids(self):
"""Alternative naming, you can use `node.kids.name` instead of `node.name`
for easier tab completion."""
if self._kids is None:
self._kids = NNTreeNodeKids(self)
return self._kids | def kids(self):
"""Alternative naming, you can use `node.kids.name` instead of `node.name`
for easier tab completion."""
if self._kids is None:
self._kids = NNTreeNodeKids(self)
return self._kids | [
"Alternative",
"naming",
"you",
"can",
"use",
"node",
".",
"kids",
".",
"name",
"instead",
"of",
"node",
".",
"name",
"for",
"easier",
"tab",
"completion",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2503-L2508 | [
"def",
"kids",
"(",
"self",
")",
":",
"if",
"self",
".",
"_kids",
"is",
"None",
":",
"self",
".",
"_kids",
"=",
"NNTreeNodeKids",
"(",
"self",
")",
"return",
"self",
".",
"_kids"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode._add_group_from_storage | Can be called from storage service to create a new group to bypass name checking | pypet/naturalnaming.py | def _add_group_from_storage(self, args, kwargs):
"""Can be called from storage service to create a new group to bypass name checking"""
return self._nn_interface._add_generic(self,
type_name=GROUP,
group_type... | def _add_group_from_storage(self, args, kwargs):
"""Can be called from storage service to create a new group to bypass name checking"""
return self._nn_interface._add_generic(self,
type_name=GROUP,
group_type... | [
"Can",
"be",
"called",
"from",
"storage",
"service",
"to",
"create",
"a",
"new",
"group",
"to",
"bypass",
"name",
"checking"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2546-L2554 | [
"def",
"_add_group_from_storage",
"(",
"self",
",",
"args",
",",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"GROUP",
",",
"group_type_name",
"=",
"GROUP",
",",
"args",
"=",
"args",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode._add_leaf_from_storage | Can be called from storage service to create a new leaf to bypass name checking | pypet/naturalnaming.py | def _add_leaf_from_storage(self, args, kwargs):
"""Can be called from storage service to create a new leaf to bypass name checking"""
return self._nn_interface._add_generic(self,
type_name=LEAF,
group_type_na... | def _add_leaf_from_storage(self, args, kwargs):
"""Can be called from storage service to create a new leaf to bypass name checking"""
return self._nn_interface._add_generic(self,
type_name=LEAF,
group_type_na... | [
"Can",
"be",
"called",
"from",
"storage",
"service",
"to",
"create",
"a",
"new",
"leaf",
"to",
"bypass",
"name",
"checking"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2556-L2563 | [
"def",
"_add_leaf_from_storage",
"(",
"self",
",",
"args",
",",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"LEAF",
",",
"group_type_name",
"=",
"GROUP",
",",
"args",
"=",
"args",
","... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_dir_data | Returns a list of all children names | pypet/naturalnaming.py | def f_dir_data(self):
"""Returns a list of all children names"""
if (self._nn_interface is not None and
self._nn_interface._root_instance is not None
and self.v_root.v_auto_load):
try:
if self.v_is_root:
self.f_l... | def f_dir_data(self):
"""Returns a list of all children names"""
if (self._nn_interface is not None and
self._nn_interface._root_instance is not None
and self.v_root.v_auto_load):
try:
if self.v_is_root:
self.f_l... | [
"Returns",
"a",
"list",
"of",
"all",
"children",
"names"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2565-L2580 | [
"def",
"f_dir_data",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_nn_interface",
"is",
"not",
"None",
"and",
"self",
".",
"_nn_interface",
".",
"_root_instance",
"is",
"not",
"None",
"and",
"self",
".",
"v_root",
".",
"v_auto_load",
")",
":",
"try",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode._debug | Creates a dummy object containing the whole tree to make unfolding easier.
This method is only useful for debugging purposes.
If you use an IDE and want to unfold the trajectory tree, you always need to
open the private attribute `_children`. Use to this function to create a new
object ... | pypet/naturalnaming.py | def _debug(self):
"""Creates a dummy object containing the whole tree to make unfolding easier.
This method is only useful for debugging purposes.
If you use an IDE and want to unfold the trajectory tree, you always need to
open the private attribute `_children`. Use to this function to... | def _debug(self):
"""Creates a dummy object containing the whole tree to make unfolding easier.
This method is only useful for debugging purposes.
If you use an IDE and want to unfold the trajectory tree, you always need to
open the private attribute `_children`. Use to this function to... | [
"Creates",
"a",
"dummy",
"object",
"containing",
"the",
"whole",
"tree",
"to",
"make",
"unfolding",
"easier",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2610-L2645 | [
"def",
"_debug",
"(",
"self",
")",
":",
"class",
"Bunch",
"(",
"object",
")",
":",
"\"\"\"Dummy container class\"\"\"",
"pass",
"debug_tree",
"=",
"Bunch",
"(",
")",
"if",
"not",
"self",
".",
"v_annotations",
".",
"f_is_empty",
"(",
")",
":",
"debug_tree",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_parent | Returns the parent of the node.
Raises a TypeError if current node is root. | pypet/naturalnaming.py | def f_get_parent(self):
"""Returns the parent of the node.
Raises a TypeError if current node is root.
"""
if self.v_is_root:
raise TypeError('Root does not have a parent')
elif self.v_location == '':
return self.v_root
else:
return s... | def f_get_parent(self):
"""Returns the parent of the node.
Raises a TypeError if current node is root.
"""
if self.v_is_root:
raise TypeError('Root does not have a parent')
elif self.v_location == '':
return self.v_root
else:
return s... | [
"Returns",
"the",
"parent",
"of",
"the",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2647-L2658 | [
"def",
"f_get_parent",
"(",
"self",
")",
":",
"if",
"self",
".",
"v_is_root",
":",
"raise",
"TypeError",
"(",
"'Root does not have a parent'",
")",
"elif",
"self",
".",
"v_location",
"==",
"''",
":",
"return",
"self",
".",
"v_root",
"else",
":",
"return",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_add_group | Adds an empty generic group under the current node.
You can add to a generic group anywhere you want. So you are free to build
your parameter tree with any structure. You do not necessarily have to follow the
four subtrees `config`, `parameters`, `derived_parameters`, `results`.
If you... | pypet/naturalnaming.py | def f_add_group(self, *args, **kwargs):
"""Adds an empty generic group under the current node.
You can add to a generic group anywhere you want. So you are free to build
your parameter tree with any structure. You do not necessarily have to follow the
four subtrees `config`, `parameters... | def f_add_group(self, *args, **kwargs):
"""Adds an empty generic group under the current node.
You can add to a generic group anywhere you want. So you are free to build
your parameter tree with any structure. You do not necessarily have to follow the
four subtrees `config`, `parameters... | [
"Adds",
"an",
"empty",
"generic",
"group",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2660-L2678 | [
"def",
"f_add_group",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"GROUP",
",",
"group_type_name",
"=",
"GROUP",
",",
"args",
"=",
"a... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_add_link | Adds a link to an existing node.
Can be called as ``node.f_add_link(other_node)`` this will add a link the `other_node`
with the link name as the name of the node.
Or can be called as ``node.f_add_link(name, other_node)`` to add a link to the
`other_node` and the given `name` of the li... | pypet/naturalnaming.py | def f_add_link(self, name_or_item, full_name_or_item=None):
"""Adds a link to an existing node.
Can be called as ``node.f_add_link(other_node)`` this will add a link the `other_node`
with the link name as the name of the node.
Or can be called as ``node.f_add_link(name, other_node)`` t... | def f_add_link(self, name_or_item, full_name_or_item=None):
"""Adds a link to an existing node.
Can be called as ``node.f_add_link(other_node)`` this will add a link the `other_node`
with the link name as the name of the node.
Or can be called as ``node.f_add_link(name, other_node)`` t... | [
"Adds",
"a",
"link",
"to",
"an",
"existing",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2680-L2707 | [
"def",
"f_add_link",
"(",
"self",
",",
"name_or_item",
",",
"full_name_or_item",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"name_or_item",
",",
"str",
")",
":",
"name",
"=",
"name_or_item",
"if",
"isinstance",
"(",
"full_name_or_item",
",",
"str",
")",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_remove_link | Removes a link from from the current group node with a given name.
Does not delete the link from the hard drive. If you want to do this,
checkout :func:`~pypet.trajectory.Trajectory.f_delete_links` | pypet/naturalnaming.py | def f_remove_link(self, name):
""" Removes a link from from the current group node with a given name.
Does not delete the link from the hard drive. If you want to do this,
checkout :func:`~pypet.trajectory.Trajectory.f_delete_links`
"""
if name not in self._links:
r... | def f_remove_link(self, name):
""" Removes a link from from the current group node with a given name.
Does not delete the link from the hard drive. If you want to do this,
checkout :func:`~pypet.trajectory.Trajectory.f_delete_links`
"""
if name not in self._links:
r... | [
"Removes",
"a",
"link",
"from",
"from",
"the",
"current",
"group",
"node",
"with",
"a",
"given",
"name",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2709-L2719 | [
"def",
"f_remove_link",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"_links",
":",
"raise",
"ValueError",
"(",
"'No link with name `%s` found under `%s`.'",
"%",
"(",
"name",
",",
"self",
".",
"_full_name",
")",
")",
"self",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_add_leaf | Adds an empty generic leaf under the current node.
You can add to a generic leaves anywhere you want. So you are free to build
your trajectory tree with any structure. You do not necessarily have to follow the
four subtrees `config`, `parameters`, `derived_parameters`, `results`.
If yo... | pypet/naturalnaming.py | def f_add_leaf(self, *args, **kwargs):
"""Adds an empty generic leaf under the current node.
You can add to a generic leaves anywhere you want. So you are free to build
your trajectory tree with any structure. You do not necessarily have to follow the
four subtrees `config`, `parameters... | def f_add_leaf(self, *args, **kwargs):
"""Adds an empty generic leaf under the current node.
You can add to a generic leaves anywhere you want. So you are free to build
your trajectory tree with any structure. You do not necessarily have to follow the
four subtrees `config`, `parameters... | [
"Adds",
"an",
"empty",
"generic",
"leaf",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2721-L2740 | [
"def",
"f_add_leaf",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"LEAF",
",",
"group_type_name",
"=",
"GROUP",
",",
"args",
"=",
"arg... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_remove | Recursively removes the group and all it's children.
:param recursive:
If removal should be applied recursively. If not, node can only be removed
if it has no children.
:param predicate:
In case of recursive removal, you can selectively remove nodes in the tree.
... | pypet/naturalnaming.py | def f_remove(self, recursive=True, predicate=None):
"""Recursively removes the group and all it's children.
:param recursive:
If removal should be applied recursively. If not, node can only be removed
if it has no children.
:param predicate:
In case of rec... | def f_remove(self, recursive=True, predicate=None):
"""Recursively removes the group and all it's children.
:param recursive:
If removal should be applied recursively. If not, node can only be removed
if it has no children.
:param predicate:
In case of rec... | [
"Recursively",
"removes",
"the",
"group",
"and",
"all",
"it",
"s",
"children",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2786-L2802 | [
"def",
"f_remove",
"(",
"self",
",",
"recursive",
"=",
"True",
",",
"predicate",
"=",
"None",
")",
":",
"parent",
"=",
"self",
".",
"f_get_parent",
"(",
")",
"parent",
".",
"f_remove_child",
"(",
"self",
".",
"v_name",
",",
"recursive",
"=",
"recursive",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_remove_child | Removes a child of the group.
Note that groups and leaves are only removed from the current trajectory in RAM.
If the trajectory is stored to disk, this data is not affected. Thus, removing children
can be only be used to free RAM memory!
If you want to free memory on disk via your sto... | pypet/naturalnaming.py | def f_remove_child(self, name, recursive=False, predicate=None):
"""Removes a child of the group.
Note that groups and leaves are only removed from the current trajectory in RAM.
If the trajectory is stored to disk, this data is not affected. Thus, removing children
can be only be used ... | def f_remove_child(self, name, recursive=False, predicate=None):
"""Removes a child of the group.
Note that groups and leaves are only removed from the current trajectory in RAM.
If the trajectory is stored to disk, this data is not affected. Thus, removing children
can be only be used ... | [
"Removes",
"a",
"child",
"of",
"the",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2804-L2848 | [
"def",
"f_remove_child",
"(",
"self",
",",
"name",
",",
"recursive",
"=",
"False",
",",
"predicate",
"=",
"None",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"_children",
":",
"raise",
"ValueError",
"(",
"'Your group `%s` does not contain the child `%s`.'"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_contains | Checks if the node contains a specific parameter or result.
It is checked if the item can be found via the
:func:`~pypet.naturalnaming.NNGroupNode.f_get` method.
:param item: Parameter/Result name or instance.
If a parameter or result instance is supplied it is also checked if
... | pypet/naturalnaming.py | def f_contains(self, item, with_links=True, shortcuts=False, max_depth=None):
"""Checks if the node contains a specific parameter or result.
It is checked if the item can be found via the
:func:`~pypet.naturalnaming.NNGroupNode.f_get` method.
:param item: Parameter/Result name or insta... | def f_contains(self, item, with_links=True, shortcuts=False, max_depth=None):
"""Checks if the node contains a specific parameter or result.
It is checked if the item can be found via the
:func:`~pypet.naturalnaming.NNGroupNode.f_get` method.
:param item: Parameter/Result name or insta... | [
"Checks",
"if",
"the",
"node",
"contains",
"a",
"specific",
"parameter",
"or",
"result",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L2851-L2917 | [
"def",
"f_contains",
"(",
"self",
",",
"item",
",",
"with_links",
"=",
"True",
",",
"shortcuts",
"=",
"False",
",",
"max_depth",
"=",
"None",
")",
":",
"# Check if an instance or a name was supplied by the user",
"try",
":",
"search_string",
"=",
"item",
".",
"v... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_iter_nodes | Iterates recursively (default) over nodes hanging below this group.
:param recursive: Whether to iterate the whole sub tree or only immediate children.
:param with_links: If links should be considered
:param max_depth: Maximum depth in search tree relative to start node (inclusive)
:... | pypet/naturalnaming.py | def f_iter_nodes(self, recursive=True, with_links=True, max_depth=None, predicate=None):
"""Iterates recursively (default) over nodes hanging below this group.
:param recursive: Whether to iterate the whole sub tree or only immediate children.
:param with_links: If links should be considered
... | def f_iter_nodes(self, recursive=True, with_links=True, max_depth=None, predicate=None):
"""Iterates recursively (default) over nodes hanging below this group.
:param recursive: Whether to iterate the whole sub tree or only immediate children.
:param with_links: If links should be considered
... | [
"Iterates",
"recursively",
"(",
"default",
")",
"over",
"nodes",
"hanging",
"below",
"this",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3002-L3040 | [
"def",
"f_iter_nodes",
"(",
"self",
",",
"recursive",
"=",
"True",
",",
"with_links",
"=",
"True",
",",
"max_depth",
"=",
"None",
",",
"predicate",
"=",
"None",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_iter_nodes",
"(",
"self",
",",
"recu... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_iter_leaves | Iterates (recursively) over all leaves hanging below the current group.
:param with_links:
If links should be ignored, leaves hanging below linked nodes are not listed.
:returns:
Iterator over all leaf nodes | pypet/naturalnaming.py | def f_iter_leaves(self, with_links=True):
"""Iterates (recursively) over all leaves hanging below the current group.
:param with_links:
If links should be ignored, leaves hanging below linked nodes are not listed.
:returns:
Iterator over all leaf nodes
"""
... | def f_iter_leaves(self, with_links=True):
"""Iterates (recursively) over all leaves hanging below the current group.
:param with_links:
If links should be ignored, leaves hanging below linked nodes are not listed.
:returns:
Iterator over all leaf nodes
"""
... | [
"Iterates",
"(",
"recursively",
")",
"over",
"all",
"leaves",
"hanging",
"below",
"the",
"current",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3042-L3056 | [
"def",
"f_iter_leaves",
"(",
"self",
",",
"with_links",
"=",
"True",
")",
":",
"for",
"node",
"in",
"self",
".",
"f_iter_nodes",
"(",
"with_links",
"=",
"with_links",
")",
":",
"if",
"node",
".",
"v_is_leaf",
":",
"yield",
"node"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_all | Searches for all occurrences of `name` under `node`.
Links are NOT considered since nodes are searched bottom up in the tree.
:param node:
Start node
:param name:
Name of what to look for, can be separated by colons, i.e.
``'mygroupA.mygroupB.myparam'``.
... | pypet/naturalnaming.py | def f_get_all(self, name, max_depth=None, shortcuts=True):
""" Searches for all occurrences of `name` under `node`.
Links are NOT considered since nodes are searched bottom up in the tree.
:param node:
Start node
:param name:
Name of what to look for, can be ... | def f_get_all(self, name, max_depth=None, shortcuts=True):
""" Searches for all occurrences of `name` under `node`.
Links are NOT considered since nodes are searched bottom up in the tree.
:param node:
Start node
:param name:
Name of what to look for, can be ... | [
"Searches",
"for",
"all",
"occurrences",
"of",
"name",
"under",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3058-L3089 | [
"def",
"f_get_all",
"(",
"self",
",",
"name",
",",
"max_depth",
"=",
"None",
",",
"shortcuts",
"=",
"True",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_get_all",
"(",
"self",
",",
"name",
",",
"max_depth",
"=",
"max_depth",
",",
"shortcuts",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_default | Similar to `f_get`, but returns the default value if `name` is not found in the
trajectory.
This function uses the `f_get` method and will return the default value
in case `f_get` raises an AttributeError or a DataNotInStorageError.
Other errors are not handled.
In contrast to ... | pypet/naturalnaming.py | def f_get_default(self, name, default=None, fast_access=True, with_links=True,
shortcuts=True, max_depth=None, auto_load=False):
""" Similar to `f_get`, but returns the default value if `name` is not found in the
trajectory.
This function uses the `f_get` method and will return th... | def f_get_default(self, name, default=None, fast_access=True, with_links=True,
shortcuts=True, max_depth=None, auto_load=False):
""" Similar to `f_get`, but returns the default value if `name` is not found in the
trajectory.
This function uses the `f_get` method and will return th... | [
"Similar",
"to",
"f_get",
"but",
"returns",
"the",
"default",
"value",
"if",
"name",
"is",
"not",
"found",
"in",
"the",
"trajectory",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3092-L3112 | [
"def",
"f_get_default",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
",",
"fast_access",
"=",
"True",
",",
"with_links",
"=",
"True",
",",
"shortcuts",
"=",
"True",
",",
"max_depth",
"=",
"None",
",",
"auto_load",
"=",
"False",
")",
":",
"try... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get | Searches and returns an item (parameter/result/group node) with the given `name`.
:param name: Name of the item (full name or parts of the full name)
:param fast_access: Whether fast access should be applied.
:param with_links:
If links are considered. Cannot be set to ``False`` ... | pypet/naturalnaming.py | def f_get(self, name, fast_access=False, with_links=True,
shortcuts=True, max_depth=None, auto_load=False):
"""Searches and returns an item (parameter/result/group node) with the given `name`.
:param name: Name of the item (full name or parts of the full name)
:param fast_access:... | def f_get(self, name, fast_access=False, with_links=True,
shortcuts=True, max_depth=None, auto_load=False):
"""Searches and returns an item (parameter/result/group node) with the given `name`.
:param name: Name of the item (full name or parts of the full name)
:param fast_access:... | [
"Searches",
"and",
"returns",
"an",
"item",
"(",
"parameter",
"/",
"result",
"/",
"group",
"node",
")",
"with",
"the",
"given",
"name",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3115-L3170 | [
"def",
"f_get",
"(",
"self",
",",
"name",
",",
"fast_access",
"=",
"False",
",",
"with_links",
"=",
"True",
",",
"shortcuts",
"=",
"True",
",",
"max_depth",
"=",
"None",
",",
"auto_load",
"=",
"False",
")",
":",
"return",
"self",
".",
"_nn_interface",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_children | Returns a children dictionary.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes | pypet/naturalnaming.py | def f_get_children(self, copy=True):
"""Returns a children dictionary.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes
"""
... | def f_get_children(self, copy=True):
"""Returns a children dictionary.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes
"""
... | [
"Returns",
"a",
"children",
"dictionary",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3172-L3186 | [
"def",
"f_get_children",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"if",
"copy",
":",
"return",
"self",
".",
"_children",
".",
"copy",
"(",
")",
"else",
":",
"return",
"self",
".",
"_children"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_groups | Returns a dictionary of groups hanging immediately below this group.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes | pypet/naturalnaming.py | def f_get_groups(self, copy=True):
"""Returns a dictionary of groups hanging immediately below this group.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dict... | def f_get_groups(self, copy=True):
"""Returns a dictionary of groups hanging immediately below this group.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dict... | [
"Returns",
"a",
"dictionary",
"of",
"groups",
"hanging",
"immediately",
"below",
"this",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3188-L3202 | [
"def",
"f_get_groups",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"if",
"copy",
":",
"return",
"self",
".",
"_groups",
".",
"copy",
"(",
")",
"else",
":",
"return",
"self",
".",
"_groups"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_leaves | Returns a dictionary of all leaves hanging immediately below this group.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes | pypet/naturalnaming.py | def f_get_leaves(self, copy=True):
"""Returns a dictionary of all leaves hanging immediately below this group.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: ... | def f_get_leaves(self, copy=True):
"""Returns a dictionary of all leaves hanging immediately below this group.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: ... | [
"Returns",
"a",
"dictionary",
"of",
"all",
"leaves",
"hanging",
"immediately",
"below",
"this",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3204-L3218 | [
"def",
"f_get_leaves",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"if",
"copy",
":",
"return",
"self",
".",
"_leaves",
".",
"copy",
"(",
")",
"else",
":",
"return",
"self",
".",
"_leaves"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_get_links | Returns a link dictionary.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes | pypet/naturalnaming.py | def f_get_links(self, copy=True):
"""Returns a link dictionary.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes
"""
if cop... | def f_get_links(self, copy=True):
"""Returns a link dictionary.
:param copy:
Whether the group's original dictionary or a shallow copy is returned.
If you want the real dictionary please do not modify it at all!
:returns: Dictionary of nodes
"""
if cop... | [
"Returns",
"a",
"link",
"dictionary",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3220-L3234 | [
"def",
"f_get_links",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"if",
"copy",
":",
"return",
"self",
".",
"_links",
".",
"copy",
"(",
")",
"else",
":",
"return",
"self",
".",
"_links"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_store_child | Stores a child or recursively a subtree to disk.
:param name:
Name of child to store. If grouped ('groupA.groupB.childC') the path along the way
to last node in the chain is stored. Shortcuts are NOT allowed!
:param recursive:
Whether recursively all children's ch... | pypet/naturalnaming.py | def f_store_child(self, name, recursive=False, store_data=pypetconstants.STORE_DATA,
max_depth=None):
"""Stores a child or recursively a subtree to disk.
:param name:
Name of child to store. If grouped ('groupA.groupB.childC') the path along the way
to las... | def f_store_child(self, name, recursive=False, store_data=pypetconstants.STORE_DATA,
max_depth=None):
"""Stores a child or recursively a subtree to disk.
:param name:
Name of child to store. If grouped ('groupA.groupB.childC') the path along the way
to las... | [
"Stores",
"a",
"child",
"or",
"recursively",
"a",
"subtree",
"to",
"disk",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3267-L3305 | [
"def",
"f_store_child",
"(",
"self",
",",
"name",
",",
"recursive",
"=",
"False",
",",
"store_data",
"=",
"pypetconstants",
".",
"STORE_DATA",
",",
"max_depth",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"f_contains",
"(",
"name",
",",
"shortcuts",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_store | Stores a group node to disk
:param recursive:
Whether recursively all children should be stored too. Default is ``True``.
:param store_data:
For how to choose 'store_data' see :ref:`more-on-storing`.
:param max_depth:
In case `recursive` is `True`, you c... | pypet/naturalnaming.py | def f_store(self, recursive=True, store_data=pypetconstants.STORE_DATA,
max_depth=None):
"""Stores a group node to disk
:param recursive:
Whether recursively all children should be stored too. Default is ``True``.
:param store_data:
For how to choose '... | def f_store(self, recursive=True, store_data=pypetconstants.STORE_DATA,
max_depth=None):
"""Stores a group node to disk
:param recursive:
Whether recursively all children should be stored too. Default is ``True``.
:param store_data:
For how to choose '... | [
"Stores",
"a",
"group",
"node",
"to",
"disk"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3307-L3333 | [
"def",
"f_store",
"(",
"self",
",",
"recursive",
"=",
"True",
",",
"store_data",
"=",
"pypetconstants",
".",
"STORE_DATA",
",",
"max_depth",
"=",
"None",
")",
":",
"traj",
"=",
"self",
".",
"_nn_interface",
".",
"_root_instance",
"storage_service",
"=",
"tra... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_load_child | Loads a child or recursively a subtree from disk.
:param name:
Name of child to load. If grouped ('groupA.groupB.childC') the path along the way
to last node in the chain is loaded. Shortcuts are NOT allowed!
:param recursive:
Whether recursively all nodes below t... | pypet/naturalnaming.py | def f_load_child(self, name, recursive=False, load_data=pypetconstants.LOAD_DATA,
max_depth=None):
"""Loads a child or recursively a subtree from disk.
:param name:
Name of child to load. If grouped ('groupA.groupB.childC') the path along the way
to last no... | def f_load_child(self, name, recursive=False, load_data=pypetconstants.LOAD_DATA,
max_depth=None):
"""Loads a child or recursively a subtree from disk.
:param name:
Name of child to load. If grouped ('groupA.groupB.childC') the path along the way
to last no... | [
"Loads",
"a",
"child",
"or",
"recursively",
"a",
"subtree",
"from",
"disk",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3335-L3378 | [
"def",
"f_load_child",
"(",
"self",
",",
"name",
",",
"recursive",
"=",
"False",
",",
"load_data",
"=",
"pypetconstants",
".",
"LOAD_DATA",
",",
"max_depth",
"=",
"None",
")",
":",
"traj",
"=",
"self",
".",
"_nn_interface",
".",
"_root_instance",
"storage_se... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | NNGroupNode.f_load | Loads a group from disk.
:param recursive:
Default is ``True``.
Whether recursively all nodes below the current node should be loaded, too.
Note that links are never evaluated recursively. Only the linked node
will be loaded if it does not exist in the tree, yet... | pypet/naturalnaming.py | def f_load(self, recursive=True, load_data=pypetconstants.LOAD_DATA,
max_depth=None):
"""Loads a group from disk.
:param recursive:
Default is ``True``.
Whether recursively all nodes below the current node should be loaded, too.
Note that links are ne... | def f_load(self, recursive=True, load_data=pypetconstants.LOAD_DATA,
max_depth=None):
"""Loads a group from disk.
:param recursive:
Default is ``True``.
Whether recursively all nodes below the current node should be loaded, too.
Note that links are ne... | [
"Loads",
"a",
"group",
"from",
"disk",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3380-L3416 | [
"def",
"f_load",
"(",
"self",
",",
"recursive",
"=",
"True",
",",
"load_data",
"=",
"pypetconstants",
".",
"LOAD_DATA",
",",
"max_depth",
"=",
"None",
")",
":",
"traj",
"=",
"self",
".",
"_nn_interface",
".",
"_root_instance",
"storage_service",
"=",
"traj",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ParameterGroup.f_add_parameter_group | Adds an empty parameter group under the current node.
Can be called with ``f_add_parameter_group('MyName', 'this is an informative comment')``
or ``f_add_parameter_group(name='MyName', comment='This is an informative comment')``
or with a given new group instance:
``f_add_parameter_grou... | pypet/naturalnaming.py | def f_add_parameter_group(self, *args, **kwargs):
"""Adds an empty parameter group under the current node.
Can be called with ``f_add_parameter_group('MyName', 'this is an informative comment')``
or ``f_add_parameter_group(name='MyName', comment='This is an informative comment')``
or wi... | def f_add_parameter_group(self, *args, **kwargs):
"""Adds an empty parameter group under the current node.
Can be called with ``f_add_parameter_group('MyName', 'this is an informative comment')``
or ``f_add_parameter_group(name='MyName', comment='This is an informative comment')``
or wi... | [
"Adds",
"an",
"empty",
"parameter",
"group",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3427-L3446 | [
"def",
"f_add_parameter_group",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"PARAMETER_GROUP",
",",
"group_type_name",
"=",
"PARAMETER_GROUP"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ParameterGroup.f_add_parameter | Adds a parameter under the current node.
There are two ways to add a new parameter either by adding a parameter instance:
>>> new_parameter = Parameter('group1.group2.myparam', data=42, comment='Example!')
>>> traj.f_add_parameter(new_parameter)
Or by passing the values directly to th... | pypet/naturalnaming.py | def f_add_parameter(self, *args, **kwargs):
""" Adds a parameter under the current node.
There are two ways to add a new parameter either by adding a parameter instance:
>>> new_parameter = Parameter('group1.group2.myparam', data=42, comment='Example!')
>>> traj.f_add_parameter(new_par... | def f_add_parameter(self, *args, **kwargs):
""" Adds a parameter under the current node.
There are two ways to add a new parameter either by adding a parameter instance:
>>> new_parameter = Parameter('group1.group2.myparam', data=42, comment='Example!')
>>> traj.f_add_parameter(new_par... | [
"Adds",
"a",
"parameter",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3448-L3479 | [
"def",
"f_add_parameter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"PARAMETER",
",",
"group_type_name",
"=",
"PARAMETER_GROUP",
",",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ResultGroup.f_add_result_group | Adds an empty result group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is a single run (root) adds the prefix `'results.runs.run_08%d%'` to the
full name where `'08%d'` is replaced by the index of the current run.
T... | pypet/naturalnaming.py | def f_add_result_group(self, *args, **kwargs):
"""Adds an empty result group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is a single run (root) adds the prefix `'results.runs.run_08%d%'` to the
full name where `'08%d... | def f_add_result_group(self, *args, **kwargs):
"""Adds an empty result group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is a single run (root) adds the prefix `'results.runs.run_08%d%'` to the
full name where `'08%d... | [
"Adds",
"an",
"empty",
"result",
"group",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3493-L3508 | [
"def",
"f_add_result_group",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"RESULT_GROUP",
",",
"group_type_name",
"=",
"RESULT_GROUP",
",",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ResultGroup.f_add_result | Adds a result under the current node.
There are two ways to add a new result either by adding a result instance:
>>> new_result = Result('group1.group2.myresult', 1666, x=3, y=4, comment='Example!')
>>> traj.f_add_result(new_result)
Or by passing the values directly to the function, w... | pypet/naturalnaming.py | def f_add_result(self, *args, **kwargs):
"""Adds a result under the current node.
There are two ways to add a new result either by adding a result instance:
>>> new_result = Result('group1.group2.myresult', 1666, x=3, y=4, comment='Example!')
>>> traj.f_add_result(new_result)
... | def f_add_result(self, *args, **kwargs):
"""Adds a result under the current node.
There are two ways to add a new result either by adding a result instance:
>>> new_result = Result('group1.group2.myresult', 1666, x=3, y=4, comment='Example!')
>>> traj.f_add_result(new_result)
... | [
"Adds",
"a",
"result",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3510-L3541 | [
"def",
"f_add_result",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"RESULT",
",",
"group_type_name",
"=",
"RESULT_GROUP",
",",
"args",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | DerivedParameterGroup.f_add_derived_parameter_group | Adds an empty derived parameter group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is a single run (root) adds the prefix `'derived_parameters.runs.run_08%d%'`
to the full name where `'08%d'` is replaced by the index of the c... | pypet/naturalnaming.py | def f_add_derived_parameter_group(self, *args, **kwargs):
"""Adds an empty derived parameter group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is a single run (root) adds the prefix `'derived_parameters.runs.run_08%d%'`
... | def f_add_derived_parameter_group(self, *args, **kwargs):
"""Adds an empty derived parameter group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is a single run (root) adds the prefix `'derived_parameters.runs.run_08%d%'`
... | [
"Adds",
"an",
"empty",
"derived",
"parameter",
"group",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3555-L3570 | [
"def",
"f_add_derived_parameter_group",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"DERIVED_PARAMETER_GROUP",
",",
"group_type_name",
"=",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | DerivedParameterGroup.f_add_derived_parameter | Adds a derived parameter under the current group.
Similar to
:func:`~pypet.naturalnaming.ParameterGroup.f_add_parameter`
Naming prefixes are added as in
:func:`~pypet.naturalnaming.DerivedParameterGroup.f_add_derived_parameter_group` | pypet/naturalnaming.py | def f_add_derived_parameter(self, *args, **kwargs):
"""Adds a derived parameter under the current group.
Similar to
:func:`~pypet.naturalnaming.ParameterGroup.f_add_parameter`
Naming prefixes are added as in
:func:`~pypet.naturalnaming.DerivedParameterGroup.f_add_derived_parame... | def f_add_derived_parameter(self, *args, **kwargs):
"""Adds a derived parameter under the current group.
Similar to
:func:`~pypet.naturalnaming.ParameterGroup.f_add_parameter`
Naming prefixes are added as in
:func:`~pypet.naturalnaming.DerivedParameterGroup.f_add_derived_parame... | [
"Adds",
"a",
"derived",
"parameter",
"under",
"the",
"current",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3572-L3584 | [
"def",
"f_add_derived_parameter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"DERIVED_PARAMETER",
",",
"group_type_name",
"=",
"DERIVED_PARA... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ConfigGroup.f_add_config_group | Adds an empty config group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is the trajectory (root), the prefix `'config'` is added to the full name.
The `name` can also contain subgroups separated via colons, for example:
... | pypet/naturalnaming.py | def f_add_config_group(self, *args, **kwargs):
"""Adds an empty config group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is the trajectory (root), the prefix `'config'` is added to the full name.
The `name` can also... | def f_add_config_group(self, *args, **kwargs):
"""Adds an empty config group under the current node.
Adds the full name of the current node as prefix to the name of the group.
If current node is the trajectory (root), the prefix `'config'` is added to the full name.
The `name` can also... | [
"Adds",
"an",
"empty",
"config",
"group",
"under",
"the",
"current",
"node",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3598-L3611 | [
"def",
"f_add_config_group",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"CONFIG_GROUP",
",",
"group_type_name",
"=",
"CONFIG_GROUP",
",",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ConfigGroup.f_add_config | Adds a config parameter under the current group.
Similar to
:func:`~pypet.naturalnaming.ParameterGroup.f_add_parameter`.
If current group is the trajectory the prefix `'config'` is added to the name. | pypet/naturalnaming.py | def f_add_config(self, *args, **kwargs):
"""Adds a config parameter under the current group.
Similar to
:func:`~pypet.naturalnaming.ParameterGroup.f_add_parameter`.
If current group is the trajectory the prefix `'config'` is added to the name.
"""
return self._nn_inter... | def f_add_config(self, *args, **kwargs):
"""Adds a config parameter under the current group.
Similar to
:func:`~pypet.naturalnaming.ParameterGroup.f_add_parameter`.
If current group is the trajectory the prefix `'config'` is added to the name.
"""
return self._nn_inter... | [
"Adds",
"a",
"config",
"parameter",
"under",
"the",
"current",
"group",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L3613-L3624 | [
"def",
"f_add_config",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_nn_interface",
".",
"_add_generic",
"(",
"self",
",",
"type_name",
"=",
"CONFIG",
",",
"group_type_name",
"=",
"CONFIG_GROUP",
",",
"args",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | eval_one_max | The fitness function | examples/example_20_using_deap_manual_runs.py | def eval_one_max(traj, individual):
"""The fitness function"""
traj.f_add_result('$set.$.individual', list(individual))
fitness = sum(individual)
traj.f_add_result('$set.$.fitness', fitness)
traj.f_store()
return (fitness,) | def eval_one_max(traj, individual):
"""The fitness function"""
traj.f_add_result('$set.$.individual', list(individual))
fitness = sum(individual)
traj.f_add_result('$set.$.fitness', fitness)
traj.f_store()
return (fitness,) | [
"The",
"fitness",
"function"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_20_using_deap_manual_runs.py#L39-L45 | [
"def",
"eval_one_max",
"(",
"traj",
",",
"individual",
")",
":",
"traj",
".",
"f_add_result",
"(",
"'$set.$.individual'",
",",
"list",
"(",
"individual",
")",
")",
"fitness",
"=",
"sum",
"(",
"individual",
")",
"traj",
".",
"f_add_result",
"(",
"'$set.$.fitn... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | unit_from_expression | Takes a unit string like ``'1. * volt'`` and returns the BRIAN2 unit. | pypet/brian2/parameter.py | def unit_from_expression(expr):
"""Takes a unit string like ``'1. * volt'`` and returns the BRIAN2 unit."""
if expr == '1':
return get_unit_fast(1)
elif isinstance(expr, str):
mod = ast.parse(expr, mode='eval')
expr = mod.body
return unit_from_expression(expr)
elif expr._... | def unit_from_expression(expr):
"""Takes a unit string like ``'1. * volt'`` and returns the BRIAN2 unit."""
if expr == '1':
return get_unit_fast(1)
elif isinstance(expr, str):
mod = ast.parse(expr, mode='eval')
expr = mod.body
return unit_from_expression(expr)
elif expr._... | [
"Takes",
"a",
"unit",
"string",
"like",
"1",
".",
"*",
"volt",
"and",
"returns",
"the",
"BRIAN2",
"unit",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/parameter.py#L37-L77 | [
"def",
"unit_from_expression",
"(",
"expr",
")",
":",
"if",
"expr",
"==",
"'1'",
":",
"return",
"get_unit_fast",
"(",
"1",
")",
"elif",
"isinstance",
"(",
"expr",
",",
"str",
")",
":",
"mod",
"=",
"ast",
".",
"parse",
"(",
"expr",
",",
"mode",
"=",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Brian2Parameter.f_supports | Simply checks if data is supported | pypet/brian2/parameter.py | def f_supports(self, data):
""" Simply checks if data is supported """
if isinstance(data, Quantity):
return True
elif super(Brian2Parameter, self).f_supports(data):
return True
return False | def f_supports(self, data):
""" Simply checks if data is supported """
if isinstance(data, Quantity):
return True
elif super(Brian2Parameter, self).f_supports(data):
return True
return False | [
"Simply",
"checks",
"if",
"data",
"is",
"supported"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/parameter.py#L98-L104 | [
"def",
"f_supports",
"(",
"self",
",",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"Quantity",
")",
":",
"return",
"True",
"elif",
"super",
"(",
"Brian2Parameter",
",",
"self",
")",
".",
"f_supports",
"(",
"data",
")",
":",
"return",
"True"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Brian2Result._supports | Simply checks if data is supported | pypet/brian2/parameter.py | def _supports(self, data):
""" Simply checks if data is supported """
if isinstance(data, Quantity):
return True
elif super(Brian2Result, self)._supports(data):
return True
return False | def _supports(self, data):
""" Simply checks if data is supported """
if isinstance(data, Quantity):
return True
elif super(Brian2Result, self)._supports(data):
return True
return False | [
"Simply",
"checks",
"if",
"data",
"is",
"supported"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/parameter.py#L201-L207 | [
"def",
"_supports",
"(",
"self",
",",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"Quantity",
")",
":",
"return",
"True",
"elif",
"super",
"(",
"Brian2Result",
",",
"self",
")",
".",
"_supports",
"(",
"data",
")",
":",
"return",
"True",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Brian2MonitorResult.f_set_single | To add a monitor use `f_set_single('monitor', brian_monitor)`.
Otherwise `f_set_single` works similar to :func:`~pypet.parameter.Result.f_set_single`. | pypet/brian2/parameter.py | def f_set_single(self, name, item):
""" To add a monitor use `f_set_single('monitor', brian_monitor)`.
Otherwise `f_set_single` works similar to :func:`~pypet.parameter.Result.f_set_single`.
"""
if type(item) in [SpikeMonitor, StateMonitor, PopulationRateMonitor]:
if self.v_... | def f_set_single(self, name, item):
""" To add a monitor use `f_set_single('monitor', brian_monitor)`.
Otherwise `f_set_single` works similar to :func:`~pypet.parameter.Result.f_set_single`.
"""
if type(item) in [SpikeMonitor, StateMonitor, PopulationRateMonitor]:
if self.v_... | [
"To",
"add",
"a",
"monitor",
"use",
"f_set_single",
"(",
"monitor",
"brian_monitor",
")",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/brian2/parameter.py#L372-L385 | [
"def",
"f_set_single",
"(",
"self",
",",
"name",
",",
"item",
")",
":",
"if",
"type",
"(",
"item",
")",
"in",
"[",
"SpikeMonitor",
",",
"StateMonitor",
",",
"PopulationRateMonitor",
"]",
":",
"if",
"self",
".",
"v_stored",
":",
"self",
".",
"_logger",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | add_commit_variables | Adds commit information to the trajectory. | pypet/utils/gitintegration.py | def add_commit_variables(traj, commit):
"""Adds commit information to the trajectory."""
git_time_value = time.strftime('%Y_%m_%d_%Hh%Mm%Ss', time.localtime(commit.committed_date))
git_short_name = str(commit.hexsha[0:7])
git_commit_name = 'commit_%s_' % git_short_name
git_commit_name = 'git.' + g... | def add_commit_variables(traj, commit):
"""Adds commit information to the trajectory."""
git_time_value = time.strftime('%Y_%m_%d_%Hh%Mm%Ss', time.localtime(commit.committed_date))
git_short_name = str(commit.hexsha[0:7])
git_commit_name = 'commit_%s_' % git_short_name
git_commit_name = 'git.' + g... | [
"Adds",
"commit",
"information",
"to",
"the",
"trajectory",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/gitintegration.py#L23-L50 | [
"def",
"add_commit_variables",
"(",
"traj",
",",
"commit",
")",
":",
"git_time_value",
"=",
"time",
".",
"strftime",
"(",
"'%Y_%m_%d_%Hh%Mm%Ss'",
",",
"time",
".",
"localtime",
"(",
"commit",
".",
"committed_date",
")",
")",
"git_short_name",
"=",
"str",
"(",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | make_git_commit | Makes a commit and returns if a new commit was triggered and the SHA_1 code of the commit.
If `git_fail` is `True` program fails instead of triggering a new commit given
not committed changes. Then a `GitDiffError` is raised. | pypet/utils/gitintegration.py | def make_git_commit(environment, git_repository, user_message, git_fail):
""" Makes a commit and returns if a new commit was triggered and the SHA_1 code of the commit.
If `git_fail` is `True` program fails instead of triggering a new commit given
not committed changes. Then a `GitDiffError` is raised.
... | def make_git_commit(environment, git_repository, user_message, git_fail):
""" Makes a commit and returns if a new commit was triggered and the SHA_1 code of the commit.
If `git_fail` is `True` program fails instead of triggering a new commit given
not committed changes. Then a `GitDiffError` is raised.
... | [
"Makes",
"a",
"commit",
"and",
"returns",
"if",
"a",
"new",
"commit",
"was",
"triggered",
"and",
"the",
"SHA_1",
"code",
"of",
"the",
"commit",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/gitintegration.py#L61-L110 | [
"def",
"make_git_commit",
"(",
"environment",
",",
"git_repository",
",",
"user_message",
",",
"git_fail",
")",
":",
"# Import GitPython, we do it here to allow also users not having GitPython installed",
"# to use the normal environment",
"# Open the repository",
"repo",
"=",
"git... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | flatten_dictionary | Flattens a nested dictionary.
New keys are concatenations of nested keys with the `separator` in between. | pypet/utils/helpful_functions.py | def flatten_dictionary(nested_dict, separator):
"""Flattens a nested dictionary.
New keys are concatenations of nested keys with the `separator` in between.
"""
flat_dict = {}
for key, val in nested_dict.items():
if isinstance(val, dict):
new_flat_dict = flatten_dictionary(val,... | def flatten_dictionary(nested_dict, separator):
"""Flattens a nested dictionary.
New keys are concatenations of nested keys with the `separator` in between.
"""
flat_dict = {}
for key, val in nested_dict.items():
if isinstance(val, dict):
new_flat_dict = flatten_dictionary(val,... | [
"Flattens",
"a",
"nested",
"dictionary",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L27-L43 | [
"def",
"flatten_dictionary",
"(",
"nested_dict",
",",
"separator",
")",
":",
"flat_dict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"nested_dict",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"new_flat_dict",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | nest_dictionary | Nests a given flat dictionary.
Nested keys are created by splitting given keys around the `separator`. | pypet/utils/helpful_functions.py | def nest_dictionary(flat_dict, separator):
""" Nests a given flat dictionary.
Nested keys are created by splitting given keys around the `separator`.
"""
nested_dict = {}
for key, val in flat_dict.items():
split_key = key.split(separator)
act_dict = nested_dict
final_key = ... | def nest_dictionary(flat_dict, separator):
""" Nests a given flat dictionary.
Nested keys are created by splitting given keys around the `separator`.
"""
nested_dict = {}
for key, val in flat_dict.items():
split_key = key.split(separator)
act_dict = nested_dict
final_key = ... | [
"Nests",
"a",
"given",
"flat",
"dictionary",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L46-L64 | [
"def",
"nest_dictionary",
"(",
"flat_dict",
",",
"separator",
")",
":",
"nested_dict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"flat_dict",
".",
"items",
"(",
")",
":",
"split_key",
"=",
"key",
".",
"split",
"(",
"separator",
")",
"act_dict",
"=... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | progressbar | Plots a progress bar to the given `logger` for large for loops.
To be used inside a for-loop at the end of the loop:
.. code-block:: python
for irun in range(42):
my_costly_job() # Your expensive function
progressbar(index=irun, total=42, reprint=True) # shows a growing progre... | pypet/utils/helpful_functions.py | def progressbar(index, total, percentage_step=10, logger='print', log_level=logging.INFO,
reprint=True, time=True, length=20, fmt_string=None, reset=False):
"""Plots a progress bar to the given `logger` for large for loops.
To be used inside a for-loop at the end of the loop:
.. code-bloc... | def progressbar(index, total, percentage_step=10, logger='print', log_level=logging.INFO,
reprint=True, time=True, length=20, fmt_string=None, reset=False):
"""Plots a progress bar to the given `logger` for large for loops.
To be used inside a for-loop at the end of the loop:
.. code-bloc... | [
"Plots",
"a",
"progress",
"bar",
"to",
"the",
"given",
"logger",
"for",
"large",
"for",
"loops",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L208-L256 | [
"def",
"progressbar",
"(",
"index",
",",
"total",
",",
"percentage_step",
"=",
"10",
",",
"logger",
"=",
"'print'",
",",
"log_level",
"=",
"logging",
".",
"INFO",
",",
"reprint",
"=",
"True",
",",
"time",
"=",
"True",
",",
"length",
"=",
"20",
",",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | _get_argspec | Helper function to support both Python versions | pypet/utils/helpful_functions.py | def _get_argspec(func):
"""Helper function to support both Python versions"""
if inspect.isclass(func):
func = func.__init__
if not inspect.isfunction(func):
# Init function not existing
return [], False
parameters = inspect.signature(func).parameters
args = []
uses_stars... | def _get_argspec(func):
"""Helper function to support both Python versions"""
if inspect.isclass(func):
func = func.__init__
if not inspect.isfunction(func):
# Init function not existing
return [], False
parameters = inspect.signature(func).parameters
args = []
uses_stars... | [
"Helper",
"function",
"to",
"support",
"both",
"Python",
"versions"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L259-L275 | [
"def",
"_get_argspec",
"(",
"func",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"func",
")",
":",
"func",
"=",
"func",
".",
"__init__",
"if",
"not",
"inspect",
".",
"isfunction",
"(",
"func",
")",
":",
"# Init function not existing",
"return",
"[",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | get_matching_kwargs | Takes a function and keyword arguments and returns the ones that can be passed. | pypet/utils/helpful_functions.py | def get_matching_kwargs(func, kwargs):
"""Takes a function and keyword arguments and returns the ones that can be passed."""
args, uses_startstar = _get_argspec(func)
if uses_startstar:
return kwargs.copy()
else:
matching_kwargs = dict((k, kwargs[k]) for k in args if k in kwargs)
... | def get_matching_kwargs(func, kwargs):
"""Takes a function and keyword arguments and returns the ones that can be passed."""
args, uses_startstar = _get_argspec(func)
if uses_startstar:
return kwargs.copy()
else:
matching_kwargs = dict((k, kwargs[k]) for k in args if k in kwargs)
... | [
"Takes",
"a",
"function",
"and",
"keyword",
"arguments",
"and",
"returns",
"the",
"ones",
"that",
"can",
"be",
"passed",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L278-L285 | [
"def",
"get_matching_kwargs",
"(",
"func",
",",
"kwargs",
")",
":",
"args",
",",
"uses_startstar",
"=",
"_get_argspec",
"(",
"func",
")",
"if",
"uses_startstar",
":",
"return",
"kwargs",
".",
"copy",
"(",
")",
"else",
":",
"matching_kwargs",
"=",
"dict",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | result_sort | Sorts a list of results in O(n) in place (since every run is unique)
:param result_list: List of tuples [(run_idx, res), ...]
:param start_index: Index with which to start, every entry before `start_index` is ignored | pypet/utils/helpful_functions.py | def result_sort(result_list, start_index=0):
"""Sorts a list of results in O(n) in place (since every run is unique)
:param result_list: List of tuples [(run_idx, res), ...]
:param start_index: Index with which to start, every entry before `start_index` is ignored
"""
if len(result_list) < 2:
... | def result_sort(result_list, start_index=0):
"""Sorts a list of results in O(n) in place (since every run is unique)
:param result_list: List of tuples [(run_idx, res), ...]
:param start_index: Index with which to start, every entry before `start_index` is ignored
"""
if len(result_list) < 2:
... | [
"Sorts",
"a",
"list",
"of",
"results",
"in",
"O",
"(",
"n",
")",
"in",
"place",
"(",
"since",
"every",
"run",
"is",
"unique",
")"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L288-L311 | [
"def",
"result_sort",
"(",
"result_list",
",",
"start_index",
"=",
"0",
")",
":",
"if",
"len",
"(",
"result_list",
")",
"<",
"2",
":",
"return",
"result_list",
"to_sort",
"=",
"result_list",
"[",
"start_index",
":",
"]",
"minmax",
"=",
"[",
"x",
"[",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | format_time | Formats timestamp to human readable format | pypet/utils/helpful_functions.py | def format_time(timestamp):
"""Formats timestamp to human readable format"""
format_string = '%Y_%m_%d_%Hh%Mm%Ss'
formatted_time = datetime.datetime.fromtimestamp(timestamp).strftime(format_string)
return formatted_time | def format_time(timestamp):
"""Formats timestamp to human readable format"""
format_string = '%Y_%m_%d_%Hh%Mm%Ss'
formatted_time = datetime.datetime.fromtimestamp(timestamp).strftime(format_string)
return formatted_time | [
"Formats",
"timestamp",
"to",
"human",
"readable",
"format"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L314-L318 | [
"def",
"format_time",
"(",
"timestamp",
")",
":",
"format_string",
"=",
"'%Y_%m_%d_%Hh%Mm%Ss'",
"formatted_time",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"timestamp",
")",
".",
"strftime",
"(",
"format_string",
")",
"return",
"formatted_time"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | port_to_tcp | Returns local tcp address for a given `port`, automatic port if `None` | pypet/utils/helpful_functions.py | def port_to_tcp(port=None):
"""Returns local tcp address for a given `port`, automatic port if `None`"""
#address = 'tcp://' + socket.gethostbyname(socket.getfqdn())
domain_name = socket.getfqdn()
try:
addr_list = socket.getaddrinfo(domain_name, None)
except Exception:
addr_list = so... | def port_to_tcp(port=None):
"""Returns local tcp address for a given `port`, automatic port if `None`"""
#address = 'tcp://' + socket.gethostbyname(socket.getfqdn())
domain_name = socket.getfqdn()
try:
addr_list = socket.getaddrinfo(domain_name, None)
except Exception:
addr_list = so... | [
"Returns",
"local",
"tcp",
"address",
"for",
"a",
"given",
"port",
"automatic",
"port",
"if",
"None"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L334-L361 | [
"def",
"port_to_tcp",
"(",
"port",
"=",
"None",
")",
":",
"#address = 'tcp://' + socket.gethostbyname(socket.getfqdn())",
"domain_name",
"=",
"socket",
".",
"getfqdn",
"(",
")",
"try",
":",
"addr_list",
"=",
"socket",
".",
"getaddrinfo",
"(",
"domain_name",
",",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | racedirs | Like os.makedirs but takes care about race conditions | pypet/utils/helpful_functions.py | def racedirs(path):
"""Like os.makedirs but takes care about race conditions"""
if os.path.isfile(path):
raise IOError('Path `%s` is already a file not a directory')
while True:
try:
if os.path.isdir(path):
# only break if full path has been created or exists
... | def racedirs(path):
"""Like os.makedirs but takes care about race conditions"""
if os.path.isfile(path):
raise IOError('Path `%s` is already a file not a directory')
while True:
try:
if os.path.isdir(path):
# only break if full path has been created or exists
... | [
"Like",
"os",
".",
"makedirs",
"but",
"takes",
"care",
"about",
"race",
"conditions"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L364-L378 | [
"def",
"racedirs",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"raise",
"IOError",
"(",
"'Path `%s` is already a file not a directory'",
")",
"while",
"True",
":",
"try",
":",
"if",
"os",
".",
"path",
".",
"isdir... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | _Progressbar._reset | Resets to the progressbar to start a new one | pypet/utils/helpful_functions.py | def _reset(self, index, total, percentage_step, length):
"""Resets to the progressbar to start a new one"""
self._start_time = datetime.datetime.now()
self._start_index = index
self._current_index = index
self._percentage_step = percentage_step
self._total = float(total)
... | def _reset(self, index, total, percentage_step, length):
"""Resets to the progressbar to start a new one"""
self._start_time = datetime.datetime.now()
self._start_index = index
self._current_index = index
self._percentage_step = percentage_step
self._total = float(total)
... | [
"Resets",
"to",
"the",
"progressbar",
"to",
"start",
"a",
"new",
"one"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L85-L95 | [
"def",
"_reset",
"(",
"self",
",",
"index",
",",
"total",
",",
"percentage_step",
",",
"length",
")",
":",
"self",
".",
"_start_time",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"self",
".",
"_start_index",
"=",
"index",
"self",
".",
"_cur... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | _Progressbar._get_remaining | Calculates remaining time as a string | pypet/utils/helpful_functions.py | def _get_remaining(self, index):
"""Calculates remaining time as a string"""
try:
current_time = datetime.datetime.now()
time_delta = current_time - self._start_time
try:
total_seconds = time_delta.total_seconds()
except AttributeError:
... | def _get_remaining(self, index):
"""Calculates remaining time as a string"""
try:
current_time = datetime.datetime.now()
time_delta = current_time - self._start_time
try:
total_seconds = time_delta.total_seconds()
except AttributeError:
... | [
"Calculates",
"remaining",
"time",
"as",
"a",
"string"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/helpful_functions.py#L97-L117 | [
"def",
"_get_remaining",
"(",
"self",
",",
"index",
")",
":",
"try",
":",
"current_time",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"time_delta",
"=",
"current_time",
"-",
"self",
".",
"_start_time",
"try",
":",
"total_seconds",
"=",
"time_de... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Annotations.f_to_dict | Returns annotations as dictionary.
:param copy: Whether to return a shallow copy or the real thing (aka _dict). | pypet/annotations.py | def f_to_dict(self, copy=True):
"""Returns annotations as dictionary.
:param copy: Whether to return a shallow copy or the real thing (aka _dict).
"""
if copy:
return self._dict.copy()
else:
return self._dict | def f_to_dict(self, copy=True):
"""Returns annotations as dictionary.
:param copy: Whether to return a shallow copy or the real thing (aka _dict).
"""
if copy:
return self._dict.copy()
else:
return self._dict | [
"Returns",
"annotations",
"as",
"dictionary",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L72-L81 | [
"def",
"f_to_dict",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"if",
"copy",
":",
"return",
"self",
".",
"_dict",
".",
"copy",
"(",
")",
"else",
":",
"return",
"self",
".",
"_dict"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Annotations.f_get | Returns annotations
If len(args)>1, then returns a list of annotations.
`f_get(X)` with *X* integer will return the annotation with name `annotation_X`.
If the annotation contains only a single entry you can call `f_get()` without arguments.
If you call `f_get()` and the annotation co... | pypet/annotations.py | def f_get(self, *args):
"""Returns annotations
If len(args)>1, then returns a list of annotations.
`f_get(X)` with *X* integer will return the annotation with name `annotation_X`.
If the annotation contains only a single entry you can call `f_get()` without arguments.
If you c... | def f_get(self, *args):
"""Returns annotations
If len(args)>1, then returns a list of annotations.
`f_get(X)` with *X* integer will return the annotation with name `annotation_X`.
If the annotation contains only a single entry you can call `f_get()` without arguments.
If you c... | [
"Returns",
"annotations"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L112-L146 | [
"def",
"f_get",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"if",
"len",
"(",
"self",
".",
"_dict",
")",
"==",
"1",
":",
"return",
"self",
".",
"_dict",
"[",
"list",
"(",
"self",
".",
"_dict",
".",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Annotations.f_set | Sets annotations
Items in args are added as `annotation` and `annotation_X` where
'X' is the position in args for following arguments. | pypet/annotations.py | def f_set(self, *args, **kwargs):
"""Sets annotations
Items in args are added as `annotation` and `annotation_X` where
'X' is the position in args for following arguments.
"""
for idx, arg in enumerate(args):
valstr = self._translate_key(idx)
self.f_set_... | def f_set(self, *args, **kwargs):
"""Sets annotations
Items in args are added as `annotation` and `annotation_X` where
'X' is the position in args for following arguments.
"""
for idx, arg in enumerate(args):
valstr = self._translate_key(idx)
self.f_set_... | [
"Sets",
"annotations"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L148-L160 | [
"def",
"f_set",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"idx",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
"valstr",
"=",
"self",
".",
"_translate_key",
"(",
"idx",
")",
"self",
".",
"f_set_single",
"(",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Annotations.f_remove | Removes `key` from annotations | pypet/annotations.py | def f_remove(self, key):
"""Removes `key` from annotations"""
key = self._translate_key(key)
try:
del self._dict[key]
except KeyError:
raise AttributeError('Your annotations do not contain %s' % key) | def f_remove(self, key):
"""Removes `key` from annotations"""
key = self._translate_key(key)
try:
del self._dict[key]
except KeyError:
raise AttributeError('Your annotations do not contain %s' % key) | [
"Removes",
"key",
"from",
"annotations"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L162-L168 | [
"def",
"f_remove",
"(",
"self",
",",
"key",
")",
":",
"key",
"=",
"self",
".",
"_translate_key",
"(",
"key",
")",
"try",
":",
"del",
"self",
".",
"_dict",
"[",
"key",
"]",
"except",
"KeyError",
":",
"raise",
"AttributeError",
"(",
"'Your annotations do n... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | Annotations.f_ann_to_str | Returns all annotations lexicographically sorted as a concatenated string. | pypet/annotations.py | def f_ann_to_str(self):
"""Returns all annotations lexicographically sorted as a concatenated string."""
resstr = ''
for key in sorted(self._dict.keys()):
resstr += '%s=%s; ' % (key, str(self._dict[key]))
return resstr[:-2] | def f_ann_to_str(self):
"""Returns all annotations lexicographically sorted as a concatenated string."""
resstr = ''
for key in sorted(self._dict.keys()):
resstr += '%s=%s; ' % (key, str(self._dict[key]))
return resstr[:-2] | [
"Returns",
"all",
"annotations",
"lexicographically",
"sorted",
"as",
"a",
"concatenated",
"string",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/annotations.py#L175-L180 | [
"def",
"f_ann_to_str",
"(",
"self",
")",
":",
"resstr",
"=",
"''",
"for",
"key",
"in",
"sorted",
"(",
"self",
".",
"_dict",
".",
"keys",
"(",
")",
")",
":",
"resstr",
"+=",
"'%s=%s; '",
"%",
"(",
"key",
",",
"str",
"(",
"self",
".",
"_dict",
"[",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | make_ordinary_result | Turns a given shared data item into a an ordinary one.
:param result: Result container with shared data
:param key: The name of the shared data
:param trajectory:
The trajectory, only needed if shared data has
no access to the trajectory, yet.
:param reload: If data should be reloaded... | pypet/shareddata.py | def make_ordinary_result(result, key, trajectory=None, reload=True):
"""Turns a given shared data item into a an ordinary one.
:param result: Result container with shared data
:param key: The name of the shared data
:param trajectory:
The trajectory, only needed if shared data has
no a... | def make_ordinary_result(result, key, trajectory=None, reload=True):
"""Turns a given shared data item into a an ordinary one.
:param result: Result container with shared data
:param key: The name of the shared data
:param trajectory:
The trajectory, only needed if shared data has
no a... | [
"Turns",
"a",
"given",
"shared",
"data",
"item",
"into",
"a",
"an",
"ordinary",
"one",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L81-L104 | [
"def",
"make_ordinary_result",
"(",
"result",
",",
"key",
",",
"trajectory",
"=",
"None",
",",
"reload",
"=",
"True",
")",
":",
"shared_data",
"=",
"result",
".",
"f_get",
"(",
"key",
")",
"if",
"trajectory",
"is",
"not",
"None",
":",
"shared_data",
".",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | make_shared_result | Turns an ordinary data item into a shared one.
Removes the old result from the trajectory and replaces it.
Empties the given result.
:param result: The result containing ordinary data
:param key: Name of ordinary data item
:param trajectory: Trajectory container
:param new_class:
Clas... | pypet/shareddata.py | def make_shared_result(result, key, trajectory, new_class=None):
"""Turns an ordinary data item into a shared one.
Removes the old result from the trajectory and replaces it.
Empties the given result.
:param result: The result containing ordinary data
:param key: Name of ordinary data item
:pa... | def make_shared_result(result, key, trajectory, new_class=None):
"""Turns an ordinary data item into a shared one.
Removes the old result from the trajectory and replaces it.
Empties the given result.
:param result: The result containing ordinary data
:param key: Name of ordinary data item
:pa... | [
"Turns",
"an",
"ordinary",
"data",
"item",
"into",
"a",
"shared",
"one",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L107-L139 | [
"def",
"make_shared_result",
"(",
"result",
",",
"key",
",",
"trajectory",
",",
"new_class",
"=",
"None",
")",
":",
"data",
"=",
"result",
".",
"f_get",
"(",
"key",
")",
"if",
"new_class",
"is",
"None",
":",
"if",
"isinstance",
"(",
"data",
",",
"Objec... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | SharedData.create_shared_data | Creates shared data on disk with a StorageService on disk.
Needs to be called before shared data can be used later on.
Actual arguments of ``kwargs`` depend on the type of data to be
created. For instance, creating an array one can use the keyword
``obj`` to pass a numpy array (``obj=n... | pypet/shareddata.py | def create_shared_data(self, **kwargs):
"""Creates shared data on disk with a StorageService on disk.
Needs to be called before shared data can be used later on.
Actual arguments of ``kwargs`` depend on the type of data to be
created. For instance, creating an array one can use the key... | def create_shared_data(self, **kwargs):
"""Creates shared data on disk with a StorageService on disk.
Needs to be called before shared data can be used later on.
Actual arguments of ``kwargs`` depend on the type of data to be
created. For instance, creating an array one can use the key... | [
"Creates",
"shared",
"data",
"on",
"disk",
"with",
"a",
"StorageService",
"on",
"disk",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L235-L262 | [
"def",
"create_shared_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'flag'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'flag'",
"]",
"=",
"self",
".",
"FLAG",
"if",
"'data'",
"in",
"kwargs",
":",
"kwargs",
"[",
"'obj'",
"]",
"=",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | SharedData._request_data | Interface with the underlying storage.
Passes request to the StorageService that performs the appropriate action.
For example, given a shared table ``t``.
``t.remove_row(4)`` is parsed into ``request='remove_row', args=(4,)`` and
passed onto the storage service. In case of the HDF5Stora... | pypet/shareddata.py | def _request_data(self, request, args=None, kwargs=None):
"""Interface with the underlying storage.
Passes request to the StorageService that performs the appropriate action.
For example, given a shared table ``t``.
``t.remove_row(4)`` is parsed into ``request='remove_row', args=(4,)`` ... | def _request_data(self, request, args=None, kwargs=None):
"""Interface with the underlying storage.
Passes request to the StorageService that performs the appropriate action.
For example, given a shared table ``t``.
``t.remove_row(4)`` is parsed into ``request='remove_row', args=(4,)`` ... | [
"Interface",
"with",
"the",
"underlying",
"storage",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L264-L278 | [
"def",
"_request_data",
"(",
"self",
",",
"request",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"return",
"self",
".",
"_storage_service",
".",
"store",
"(",
"pypetconstants",
".",
"ACCESS_DATA",
",",
"self",
".",
"parent",
".",
"v_f... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | SharedData.get_data_node | Returns the actula node of the underlying data.
In case one uses HDF5 this will be the HDF5 leaf node. | pypet/shareddata.py | def get_data_node(self):
"""Returns the actula node of the underlying data.
In case one uses HDF5 this will be the HDF5 leaf node.
"""
if not self._storage_service.is_open:
warnings.warn('You requesting the data item but your store is not open, '
'... | def get_data_node(self):
"""Returns the actula node of the underlying data.
In case one uses HDF5 this will be the HDF5 leaf node.
"""
if not self._storage_service.is_open:
warnings.warn('You requesting the data item but your store is not open, '
'... | [
"Returns",
"the",
"actula",
"node",
"of",
"the",
"underlying",
"data",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L280-L290 | [
"def",
"get_data_node",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_storage_service",
".",
"is_open",
":",
"warnings",
".",
"warn",
"(",
"'You requesting the data item but your store is not open, '",
"'the item itself will be closed, too!'",
",",
"category",
"=",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | SharedResult._supports | Checks if outer data structure is supported. | pypet/shareddata.py | def _supports(self, item):
"""Checks if outer data structure is supported."""
result = super(SharedResult, self)._supports(item)
result = result or type(item) in SharedResult.SUPPORTED_DATA
return result | def _supports(self, item):
"""Checks if outer data structure is supported."""
result = super(SharedResult, self)._supports(item)
result = result or type(item) in SharedResult.SUPPORTED_DATA
return result | [
"Checks",
"if",
"outer",
"data",
"structure",
"is",
"supported",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L635-L639 | [
"def",
"_supports",
"(",
"self",
",",
"item",
")",
":",
"result",
"=",
"super",
"(",
"SharedResult",
",",
"self",
")",
".",
"_supports",
"(",
"item",
")",
"result",
"=",
"result",
"or",
"type",
"(",
"item",
")",
"in",
"SharedResult",
".",
"SUPPORTED_DA... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | SharedResult.create_shared_data | Calls the corresponding function of the shared data item | pypet/shareddata.py | def create_shared_data(self, name=None, **kwargs):
"""Calls the corresponding function of the shared data item"""
if name is None:
item = self.f_get()
else:
item = self.f_get(name)
return item.create_shared_data(**kwargs) | def create_shared_data(self, name=None, **kwargs):
"""Calls the corresponding function of the shared data item"""
if name is None:
item = self.f_get()
else:
item = self.f_get(name)
return item.create_shared_data(**kwargs) | [
"Calls",
"the",
"corresponding",
"function",
"of",
"the",
"shared",
"data",
"item"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/shareddata.py#L659-L665 | [
"def",
"create_shared_data",
"(",
"self",
",",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
"is",
"None",
":",
"item",
"=",
"self",
".",
"f_get",
"(",
")",
"else",
":",
"item",
"=",
"self",
".",
"f_get",
"(",
"name",
")",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | manipulate_multiproc_safe | Target function that manipulates the trajectory.
Stores the current name of the process into the trajectory and
**overwrites** previous settings.
:param traj:
Trajectory container with multiprocessing safe storage service | examples/example_16_multiproc_context.py | def manipulate_multiproc_safe(traj):
""" Target function that manipulates the trajectory.
Stores the current name of the process into the trajectory and
**overwrites** previous settings.
:param traj:
Trajectory container with multiprocessing safe storage service
"""
# Manipulate the... | def manipulate_multiproc_safe(traj):
""" Target function that manipulates the trajectory.
Stores the current name of the process into the trajectory and
**overwrites** previous settings.
:param traj:
Trajectory container with multiprocessing safe storage service
"""
# Manipulate the... | [
"Target",
"function",
"that",
"manipulates",
"the",
"trajectory",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_16_multiproc_context.py#L10-L25 | [
"def",
"manipulate_multiproc_safe",
"(",
"traj",
")",
":",
"# Manipulate the data in the trajectory",
"traj",
".",
"last_process_name",
"=",
"mp",
".",
"current_process",
"(",
")",
".",
"name",
"# Store the manipulated data",
"traj",
".",
"results",
".",
"f_store",
"(... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | multiply | Example of a sophisticated simulation that involves multiplying two values.
This time we will store tha value in a shared list and only in the end add the result.
:param traj:
Trajectory containing
the parameters in a particular combination,
it also serves as a container for results. | examples/example_12_sharing_data_between_processes.py | def multiply(traj, result_list):
"""Example of a sophisticated simulation that involves multiplying two values.
This time we will store tha value in a shared list and only in the end add the result.
:param traj:
Trajectory containing
the parameters in a particular combination,
it ... | def multiply(traj, result_list):
"""Example of a sophisticated simulation that involves multiplying two values.
This time we will store tha value in a shared list and only in the end add the result.
:param traj:
Trajectory containing
the parameters in a particular combination,
it ... | [
"Example",
"of",
"a",
"sophisticated",
"simulation",
"that",
"involves",
"multiplying",
"two",
"values",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_12_sharing_data_between_processes.py#L10-L24 | [
"def",
"multiply",
"(",
"traj",
",",
"result_list",
")",
":",
"z",
"=",
"traj",
".",
"x",
"*",
"traj",
".",
"y",
"result_list",
"[",
"traj",
".",
"v_idx",
"]",
"=",
"z"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | LockerServer._lock | Hanldes locking of locks
If a lock is already locked sends a WAIT command,
else LOCKs it and sends GO.
Complains if a given client re-locks a lock without releasing it before. | pypet/utils/mpwrappers.py | def _lock(self, name, client_id, request_id):
"""Hanldes locking of locks
If a lock is already locked sends a WAIT command,
else LOCKs it and sends GO.
Complains if a given client re-locks a lock without releasing it before.
"""
if name in self._locks:
othe... | def _lock(self, name, client_id, request_id):
"""Hanldes locking of locks
If a lock is already locked sends a WAIT command,
else LOCKs it and sends GO.
Complains if a given client re-locks a lock without releasing it before.
"""
if name in self._locks:
othe... | [
"Hanldes",
"locking",
"of",
"locks"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L111-L132 | [
"def",
"_lock",
"(",
"self",
",",
"name",
",",
"client_id",
",",
"request_id",
")",
":",
"if",
"name",
"in",
"self",
".",
"_locks",
":",
"other_client_id",
",",
"other_request_id",
"=",
"self",
".",
"_locks",
"[",
"name",
"]",
"if",
"other_client_id",
"=... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | LockerServer._unlock | Handles unlocking
Complains if a non-existent lock should be released or
if a lock should be released that was acquired by
another client before. | pypet/utils/mpwrappers.py | def _unlock(self, name, client_id, request_id):
"""Handles unlocking
Complains if a non-existent lock should be released or
if a lock should be released that was acquired by
another client before.
"""
if name in self._locks:
other_client_id, other_request_id... | def _unlock(self, name, client_id, request_id):
"""Handles unlocking
Complains if a non-existent lock should be released or
if a lock should be released that was acquired by
another client before.
"""
if name in self._locks:
other_client_id, other_request_id... | [
"Handles",
"unlocking"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L134-L162 | [
"def",
"_unlock",
"(",
"self",
",",
"name",
",",
"client_id",
",",
"request_id",
")",
":",
"if",
"name",
"in",
"self",
".",
"_locks",
":",
"other_client_id",
",",
"other_request_id",
"=",
"self",
".",
"_locks",
"[",
"name",
"]",
"if",
"other_client_id",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | LockerServer.run | Runs server | pypet/utils/mpwrappers.py | def run(self):
"""Runs server"""
try:
self._start()
running = True
while running:
msg = ''
name = ''
client_id = ''
request_id = ''
request = self._socket.recv_string()
s... | def run(self):
"""Runs server"""
try:
self._start()
running = True
while running:
msg = ''
name = ''
client_id = ''
request_id = ''
request = self._socket.recv_string()
s... | [
"Runs",
"server"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L164-L213 | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_start",
"(",
")",
"running",
"=",
"True",
"while",
"running",
":",
"msg",
"=",
"''",
"name",
"=",
"''",
"client_id",
"=",
"''",
"request_id",
"=",
"''",
"request",
"=",
"self",
".",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | TimeOutLockerServer._lock | Handles locking
Locking time is stored to determine time out.
If a lock is timed out it can be acquired by a different client. | pypet/utils/mpwrappers.py | def _lock(self, name, client_id, request_id):
"""Handles locking
Locking time is stored to determine time out.
If a lock is timed out it can be acquired by a different client.
"""
if name in self._locks:
other_client_id, other_request_id, lock_time = self._locks[nam... | def _lock(self, name, client_id, request_id):
"""Handles locking
Locking time is stored to determine time out.
If a lock is timed out it can be acquired by a different client.
"""
if name in self._locks:
other_client_id, other_request_id, lock_time = self._locks[nam... | [
"Handles",
"locking"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L224-L254 | [
"def",
"_lock",
"(",
"self",
",",
"name",
",",
"client_id",
",",
"request_id",
")",
":",
"if",
"name",
"in",
"self",
".",
"_locks",
":",
"other_client_id",
",",
"other_request_id",
",",
"lock_time",
"=",
"self",
".",
"_locks",
"[",
"name",
"]",
"if",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | TimeOutLockerServer._unlock | Handles unlocking | pypet/utils/mpwrappers.py | def _unlock(self, name, client_id, request_id):
"""Handles unlocking"""
if name in self._locks:
other_client_id, other_request_id, lock_time = self._locks[name]
if other_client_id != client_id:
response = (self.RELEASE_ERROR + self.DELIMITER +
... | def _unlock(self, name, client_id, request_id):
"""Handles unlocking"""
if name in self._locks:
other_client_id, other_request_id, lock_time = self._locks[name]
if other_client_id != client_id:
response = (self.RELEASE_ERROR + self.DELIMITER +
... | [
"Handles",
"unlocking"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L256-L285 | [
"def",
"_unlock",
"(",
"self",
",",
"name",
",",
"client_id",
",",
"request_id",
")",
":",
"if",
"name",
"in",
"self",
".",
"_locks",
":",
"other_client_id",
",",
"other_request_id",
",",
"lock_time",
"=",
"self",
".",
"_locks",
"[",
"name",
"]",
"if",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ReliableClient.send_done | Notifies the Server to shutdown | pypet/utils/mpwrappers.py | def send_done(self):
"""Notifies the Server to shutdown"""
self.start(test_connection=False)
self._logger.debug('Sending shutdown signal')
self._req_rep(ZMQServer.DONE) | def send_done(self):
"""Notifies the Server to shutdown"""
self.start(test_connection=False)
self._logger.debug('Sending shutdown signal')
self._req_rep(ZMQServer.DONE) | [
"Notifies",
"the",
"Server",
"to",
"shutdown"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L310-L314 | [
"def",
"send_done",
"(",
"self",
")",
":",
"self",
".",
"start",
"(",
"test_connection",
"=",
"False",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"'Sending shutdown signal'",
")",
"self",
".",
"_req_rep",
"(",
"ZMQServer",
".",
"DONE",
")"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ReliableClient.finalize | Closes socket and terminates context
NO-OP if already closed. | pypet/utils/mpwrappers.py | def finalize(self):
"""Closes socket and terminates context
NO-OP if already closed.
"""
if self._context is not None:
if self._socket is not None:
self._close_socket(confused=False)
self._context.term()
self._context = None
... | def finalize(self):
"""Closes socket and terminates context
NO-OP if already closed.
"""
if self._context is not None:
if self._socket is not None:
self._close_socket(confused=False)
self._context.term()
self._context = None
... | [
"Closes",
"socket",
"and",
"terminates",
"context"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L323-L334 | [
"def",
"finalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"_context",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_socket",
"is",
"not",
"None",
":",
"self",
".",
"_close_socket",
"(",
"confused",
"=",
"False",
")",
"self",
".",
"_context",
".",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ReliableClient.start | Starts connection to server if not existent.
NO-OP if connection is already established.
Makes ping-pong test as well if desired. | pypet/utils/mpwrappers.py | def start(self, test_connection=True):
"""Starts connection to server if not existent.
NO-OP if connection is already established.
Makes ping-pong test as well if desired.
"""
if self._context is None:
self._logger.debug('Starting Client')
self._context ... | def start(self, test_connection=True):
"""Starts connection to server if not existent.
NO-OP if connection is already established.
Makes ping-pong test as well if desired.
"""
if self._context is None:
self._logger.debug('Starting Client')
self._context ... | [
"Starts",
"connection",
"to",
"server",
"if",
"not",
"existent",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L336-L349 | [
"def",
"start",
"(",
"self",
",",
"test_connection",
"=",
"True",
")",
":",
"if",
"self",
".",
"_context",
"is",
"None",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"'Starting Client'",
")",
"self",
".",
"_context",
"=",
"zmq",
".",
"Context",
"(",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ReliableClient._req_rep_retry | Returns response and number of retries | pypet/utils/mpwrappers.py | def _req_rep_retry(self, request):
"""Returns response and number of retries"""
retries_left = self.RETRIES
while retries_left:
self._logger.log(1, 'Sending REQ `%s`', request)
self._send_request(request)
socks = dict(self._poll.poll(self.TIMEOUT))
... | def _req_rep_retry(self, request):
"""Returns response and number of retries"""
retries_left = self.RETRIES
while retries_left:
self._logger.log(1, 'Sending REQ `%s`', request)
self._send_request(request)
socks = dict(self._poll.poll(self.TIMEOUT))
... | [
"Returns",
"response",
"and",
"number",
"of",
"retries"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L373-L392 | [
"def",
"_req_rep_retry",
"(",
"self",
",",
"request",
")",
":",
"retries_left",
"=",
"self",
".",
"RETRIES",
"while",
"retries_left",
":",
"self",
".",
"_logger",
".",
"log",
"(",
"1",
",",
"'Sending REQ `%s`'",
",",
"request",
")",
"self",
".",
"_send_req... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | LockerClient.acquire | Acquires lock and returns `True`
Blocks until lock is available. | pypet/utils/mpwrappers.py | def acquire(self):
"""Acquires lock and returns `True`
Blocks until lock is available.
"""
self.start(test_connection=False)
while True:
str_response, retries = self._req_rep_retry(LockerServer.LOCK)
response = str_response.split(LockerServer.DELIMITER)
... | def acquire(self):
"""Acquires lock and returns `True`
Blocks until lock is available.
"""
self.start(test_connection=False)
while True:
str_response, retries = self._req_rep_retry(LockerServer.LOCK)
response = str_response.split(LockerServer.DELIMITER)
... | [
"Acquires",
"lock",
"and",
"returns",
"True"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L437-L456 | [
"def",
"acquire",
"(",
"self",
")",
":",
"self",
".",
"start",
"(",
"test_connection",
"=",
"False",
")",
"while",
"True",
":",
"str_response",
",",
"retries",
"=",
"self",
".",
"_req_rep_retry",
"(",
"LockerServer",
".",
"LOCK",
")",
"response",
"=",
"s... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | LockerClient.release | Releases lock | pypet/utils/mpwrappers.py | def release(self):
"""Releases lock"""
# self.start(test_connection=False)
str_response, retries = self._req_rep_retry(LockerServer.UNLOCK)
response = str_response.split(LockerServer.DELIMITER)
if response[0] == LockerServer.RELEASED:
pass # Everything is fine
... | def release(self):
"""Releases lock"""
# self.start(test_connection=False)
str_response, retries = self._req_rep_retry(LockerServer.UNLOCK)
response = str_response.split(LockerServer.DELIMITER)
if response[0] == LockerServer.RELEASED:
pass # Everything is fine
... | [
"Releases",
"lock"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L458-L469 | [
"def",
"release",
"(",
"self",
")",
":",
"# self.start(test_connection=False)",
"str_response",
",",
"retries",
"=",
"self",
".",
"_req_rep_retry",
"(",
"LockerServer",
".",
"UNLOCK",
")",
"response",
"=",
"str_response",
".",
"split",
"(",
"LockerServer",
".",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | QueuingServerMessageListener.listen | Handles listening requests from the client.
There are 4 types of requests:
1- Check space in the queue
2- Tests the socket
3- If there is a space, it sends data
4- after data is sent, puts it to queue for storing | pypet/utils/mpwrappers.py | def listen(self):
""" Handles listening requests from the client.
There are 4 types of requests:
1- Check space in the queue
2- Tests the socket
3- If there is a space, it sends data
4- after data is sent, puts it to queue for storing
"""
count = 0
... | def listen(self):
""" Handles listening requests from the client.
There are 4 types of requests:
1- Check space in the queue
2- Tests the socket
3- If there is a space, it sends data
4- after data is sent, puts it to queue for storing
"""
count = 0
... | [
"Handles",
"listening",
"requests",
"from",
"the",
"client",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L493-L537 | [
"def",
"listen",
"(",
"self",
")",
":",
"count",
"=",
"0",
"self",
".",
"_start",
"(",
")",
"while",
"True",
":",
"result",
"=",
"self",
".",
"_socket",
".",
"recv_pyobj",
"(",
")",
"if",
"isinstance",
"(",
"result",
",",
"tuple",
")",
":",
"reques... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | QueuingClient.put | If there is space it sends data to server
If no space in the queue
It returns the request in every 10 millisecond
until there will be space in the queue. | pypet/utils/mpwrappers.py | def put(self, data, block=True):
""" If there is space it sends data to server
If no space in the queue
It returns the request in every 10 millisecond
until there will be space in the queue.
"""
self.start(test_connection=False)
while True:
respon... | def put(self, data, block=True):
""" If there is space it sends data to server
If no space in the queue
It returns the request in every 10 millisecond
until there will be space in the queue.
"""
self.start(test_connection=False)
while True:
respon... | [
"If",
"there",
"is",
"space",
"it",
"sends",
"data",
"to",
"server"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L564-L582 | [
"def",
"put",
"(",
"self",
",",
"data",
",",
"block",
"=",
"True",
")",
":",
"self",
".",
"start",
"(",
"test_connection",
"=",
"False",
")",
"while",
"True",
":",
"response",
"=",
"self",
".",
"_req_rep",
"(",
"QueuingServerMessageListener",
".",
"SPACE... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ForkDetector._detect_fork | Detects if lock client was forked.
Forking is detected by comparing the PID of the current
process with the stored PID. | pypet/utils/mpwrappers.py | def _detect_fork(self):
"""Detects if lock client was forked.
Forking is detected by comparing the PID of the current
process with the stored PID.
"""
if self._pid is None:
self._pid = os.getpid()
if self._context is not None:
current_pid = os.ge... | def _detect_fork(self):
"""Detects if lock client was forked.
Forking is detected by comparing the PID of the current
process with the stored PID.
"""
if self._pid is None:
self._pid = os.getpid()
if self._context is not None:
current_pid = os.ge... | [
"Detects",
"if",
"lock",
"client",
"was",
"forked",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L589-L604 | [
"def",
"_detect_fork",
"(",
"self",
")",
":",
"if",
"self",
".",
"_pid",
"is",
"None",
":",
"self",
".",
"_pid",
"=",
"os",
".",
"getpid",
"(",
")",
"if",
"self",
".",
"_context",
"is",
"not",
"None",
":",
"current_pid",
"=",
"os",
".",
"getpid",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ForkAwareLockerClient.start | Checks for forking and starts/restarts if desired | pypet/utils/mpwrappers.py | def start(self, test_connection=True):
"""Checks for forking and starts/restarts if desired"""
self._detect_fork()
super(ForkAwareLockerClient, self).start(test_connection) | def start(self, test_connection=True):
"""Checks for forking and starts/restarts if desired"""
self._detect_fork()
super(ForkAwareLockerClient, self).start(test_connection) | [
"Checks",
"for",
"forking",
"and",
"starts",
"/",
"restarts",
"if",
"desired"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L644-L647 | [
"def",
"start",
"(",
"self",
",",
"test_connection",
"=",
"True",
")",
":",
"self",
".",
"_detect_fork",
"(",
")",
"super",
"(",
"ForkAwareLockerClient",
",",
"self",
")",
".",
"start",
"(",
"test_connection",
")"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | QueueStorageServiceSender._put_on_queue | Puts data on queue | pypet/utils/mpwrappers.py | def _put_on_queue(self, to_put):
"""Puts data on queue"""
old = self.pickle_queue
self.pickle_queue = False
try:
self.queue.put(to_put, block=True)
finally:
self.pickle_queue = old | def _put_on_queue(self, to_put):
"""Puts data on queue"""
old = self.pickle_queue
self.pickle_queue = False
try:
self.queue.put(to_put, block=True)
finally:
self.pickle_queue = old | [
"Puts",
"data",
"on",
"queue"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L678-L685 | [
"def",
"_put_on_queue",
"(",
"self",
",",
"to_put",
")",
":",
"old",
"=",
"self",
".",
"pickle_queue",
"self",
".",
"pickle_queue",
"=",
"False",
"try",
":",
"self",
".",
"queue",
".",
"put",
"(",
"to_put",
",",
"block",
"=",
"True",
")",
"finally",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | PipeStorageServiceSender._put_on_pipe | Puts data on queue | pypet/utils/mpwrappers.py | def _put_on_pipe(self, to_put):
"""Puts data on queue"""
self.acquire_lock()
self._send_chunks(to_put)
self.release_lock() | def _put_on_pipe(self, to_put):
"""Puts data on queue"""
self.acquire_lock()
self._send_chunks(to_put)
self.release_lock() | [
"Puts",
"data",
"on",
"queue"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L745-L749 | [
"def",
"_put_on_pipe",
"(",
"self",
",",
"to_put",
")",
":",
"self",
".",
"acquire_lock",
"(",
")",
"self",
".",
"_send_chunks",
"(",
"to_put",
")",
"self",
".",
"release_lock",
"(",
")"
] | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | StorageServiceDataHandler._handle_data | Handles data and returns `True` or `False` if everything is done. | pypet/utils/mpwrappers.py | def _handle_data(self, msg, args, kwargs):
"""Handles data and returns `True` or `False` if everything is done."""
stop = False
try:
if msg == 'DONE':
stop = True
elif msg == 'STORE':
if 'msg' in kwargs:
store_msg = kwar... | def _handle_data(self, msg, args, kwargs):
"""Handles data and returns `True` or `False` if everything is done."""
stop = False
try:
if msg == 'DONE':
stop = True
elif msg == 'STORE':
if 'msg' in kwargs:
store_msg = kwar... | [
"Handles",
"data",
"and",
"returns",
"True",
"or",
"False",
"if",
"everything",
"is",
"done",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L820-L855 | [
"def",
"_handle_data",
"(",
"self",
",",
"msg",
",",
"args",
",",
"kwargs",
")",
":",
"stop",
"=",
"False",
"try",
":",
"if",
"msg",
"==",
"'DONE'",
":",
"stop",
"=",
"True",
"elif",
"msg",
"==",
"'STORE'",
":",
"if",
"'msg'",
"in",
"kwargs",
":",
... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | StorageServiceDataHandler.run | Starts listening to the queue. | pypet/utils/mpwrappers.py | def run(self):
"""Starts listening to the queue."""
try:
while True:
msg, args, kwargs = self._receive_data()
stop = self._handle_data(msg, args, kwargs)
if stop:
break
finally:
if self._storage_service.i... | def run(self):
"""Starts listening to the queue."""
try:
while True:
msg, args, kwargs = self._receive_data()
stop = self._handle_data(msg, args, kwargs)
if stop:
break
finally:
if self._storage_service.i... | [
"Starts",
"listening",
"to",
"the",
"queue",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L857-L868 | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"while",
"True",
":",
"msg",
",",
"args",
",",
"kwargs",
"=",
"self",
".",
"_receive_data",
"(",
")",
"stop",
"=",
"self",
".",
"_handle_data",
"(",
"msg",
",",
"args",
",",
"kwargs",
")",
"if",
"s... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | QueueStorageServiceWriter._receive_data | Gets data from queue | pypet/utils/mpwrappers.py | def _receive_data(self):
"""Gets data from queue"""
result = self.queue.get(block=True)
if hasattr(self.queue, 'task_done'):
self.queue.task_done()
return result | def _receive_data(self):
"""Gets data from queue"""
result = self.queue.get(block=True)
if hasattr(self.queue, 'task_done'):
self.queue.task_done()
return result | [
"Gets",
"data",
"from",
"queue"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L882-L887 | [
"def",
"_receive_data",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"queue",
".",
"get",
"(",
"block",
"=",
"True",
")",
"if",
"hasattr",
"(",
"self",
".",
"queue",
",",
"'task_done'",
")",
":",
"self",
".",
"queue",
".",
"task_done",
"(",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | PipeStorageServiceWriter._receive_data | Gets data from pipe | pypet/utils/mpwrappers.py | def _receive_data(self):
"""Gets data from pipe"""
while True:
while len(self._buffer) < self.max_size and self.conn.poll():
data = self._read_chunks()
if data is not None:
self._buffer.append(data)
if len(self._buffer) > 0:
... | def _receive_data(self):
"""Gets data from pipe"""
while True:
while len(self._buffer) < self.max_size and self.conn.poll():
data = self._read_chunks()
if data is not None:
self._buffer.append(data)
if len(self._buffer) > 0:
... | [
"Gets",
"data",
"from",
"pipe"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L931-L939 | [
"def",
"_receive_data",
"(",
"self",
")",
":",
"while",
"True",
":",
"while",
"len",
"(",
"self",
".",
"_buffer",
")",
"<",
"self",
".",
"max_size",
"and",
"self",
".",
"conn",
".",
"poll",
"(",
")",
":",
"data",
"=",
"self",
".",
"_read_chunks",
"... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | LockWrapper.store | Acquires a lock before storage and releases it afterwards. | pypet/utils/mpwrappers.py | def store(self, *args, **kwargs):
"""Acquires a lock before storage and releases it afterwards."""
try:
self.acquire_lock()
return self._storage_service.store(*args, **kwargs)
finally:
if self.lock is not None:
try:
self.rel... | def store(self, *args, **kwargs):
"""Acquires a lock before storage and releases it afterwards."""
try:
self.acquire_lock()
return self._storage_service.store(*args, **kwargs)
finally:
if self.lock is not None:
try:
self.rel... | [
"Acquires",
"a",
"lock",
"before",
"storage",
"and",
"releases",
"it",
"afterwards",
"."
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L982-L992 | [
"def",
"store",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"acquire_lock",
"(",
")",
"return",
"self",
".",
"_storage_service",
".",
"store",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"finally",... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
test | ReferenceWrapper.store | Simply keeps a reference to the stored data | pypet/utils/mpwrappers.py | def store(self, msg, stuff_to_store, *args, **kwargs):
"""Simply keeps a reference to the stored data """
trajectory_name = kwargs['trajectory_name']
if trajectory_name not in self.references:
self.references[trajectory_name] = []
self.references[trajectory_name].append((msg,... | def store(self, msg, stuff_to_store, *args, **kwargs):
"""Simply keeps a reference to the stored data """
trajectory_name = kwargs['trajectory_name']
if trajectory_name not in self.references:
self.references[trajectory_name] = []
self.references[trajectory_name].append((msg,... | [
"Simply",
"keeps",
"a",
"reference",
"to",
"the",
"stored",
"data"
] | SmokinCaterpillar/pypet | python | https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/mpwrappers.py#L1017-L1022 | [
"def",
"store",
"(",
"self",
",",
"msg",
",",
"stuff_to_store",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"trajectory_name",
"=",
"kwargs",
"[",
"'trajectory_name'",
"]",
"if",
"trajectory_name",
"not",
"in",
"self",
".",
"references",
":",
"s... | 97ad3e80d46dbdea02deeb98ea41f05a19565826 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.