def bit_ne(self, ix, key): _, idb, _, column = self.dbs[ix] rval = BitSet() key = self._vid_for_value(column, key) if key is not None: val = idb.get(self.txn, key) if val is not None: rval.loads(val) rval |= ZERO_BS rval.set(self.number_rows) rval.lnot_inplace() return rval
def bit_ne_ex(self, ix, keys): from collections import Iterable _, idb, _, column = self.dbs[ix] rval = BitSet() for key in keys: if isinstance(key, Iterable) and not isinstance(key, (basestring, unicode)): # in case the key is a composite object, just grab the first one key = key[0] zkey = self._vid_for_value(column, key) if zkey is not None: val = idb.get(self.txn, zkey) if val is not None: bitset = BitSet() bitset.loads(val) rval |= bitset rval |= ZERO_BS rval.set(self.number_rows) rval.lnot_inplace() return rval