Changeset 2870
- Timestamp:
- 12/02/13 17:56:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/selector.py
r2340 r2870 1 1 import re 2 import string 2 3 from asap._asap import selector as _selector, srctype 3 4 from asap.utils import unique, _to_list … … 200 201 raise TypeError('Unknown row number type. Use lists of integers.') 201 202 203 def set_msselection_field(self, selection): 204 """ 205 """ 206 selection_list = map(string.strip, selection.split(',')) 207 query_list = list(self.generate_query(selection_list)) 208 query = 'SELECT FROM $1 WHERE ' + ' || '.join(query_list) 209 self._settaql(query) 210 211 def generate_query(self, selection_list): 212 for s in selection_list: 213 if re.match('.*\*.*', s): 214 #print '"%s" is pattern match using *'%(s) 215 yield 'SRCNAME == pattern(\'%s\')'%(s) 216 elif re.match('^<=?[0-9]*$', s): 217 #print '"%s" is ID selection using < or <='%(s) 218 elif re.match('^>=?[0-9]*$', s): 219 #print '"%s" is ID selection using > or >='%(s) 220 elif re.match('^[0-9]+~[0-9]+$', s): 221 #print '"%s" is ID selection using ~'%(s) 222 else: 223 #print '"%s" is exact match'%(s) 224 yield 'SRCNAME == pattern(\'%s\')'%(s) 225 202 226 def get_scans(self): 203 227 return list(self._getscans())
Note:
See TracChangeset
for help on using the changeset viewer.