summaryrefslogtreecommitdiff
path: root/grc/python/FlowGraph.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/python/FlowGraph.py')
-rw-r--r--grc/python/FlowGraph.py48
1 files changed, 35 insertions, 13 deletions
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py
index 376c2e337f..055488b314 100644
--- a/grc/python/FlowGraph.py
+++ b/grc/python/FlowGraph.py
@@ -35,10 +35,14 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def _eval(self, code, namespace, namespace_hash):
"""
Evaluate the code with the given namespace.
- @param code a string with python code
- @param namespace a dict representing the namespace
- @param namespace_hash a unique hash for the namespace
- @return the resultant object
+
+ Args:
+ code: a string with python code
+ namespace: a dict representing the namespace
+ namespace_hash: a unique hash for the namespace
+
+ Returns:
+ the resultant object
"""
if not code: raise Exception, 'Cannot evaluate empty statement.'
my_hash = hash(code) ^ namespace_hash
@@ -51,8 +55,12 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_io_signaturev(self, direction):
"""
Get a list of io signatures for this flow graph.
- @param direction a string of 'in' or 'out'
- @return a list of dicts with: type, label, vlen, size
+
+ Args:
+ direction: a string of 'in' or 'out'
+
+ Returns:
+ a list of dicts with: type, label, vlen, size
"""
sorted_pads = {
'in': self.get_pad_sources(),
@@ -72,7 +80,9 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_pad_sources(self):
"""
Get a list of pad source blocks sorted by id order.
- @return a list of pad source blocks in this flow graph
+
+ Returns:
+ a list of pad source blocks in this flow graph
"""
pads = filter(lambda b: b.get_key() == 'pad_source', self.get_enabled_blocks())
return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
@@ -80,7 +90,9 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_pad_sinks(self):
"""
Get a list of pad sink blocks sorted by id order.
- @return a list of pad sink blocks in this flow graph
+
+ Returns:
+ a list of pad sink blocks in this flow graph
"""
pads = filter(lambda b: b.get_key() == 'pad_sink', self.get_enabled_blocks())
return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
@@ -96,7 +108,9 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_imports(self):
"""
Get a set of all import statments in this flow graph namespace.
- @return a set of import statements
+
+ Returns:
+ a set of import statements
"""
imports = sum([block.get_imports() for block in self.get_enabled_blocks()], [])
imports = sorted(set(imports))
@@ -106,7 +120,9 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
"""
Get a list of all variables in this flow graph namespace.
Exclude paramterized variables.
- @return a sorted list of variable blocks in order of dependency (indep -> dep)
+
+ Returns:
+ a sorted list of variable blocks in order of dependency (indep -> dep)
"""
variables = filter(lambda b: _variable_matcher.match(b.get_key()), self.get_enabled_blocks())
return expr_utils.sort_objects(variables, lambda v: v.get_id(), lambda v: v.get_var_make())
@@ -114,7 +130,9 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def get_parameters(self):
"""
Get a list of all paramterized variables in this flow graph namespace.
- @return a list of paramterized variables
+
+ Returns:
+ a list of paramterized variables
"""
parameters = filter(lambda b: _parameter_matcher.match(b.get_key()), self.get_enabled_blocks())
return parameters
@@ -129,9 +147,13 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
def evaluate(self, expr):
"""
Evaluate the expression.
- @param expr the string expression
+
+ Args:
+ expr: the string expression
@throw Exception bad expression
- @return the evaluated data
+
+ Returns:
+ the evaluated data
"""
if self._renew_eval_ns:
self._renew_eval_ns = False