summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/pmt/pmt_to_python.py
diff options
context:
space:
mode:
authorMarcus Müller <marcus@hostalia.de>2014-04-07 22:06:05 +0200
committerMarcus Müller <marcus@hostalia.de>2014-04-07 22:06:05 +0200
commitac33347c3e685b25be611d4405521e36310852a8 (patch)
tree5716519b465ced8ebac6cf38d1c9a5972d2763a8 /gnuradio-runtime/python/pmt/pmt_to_python.py
parentc201f977d25c5df0834ce2486b707e3df22a4f95 (diff)
renamed and cleaned up a bit
Diffstat (limited to 'gnuradio-runtime/python/pmt/pmt_to_python.py')
-rw-r--r--gnuradio-runtime/python/pmt/pmt_to_python.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/gnuradio-runtime/python/pmt/pmt_to_python.py b/gnuradio-runtime/python/pmt/pmt_to_python.py
index 83b209de1a..3344eba163 100644
--- a/gnuradio-runtime/python/pmt/pmt_to_python.py
+++ b/gnuradio-runtime/python/pmt/pmt_to_python.py
@@ -63,7 +63,6 @@ def pmt_from_dict(p):
d = pmt.dict_add(d, python_to_pmt(k), python_to_pmt(v))
return d
- #(numpy.float32,pmt.init_f32vector, float, pmt.f32vector_elements, pmt.is_f32vector),
numpy_mappings = {
numpy.dtype(numpy.float32): (pmt.init_f32vector, float, pmt.f32vector_elements, pmt.is_f32vector),
numpy.dtype(numpy.float64): (pmt.init_f64vector, float, pmt.f64vector_elements, pmt.is_f64vector),
@@ -99,7 +98,7 @@ def uvector_to_numpy(uvector):
else:
raise ValueError("unsupported uvector data type for conversion to numpy array %s"%(uvector))
-THE_TABLE = ( #python type, check pmt type, to python, from python
+type_mappings = ( #python type, check pmt type, to python, from python
(None, pmt.is_null, lambda x: None, lambda x: pmt.PMT_NIL),
(bool, pmt.is_bool, pmt.to_bool, pmt.from_bool),
(str, pmt.is_symbol, pmt.symbol_to_string, pmt.string_to_symbol),
@@ -115,12 +114,12 @@ THE_TABLE = ( #python type, check pmt type, to python, from python
)
def pmt_to_python(p):
- for python_type, pmt_check, to_python, from_python in THE_TABLE:
+ for python_type, pmt_check, to_python, from_python in type_mappings:
if pmt_check(p): return to_python(p)
raise ValueError("can't convert %s type to pmt (%s)"%(type(p),p))
def python_to_pmt(p):
- for python_type, pmt_check, to_python, from_python in THE_TABLE:
+ for python_type, pmt_check, to_python, from_python in type_mappings:
if python_type is None:
if p == None: return from_python(p)
elif isinstance(p, python_type): return from_python(p)