Changeset 9775
- Timestamp:
- 10/10/08 21:45:09
- Files:
-
- gnuradio/trunk/grc/src/platforms/python/Param.py (modified) (6 diffs)
- gnuradio/trunk/grc/todo.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/trunk/grc/src/platforms/python/Param.py
r9584 r9775 21 21 from .. base.Param import Param as _Param 22 22 import Constants 23 import numpy 23 24 import os 25 26 #define types, native python + numpy 27 VECTOR_TYPES = (tuple, list, set, numpy.ndarray) 28 COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128] 29 REAL_TYPES = [float, numpy.float, numpy.float32, numpy.float64] 30 INT_TYPES = [int, long, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.uint64, 31 numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64] 32 #cast to tuple for isinstance, concat subtypes 33 COMPLEX_TYPES = tuple(COMPLEX_TYPES + REAL_TYPES + INT_TYPES) 34 REAL_TYPES = tuple(REAL_TYPES + INT_TYPES) 35 INT_TYPES = tuple(INT_TYPES) 24 36 25 37 class Param(_Param): … … 115 127 if t == 'raw': return e 116 128 elif t == 'complex': 117 try: assert(isinstance(e, (complex, float, int, long)))129 try: assert(isinstance(e, COMPLEX_TYPES)) 118 130 except AssertionError: 119 131 self._add_error_message('Expression "%s" is invalid for type complex.'%str(e)) … … 121 133 return e 122 134 elif t == 'real': 123 try: assert(isinstance(e, (float, int, long)))135 try: assert(isinstance(e, REAL_TYPES)) 124 136 except AssertionError: 125 137 self._add_error_message('Expression "%s" is invalid for type real.'%str(e)) … … 127 139 return e 128 140 elif t == 'int': 129 try: assert(isinstance(e, (int, long)))141 try: assert(isinstance(e, INT_TYPES)) 130 142 except AssertionError: 131 143 self._add_error_message('Expression "%s" is invalid for type integer.'%str(e)) 132 144 raise Exception 133 145 return e 146 ######################### 147 # Numeric Vector Types 148 ######################### 134 149 elif t == 'complex_vector': 135 if not isinstance(e, (tuple, list, set)):150 if not isinstance(e, VECTOR_TYPES): 136 151 self._lisitify_flag = True 137 152 e = [e] 138 153 try: 139 154 for ei in e: 140 assert(isinstance(ei, (complex, float, int, long)))155 assert(isinstance(ei, COMPLEX_TYPES)) 141 156 except AssertionError: 142 157 self._add_error_message('Expression "%s" is invalid for type complex vector.'%str(e)) … … 144 159 return e 145 160 elif t == 'real_vector': 146 if not isinstance(e, (tuple, list, set)):161 if not isinstance(e, VECTOR_TYPES): 147 162 self._lisitify_flag = True 148 163 e = [e] 149 164 try: 150 165 for ei in e: 151 assert(isinstance(ei, (float, int, long)))166 assert(isinstance(ei, REAL_TYPES)) 152 167 except AssertionError: 153 168 self._add_error_message('Expression "%s" is invalid for type real vector.'%str(e)) … … 155 170 return e 156 171 elif t == 'int_vector': 157 if not isinstance(e, (tuple, list, set)):172 if not isinstance(e, VECTOR_TYPES): 158 173 self._lisitify_flag = True 159 174 e = [e] 160 175 try: 161 176 for ei in e: 162 assert(isinstance(ei, (int, long)))177 assert(isinstance(ei, INT_TYPES)) 163 178 except AssertionError: 164 179 self._add_error_message('Expression "%s" is invalid for type integer vector.'%str(e)) gnuradio/trunk/grc/todo.txt
r9772 r9775 5 5 -ofdm wrappers 6 6 -controlled step block 7 -throttle with sink only (source is nulled)8 7 -simplify simple usrp 9 -numbersink: update wrapper for newer api10 8 -probe: also non-float outputs 11 9 … … 23 21 -click and drag on whitespace to scroll 24 22 -expand preferences, allow for custom prefs, prefs dialog should infer structure 23 -drag connection to delete it 25 24 26 25 ##################################################
