[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/12: pmt: support conversion of basic pmt
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/12: pmt: support conversion of basic pmt pairs to python |
Date: |
Fri, 23 May 2014 17:35:56 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit e99fdb1edc3778d9e007fb5896392d6090a05cdb
Author: Tim O'Shea <address@hidden>
Date: Wed May 14 23:05:43 2014 -0400
pmt: support conversion of basic pmt pairs to python
---
gnuradio-runtime/python/pmt/pmt_to_python.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gnuradio-runtime/python/pmt/pmt_to_python.py
b/gnuradio-runtime/python/pmt/pmt_to_python.py
index 3344eba..8973b88 100644
--- a/gnuradio-runtime/python/pmt/pmt_to_python.py
+++ b/gnuradio-runtime/python/pmt/pmt_to_python.py
@@ -110,12 +110,17 @@ type_mappings = ( #python type, check pmt type, to
python, from python
(tuple, pmt.is_tuple, pmt_to_tuple, pmt_from_tuple),
(list, pmt.is_vector, pmt_to_vector, pmt_from_vector),
(dict, pmt.is_dict, pmt_to_dict, pmt_from_dict),
+ (tuple, pmt.is_pair, lambda x: (pmt_to_python(pmt.car(x)),
pmt_to_python(pmt.cdr(x))), lambda x: pmt.cons(python_to_pmt(x[0]),
python_to_pmt(x[1]))),
(numpy.ndarray, pmt.is_uniform_vector, uvector_to_numpy, numpy_to_uvector),
)
def pmt_to_python(p):
for python_type, pmt_check, to_python, from_python in type_mappings:
- if pmt_check(p): return to_python(p)
+ if pmt_check(p):
+ try:
+ return to_python(p)
+ except:
+ pass
raise ValueError("can't convert %s type to pmt (%s)"%(type(p),p))
def python_to_pmt(p):
- [Commit-gnuradio] [gnuradio] branch master updated (cba2d18 -> 5cb67ce), git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 10/12: Merge branch 'maint', git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 04/12: blocks: Added tsb_vector_sinks, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 07/12: runtime: Added packet_utils and marked tagged_streams.py for removal in future, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 05/12: blocks: updated some QAs to use proper tsb functions, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 06/12: digital: updated some QAs to use proper tsb functions, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 11/12: Merge remote-tracking branch 'martin/tsb/prep_for_38', git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 08/12: uhd: Nicer labels for device args and addres in GRC, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 09/12: Merge branch 'uint64_sugar' of git://github.com/osh/gnuradio, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 02/12: pmt: support conversion of basic pmt pairs to python,
git <=
- [Commit-gnuradio] [gnuradio] 01/12: pmt: adding uint64 sugar, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 03/12: pmt: making uint64_t sugar more friendly, git, 2014/05/23
- [Commit-gnuradio] [gnuradio] 12/12: Merge remote-tracking branch 'martin/uhd/clearer_grc_args', git, 2014/05/23