diff options
author | Marcus Müller <marcus@hostalia.de> | 2018-08-31 23:02:22 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-08-31 23:02:22 +0200 |
commit | 254fe5e89403d4de1fa6663d09efdf946996aff3 (patch) | |
tree | 62877d7ac7fdedf6c397c51e22ac6f97eba97ddf /gnuradio-runtime/python/gnuradio/eng_option.py | |
parent | 896d1c9da31963ecf5b0d90942c2af51ca998a69 (diff) | |
parent | 5ad935c3a3dd46ce2860b13e2b774e4841784616 (diff) |
Merge remote-tracking branch 'origin/next' into merge_next
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/eng_option.py')
-rw-r--r-- | gnuradio-runtime/python/gnuradio/eng_option.py | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/gnuradio-runtime/python/gnuradio/eng_option.py b/gnuradio-runtime/python/gnuradio/eng_option.py index 5d8660f0f2..565780be28 100644 --- a/gnuradio-runtime/python/gnuradio/eng_option.py +++ b/gnuradio-runtime/python/gnuradio/eng_option.py @@ -20,10 +20,12 @@ # '''Add support for engineering notation to optparse.OptionParser''' +from __future__ import absolute_import +from __future__ import unicode_literals from copy import copy from optparse import Option, OptionValueError -import eng_notation +from . import eng_notation def check_eng_float (option, opt, value): try: @@ -39,25 +41,9 @@ def check_intx (option, opt, value): raise OptionValueError ( "option %s: invalid integer value: %r" % (opt, value)) -def check_subdev (option, opt, value): - """ - Value has the form: (A|B)(:0|1)? - - Returns: - a 2-tuple (0|1, 0|1) - """ - d = { 'A' : (0, 0), 'A:0' : (0, 0), 'A:1' : (0, 1), 'A:2' : (0, 2), - 'B' : (1, 0), 'B:0' : (1, 0), 'B:1' : (1, 1), 'B:2' : (1, 2) } - try: - return d[value.upper()] - except: - raise OptionValueError( - "option %s: invalid subdev: '%r', must be one of %s" % (opt, value, ', '.join(sorted(d.keys())))) - class eng_option (Option): TYPES = Option.TYPES + ("eng_float", "intx", "subdev") TYPE_CHECKER = copy (Option.TYPE_CHECKER) TYPE_CHECKER["eng_float"] = check_eng_float TYPE_CHECKER["intx"] = check_intx - TYPE_CHECKER["subdev"] = check_subdev |