summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/gr/gateway.py
diff options
context:
space:
mode:
authorMarcus Müller <marcus.mueller@ettus.com>2018-03-06 12:41:09 +0100
committerMarcus Müller <marcus@hostalia.de>2018-03-06 15:29:49 +0100
commit713629cce8d571570bc5f0f0db67c5a96d5ee071 (patch)
tree0c593df0033b5a109e15d8385a78797dbc27f6b7 /gnuradio-runtime/python/gnuradio/gr/gateway.py
parente635ae442132a7e3bab75796d2ac0b66bd289bdb (diff)
runtime: make py_io_signature iterable, hashable
This allows GRC to iterate the output signatures of epy blocks after switching over to py_io_signature. Fixes #1666.
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/gr/gateway.py')
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/gateway.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/gateway.py b/gnuradio-runtime/python/gnuradio/gr/gateway.py
index 8f4b930fd2..4498729825 100644
--- a/gnuradio-runtime/python/gnuradio/gr/gateway.py
+++ b/gnuradio-runtime/python/gnuradio/gr/gateway.py
@@ -101,7 +101,7 @@ class py_io_signature(object):
"""
self.__min_ports = min_ports
self.__max_ports = max_ports
- self.__types = map(numpy.dtype, type_list)
+ self.__types = tuple( numpy.dtype(t) for t in type_list )
def gr_io_signature(self):
"""
@@ -124,6 +124,15 @@ class py_io_signature(object):
return self.__types[:nports]
return self.__types + [self.__types[-1]]*(nports-ntypes)
+ def __iter__(self):
+ """
+ Return the iterator over the maximum ports type list.
+ """
+ return iter(self.port_types(self.__max_ports))
+
+ def __hash__(self):
+ return hash((self.__min_ports, self.__max_ports, self.__types))
+
########################################################################
# The guts that make this into a gr block
########################################################################