summaryrefslogtreecommitdiff
path: root/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
diff options
context:
space:
mode:
authormormj <mormjb@gmail.com>2020-10-30 10:59:50 -0400
committerMarcus Müller <marcus@hostalia.de>2020-10-30 17:52:53 +0100
commit7a0948ba85758fba1cc3858ef99bfa600dcc7416 (patch)
tree610d7f9d773a193562def6df2d4b50f1bb3b3f86 /gr-blocks/python/blocks/qa_cpp_py_binding_set.py
parent12192ee7d58de95ddca35a3e93bfc172bdb5c820 (diff)
qa: run autopep8 formatting on qa python files
find ./ -iname qa*.py | xargs autopep8 --in-place -a -a mostly formats whitespace and gets rid of trailing semicolons
Diffstat (limited to 'gr-blocks/python/blocks/qa_cpp_py_binding_set.py')
-rw-r--r--gr-blocks/python/blocks/qa_cpp_py_binding_set.py50
1 files changed, 29 insertions, 21 deletions
diff --git a/gr-blocks/python/blocks/qa_cpp_py_binding_set.py b/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
index 6377d05b95..c404669cc3 100644
--- a/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
+++ b/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
@@ -13,29 +13,36 @@
#
-import sys, time, random, numpy, re
+import sys
+import time
+import random
+import numpy
+import re
from gnuradio import gr, gr_unittest, blocks
from gnuradio.ctrlport import GNURadio
from gnuradio import ctrlport
import os
+
class inc_class(object):
- def __init__(self,val):
- self.val = val;
+ def __init__(self, val):
+ self.val = val
def _get(self):
- #print "returning get (val = %s)"%(str(self.val));
- return self.val;
+ # print "returning get (val = %s)"%(str(self.val));
+ return self.val
+
+ def _set(self, val):
+ # print "updating val to %s"%(str(val));
+ self.val = val
+ return
+
- def _set(self,val):
- #print "updating val to %s"%(str(val));
- self.val = val;
- return;
+getset1 = inc_class(10)
+getset2 = inc_class(100.0)
+getset3 = inc_class("test")
-getset1 = inc_class(10);
-getset2 = inc_class(100.0);
-getset3 = inc_class("test");
class test_cpp_py_binding_set(gr_unittest.TestCase):
def setUp(self):
@@ -48,12 +55,12 @@ class test_cpp_py_binding_set(gr_unittest.TestCase):
def test_001(self):
g1 = gr.RPC_get_int("pyland", "v1", "unit_1_int",
- "Python Exported Int", 0, 100, 10,
- gr.DISPNULL)
+ "Python Exported Int", 0, 100, 10,
+ gr.DISPNULL)
g1.activate(getset1._get)
s1 = gr.RPC_get_int("pyland", "v1", "unit_1_int",
- "Python Exported Int", 0, 100, 10,
- gr.DISPNULL)
+ "Python Exported Int", 0, 100, 10,
+ gr.DISPNULL)
s1.activate(getset1._set)
time.sleep(0.01)
@@ -95,13 +102,12 @@ class test_cpp_py_binding_set(gr_unittest.TestCase):
rval = g3.get()
self.assertEqual(val, rval)
-
def test_002(self):
data = list(range(1, 10))
self.src = blocks.vector_source_c(data, True)
self.p = blocks.nop(gr.sizeof_gr_complex)
- self.p.set_ctrlport_test(0);
+ self.p.set_ctrlport_test(0)
probe_info = self.p.alias()
self.tb.connect(self.src, self.p)
@@ -113,7 +119,8 @@ class test_cpp_py_binding_set(gr_unittest.TestCase):
# Initialize a simple ControlPort client from endpoint
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
- radiosys = GNURadioControlPortClient(hostname, portnum, rpcmethod='thrift')
+ radiosys = GNURadioControlPortClient(
+ hostname, portnum, rpcmethod='thrift')
radio = radiosys.client
self.tb.start()
@@ -122,8 +129,8 @@ class test_cpp_py_binding_set(gr_unittest.TestCase):
time.sleep(0.1)
# Get all exported knobs
- key_name_test = probe_info+"::test"
- ret = radio.getKnobs([key_name_test,])
+ key_name_test = probe_info + "::test"
+ ret = radio.getKnobs([key_name_test, ])
ret[key_name_test].value = 10
radio.setKnobs({key_name_test: ret[key_name_test]})
@@ -135,5 +142,6 @@ class test_cpp_py_binding_set(gr_unittest.TestCase):
self.tb.stop()
self.tb.wait()
+
if __name__ == '__main__':
gr_unittest.run(test_cpp_py_binding_set)