summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-06-23 19:01:34 +0200
committerAndrej Rode <mail@andrejro.de>2018-06-23 21:26:32 +0200
commitc40c0f3243711bbf25afdd0147d45f2e96b91c06 (patch)
tree7e739772ddc68f54d318a0fa2d1afde4afcdd429
parent5e07e65fe9350a51cd45f8f21cfa6bf144e42e1c (diff)
python: Py3k compat
-rw-r--r--gr-blocks/python/blocks/qa_socket_pdu.py4
-rw-r--r--gr-digital/python/digital/qa_scrambler.py4
-rwxr-xr-xgr-qtgui/apps/gr_constellation_plot2
-rwxr-xr-xgr-uhd/apps/uhd_fft8
-rwxr-xr-xgr-uhd/apps/uhd_rx_cfile6
-rwxr-xr-xgr-utils/python/utils/gr_plot_qt2
-rw-r--r--gr-utils/python/utils/plot_fft_base.py2
-rw-r--r--gr-utils/python/utils/plot_psd_base.py2
-rwxr-xr-xgr-zeromq/python/zeromq/qa_zeromq_sub.py4
9 files changed, 17 insertions, 17 deletions
diff --git a/gr-blocks/python/blocks/qa_socket_pdu.py b/gr-blocks/python/blocks/qa_socket_pdu.py
index 2e033491d3..961dc914ea 100644
--- a/gr-blocks/python/blocks/qa_socket_pdu.py
+++ b/gr-blocks/python/blocks/qa_socket_pdu.py
@@ -105,7 +105,7 @@ class qa_socket_pdu (gr_unittest.TestCase):
# Test that the TCP server can stream PDUs <= the MTU size.
port = str(random.Random().randint(0, 30000) + 10000)
mtu = 10000
- srcdata = tuple([x % 256 for x in xrange(mtu)])
+ srcdata = tuple(x % 256 for x in range(mtu))
data = pmt.init_u8vector(srcdata.__len__(), srcdata)
pdu_msg = pmt.cons(pmt.PMT_NIL, data)
@@ -125,7 +125,7 @@ class qa_socket_pdu (gr_unittest.TestCase):
received = self.pdu_sink.get_message(0)
received_data = pmt.cdr(received)
msg_data = []
- for i in xrange(mtu):
+ for i in range(mtu):
msg_data.append(pmt.u8vector_ref(received_data, i))
self.assertEqual(srcdata, tuple(msg_data))
diff --git a/gr-digital/python/digital/qa_scrambler.py b/gr-digital/python/digital/qa_scrambler.py
index 8de35e8ed0..93f77a9ef7 100644
--- a/gr-digital/python/digital/qa_scrambler.py
+++ b/gr-digital/python/digital/qa_scrambler.py
@@ -30,7 +30,7 @@ def additive_scramble_lfsr(mask, seed, reglen, bpb, data):
out = []
for d in data:
scramble_word = 0
- for i in xrange(0,bpb):
+ for i in range(0,bpb):
scramble_word ^= l.next_bit() << i
out.append(d ^ scramble_word)
return tuple(out)
@@ -122,7 +122,7 @@ class test_scrambler(gr_unittest.TestCase):
reset_tag3 = gr.tag_t()
reset_tag3.key = pmt.string_to_symbol(reset_tag_key)
reset_tag3.offset = 20
- src = blocks.vector_source_b(src_data * 3, False, 1, (reset_tag1, reset_tag2, reset_tag3))
+ src = blocks.vector_source_b([s * 3 for s in src_data], False, 1, (reset_tag1, reset_tag2, reset_tag3))
scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 0, 8, reset_tag_key)
dst = blocks.vector_sink_b()
self.tb.connect(src, scrambler, dst)
diff --git a/gr-qtgui/apps/gr_constellation_plot b/gr-qtgui/apps/gr_constellation_plot
index fe5bdb56df..8ca7104a61 100755
--- a/gr-qtgui/apps/gr_constellation_plot
+++ b/gr-qtgui/apps/gr_constellation_plot
@@ -168,7 +168,7 @@ def main():
tb = my_top_block(filelist, args.start, nsamples, max_nsamples);
main_box = plot_constellation_form(tb, 'GNU Radio Constellation Plot', 10000.0)
- for n in xrange(tb._nsigs):
+ for n in range(tb._nsigs):
main_box._style_edit[n].setCurrentIndex(0)
main_box.show()
diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft
index 4cb5eed0d1..777461fd63 100755
--- a/gr-uhd/apps/uhd_fft
+++ b/gr-uhd/apps/uhd_fft
@@ -218,7 +218,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_waterfall_sink_x_0.enable_grid(False)
self.qtgui_waterfall_sink_x_0.disable_legend()
alpha = 10.**(len(self.channels)-1)
- for i in xrange(len(self.channels)):
+ for i in range(len(self.channels)):
self.qtgui_waterfall_sink_x_0.set_line_label(i, "Channel {0}".format(i))
self.qtgui_waterfall_sink_x_0.set_color_map(i, 0)
self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alpha)
@@ -240,7 +240,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_time_sink_x_0.enable_grid(False)
self.qtgui_time_sink_x_0.enable_control_panel(True)
self.qtgui_time_sink_x_0.disable_legend()
- for i in xrange(2*len(self.channels)):
+ for i in range(2*len(self.channels)):
if(i % 2 == 0):
self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Channel {0}}}".format(i/2))
else:
@@ -268,7 +268,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_freq_sink_x_0.set_fft_average(self.fft_average)
self.qtgui_freq_sink_x_0.enable_control_panel(True)
self.qtgui_freq_sink_x_0.disable_legend()
- for i in xrange(len(self.channels)):
+ for i in range(len(self.channels)):
self.qtgui_freq_sink_x_0.set_line_label(i, "Channel {0}".format(i))
self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
@@ -305,7 +305,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_phase_plot.enable_grid(True)
self.qtgui_phase_plot.enable_control_panel(True)
self.qtgui_phase_plot.disable_legend()
- for i in xrange(len(self.channels) - 1):
+ for i in range(len(self.channels) - 1):
self.qtgui_phase_plot.set_line_label(i, "Phase Delta Channels {0}/{1}".format(i, i+1))
self.qtgui_phase_plot.set_line_width(i, widths[i])
self.qtgui_phase_plot.set_line_color(i, colors[i])
diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile
index 2a1ed0fcb5..d41027ff39 100755
--- a/gr-uhd/apps/uhd_rx_cfile
+++ b/gr-uhd/apps/uhd_rx_cfile
@@ -79,7 +79,7 @@ class rx_cfile_block(gr.top_block):
)
# Set the subdevice spec:
if options.spec:
- for mb_idx in xrange(self._u.get_num_mboards()):
+ for mb_idx in range(self._u.get_num_mboards()):
self._u.set_subdev_spec(options.spec, mb_idx)
# Set the antenna:
if options.antenna is not None:
@@ -125,7 +125,7 @@ class rx_cfile_block(gr.top_block):
self._u.set_time_unknown_pps(uhd.time_spec())
cmd_time = self._u.get_time_now() + uhd.time_spec(COMMAND_DELAY)
try:
- for mb_idx in xrange(self._u.get_num_mboards()):
+ for mb_idx in range(self._u.get_num_mboards()):
self._u.set_command_time(cmd_time, mb_idx)
command_time_set = True
except RuntimeError:
@@ -136,7 +136,7 @@ class rx_cfile_block(gr.top_block):
sys.stderr.write('[UHD_RX] [ERROR] Failed to set center frequency on channel {chan}\n'.format(chan=chan))
exit(1)
if command_time_set:
- for mb_idx in xrange(self._u.get_num_mboards()):
+ for mb_idx in range(self._u.get_num_mboards()):
self._u.clear_command_time(mb_idx)
print("[UHD_RX] Syncing channels...")
time.sleep(COMMAND_DELAY)
diff --git a/gr-utils/python/utils/gr_plot_qt b/gr-utils/python/utils/gr_plot_qt
index cd2db87fd9..854ecc53b8 100755
--- a/gr-utils/python/utils/gr_plot_qt
+++ b/gr-utils/python/utils/gr_plot_qt
@@ -338,7 +338,7 @@ class gr_plot_qt(QtGui.QMainWindow):
tstep = 1.0 / self.sample_rate
self.iq = iq
- self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))]
+ self.time = [tstep*(self.position + i) for i in range(len(self.iq))]
self.set_file_pos_box(start, end)
except MemoryError:
diff --git a/gr-utils/python/utils/plot_fft_base.py b/gr-utils/python/utils/plot_fft_base.py
index c0651529ea..5040aefa87 100644
--- a/gr-utils/python/utils/plot_fft_base.py
+++ b/gr-utils/python/utils/plot_fft_base.py
@@ -93,7 +93,7 @@ class plot_fft_base(object):
self.iq_fft = self.dofft(self.iq)
tstep = 1.0 / self.sample_rate
- #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))])
+ #self.time = scipy.array([tstep*(self.position + i) for i in range(len(self.iq))])
self.time = scipy.array([tstep*(i) for i in range(len(self.iq))])
self.freq = self.calc_freq(self.time, self.sample_rate)
diff --git a/gr-utils/python/utils/plot_psd_base.py b/gr-utils/python/utils/plot_psd_base.py
index 7c5138be4d..0a0f3cab34 100644
--- a/gr-utils/python/utils/plot_psd_base.py
+++ b/gr-utils/python/utils/plot_psd_base.py
@@ -103,7 +103,7 @@ class plot_psd_base(object):
# returns a zero-length array
if(len(self.iq) > 0):
tstep = 1.0 / self.sample_rate
- #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))])
+ #self.time = scipy.array([tstep*(self.position + i) for i in range(len(self.iq))])
self.time = scipy.array([tstep*(i) for i in range(len(self.iq))])
self.iq_psd, self.freq = self.dopsd(self.iq)
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_sub.py b/gr-zeromq/python/zeromq/qa_zeromq_sub.py
index f916901ff7..d6006780dc 100755
--- a/gr-zeromq/python/zeromq/qa_zeromq_sub.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_sub.py
@@ -44,7 +44,7 @@ class qa_zeromq_sub (gr_unittest.TestCase):
def test_001 (self):
vlen = 10
- src_data = numpy.array(range(vlen)*100, 'float32')
+ src_data = numpy.array(range(vlen), 'float32')*100
zeromq_sub_source = zeromq.sub_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555")
sink = blocks.vector_sink_f(vlen)
self.tb.connect(zeromq_sub_source, sink)
@@ -60,7 +60,7 @@ class qa_zeromq_sub (gr_unittest.TestCase):
vlen = 10
# Construct multipart source data to publish
- raw_data = [numpy.array(range(vlen)*100, 'float32'), numpy.array(range(vlen, 2*vlen)*100, 'float32')]
+ raw_data = [numpy.array(range(vlen), 'float32')*100, numpy.array(range(vlen, 2*vlen), 'float32')*100]
src_data = [a.tostring() for a in raw_data]
zeromq_sub_source = zeromq.sub_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555")
sink = blocks.vector_sink_f(vlen)