PEATDB/Search.py
def searchfunc(self, col, attr, val, op):
        """Simple search for strings, attr is always the string itself,
           so it can be passed as empty"""
        floatops = ['=','>','<']
        func = self.funcs[op]
        data = self.data
        names=[]
        for rec in self.reclist:
            if data[rec].has_key(col):
                #try to do numerical comparisons if required
                if op in floatops:
                    try:
                        item = float(data[rec][col])
                        v=float(val)
                        if func(v, item) == True:
                            names.append(rec)
                        continue
                    except:
                        pass
                if col == 'name':
                    item = rec
                else:
                    item = str(data[rec][col])
                if func(val, item):
                    names.append(rec)
        return names
Simple search for strings, attr is always the string itself,
           so it can be passed as empty
Simple search for strings, attr is always the string itself,
so it can be passed as empty
Simple search for strings attr is always the string itself so it can be passed as empty
def searchfunc(self, col, attr, val, op):
        floatops = ['=','>','<']
        func = self.funcs[op]
        data = self.data
        names=[]
        for rec in self.reclist:
            if data[rec].has_key(col):
                if op in floatops:
                    try:
                        item = float(data[rec][col])
                        v=float(val)
                        if func(v, item) == True:
                            names.append(rec)
                        continue
                    except:
                        pass
                if col == 'name':
                    item = rec
                else:
                    item = str(data[rec][col])
                if func(val, item):
                    names.append(rec)
        return names
def searchfunc ( self , col , attr , val , op ) : floatops = [ '=' , '>' , '<' ] func = self . funcs [ op ] data = self . data names = [ ] for rec in self . reclist : if data [ rec ] . has_key ( col ) : if op in floatops : try : item = float ( data [ rec ] [ col ] ) v = float ( val ) if func ( v , item ) == True : names . append ( rec ) continue except : pass if col == 'name' : item = rec else : item = str ( data [ rec ] [ col ] ) if func ( val , item ) : names . append ( rec ) return names
Simple search for strings, attr is always the string itself,
so it can be passed as empty
Simple search for strings attr is always the string itself so it can be passed as empty
"""Simple search for strings, attr is always the string itself,
           so it can be passed as empty""" #try to do numerical comparisons if required
self
col
attr
val
op