summaryrefslogtreecommitdiff
path: root/grc/core/generator/FlowGraphProxy.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-06-03 10:02:36 +0200
committerSebastian Koslowski <koslowski@kit.edu>2016-06-09 14:47:35 +0200
commit94c4606edd30dc8b1278580782f2809b69f04641 (patch)
tree6b7aa37b42f406c13d44b861aaf49ff54e9bb89b /grc/core/generator/FlowGraphProxy.py
parent438dbd8839ad4c9079c5b8c2573bd9009b2b2e51 (diff)
grc: py3k compat using python-modernize
Diffstat (limited to 'grc/core/generator/FlowGraphProxy.py')
-rw-r--r--grc/core/generator/FlowGraphProxy.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/grc/core/generator/FlowGraphProxy.py b/grc/core/generator/FlowGraphProxy.py
index 3723005576..c673c5b005 100644
--- a/grc/core/generator/FlowGraphProxy.py
+++ b/grc/core/generator/FlowGraphProxy.py
@@ -16,6 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+from __future__ import absolute_import
+from six.moves import range
+
+
class FlowGraphProxy(object):
def __init__(self, fg):
@@ -34,7 +38,7 @@ class FlowGraphProxy(object):
Returns:
a list of dicts with: type, label, vlen, size, optional
"""
- return filter(lambda p: p['type'] != "message", self.get_hier_block_io(direction))
+ return [p for p in self.get_hier_block_io(direction) if p['type'] != "message"]
def get_hier_block_message_io(self, direction):
"""
@@ -46,7 +50,7 @@ class FlowGraphProxy(object):
Returns:
a list of dicts with: type, label, vlen, size, optional
"""
- return filter(lambda p: p['type'] == "message", self.get_hier_block_io(direction))
+ return [p for p in self.get_hier_block_io(direction) if p['type'] == "message"]
def get_hier_block_io(self, direction):
"""
@@ -71,7 +75,7 @@ class FlowGraphProxy(object):
}
num_ports = pad.get_param('num_streams').get_evaluated()
if num_ports > 1:
- for i in xrange(num_ports):
+ for i in range(num_ports):
clone = master.copy()
clone['label'] += str(i)
ports.append(clone)
@@ -86,7 +90,7 @@ class FlowGraphProxy(object):
Returns:
a list of pad source blocks in this flow graph
"""
- pads = filter(lambda b: b.get_key() == 'pad_source', self.get_enabled_blocks())
+ pads = [b for b in self.get_enabled_blocks() if b.get_key() == 'pad_source']
return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
def get_pad_sinks(self):
@@ -96,7 +100,7 @@ class FlowGraphProxy(object):
Returns:
a list of pad sink blocks in this flow graph
"""
- pads = filter(lambda b: b.get_key() == 'pad_sink', self.get_enabled_blocks())
+ pads = [b for b in self.get_enabled_blocks() if b.get_key() == 'pad_sink']
return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
def get_pad_port_global_key(self, port):
@@ -123,4 +127,4 @@ class FlowGraphProxy(object):
# assuming we have either only sources or sinks
if not is_message_pad:
key_offset += len(pad.get_ports())
- return -1 \ No newline at end of file
+ return -1