def get_item(self, w_dict, i): from pycket.hash.persistent_hash_map import MASK_32 storage = self.unerase(w_dict.hstorage) assert i >= 0 i = r_uint(i) index = i & MASK_32 subindex = (i >> 32) & MASK_32 bucket = get_dict_item(storage, index)[1] if bucket is None: raise IndexError return bucket[subindex]
def get_item(self, w_dict, i): from pycket.hash.persistent_hash_map import MASK_32 storage = self.unerase(w_dict.hstorage) assert i >= 0 i = r_uint(i) index = i & MASK_32 subindex = (i >> 32) & MASK_32 bucket = get_dict_item(storage, index)[1] if bucket is None: raise IndexError return bucket[subindex]
def tg(a, b, c, d): dct = {str(a): b, str(c): d} i = 0 while 1: try: x, y = get_dict_item(dct, i) assert (x == str(a) and y == b) or (x == str(c) and y == d) except KeyError: pass except IndexError: break i += 1 return i
def tg(a, b, c, d): dct = {str(a): b, str(c): d} i = 0 while 1: try: x, y = get_dict_item(dct, i) assert (x == str(a) and y == b) or (x == str(c) and y == d) except KeyError: pass except IndexError: break i += 1 return i
def hash_iterate_next(self, w_dict, pos): from pycket.hash.persistent_hash_map import MASK_32 storage = self.unerase(w_dict.hstorage) i = pos.value assert i >= 0 index = r_uint(i & MASK_32) subindex = r_uint((i >> 32) & MASK_32) bucket = get_dict_item(storage, index)[1] subindex += 1 if subindex == r_uint(len(bucket)): subindex = r_uint(0) next = next_valid_index( storage, intmask(index), valid=lambda x: bool(x[1])) index = r_uint(next) next = intmask((subindex << r_uint(32)) | index) return values.wrap(next)
def hash_iterate_next(self, w_dict, pos): from pycket.hash.persistent_hash_map import MASK_32 storage = self.unerase(w_dict.hstorage) i = pos.value assert i >= 0 index = r_uint(i & MASK_32) subindex = r_uint((i >> 32) & MASK_32) bucket = get_dict_item(storage, index)[1] subindex += 1 if subindex == r_uint(len(bucket)): subindex = r_uint(0) next = next_valid_index( storage, intmask(index), valid=lambda x: bool(x[1])) index = r_uint(next) next = intmask((subindex << r_uint(32)) | index) return values.wrap(next)
def hash_iterate_next(self, w_dict, pos): from pycket.hash.persistent_hash_map import MASK_32 storage = self.unerase(w_dict.hstorage) i = r_uint(pos.value) assert i >= 0 index = r_uint(i & MASK_32) subindex = r_uint((i >> 32) & MASK_32) bucket = get_dict_item(storage, index)[1] subindex += 1 if subindex == r_uint(len(bucket)): subindex = r_uint(0) try: next = next_valid_index(storage, intmask(index), valid=self._valid_bucket) except IndexError: return values.w_false index = r_uint(next) next = intmask((subindex << r_uint(32)) | index) return values.wrap(next)
def hash_iterate_next(self, w_dict, pos): from pycket.hash.persistent_hash_map import MASK_32 storage = self.unerase(w_dict.hstorage) i = r_uint(pos.value) assert i >= 0 index = r_uint(i & MASK_32) subindex = r_uint((i >> 32) & MASK_32) bucket = get_dict_item(storage, index)[1] subindex += 1 if subindex == r_uint(len(bucket)): subindex = r_uint(0) try: next = next_valid_index(storage, intmask(index), valid=self._valid_bucket) except IndexError: return values.w_false index = r_uint(next) next = intmask((subindex << r_uint(32)) | index) return values.wrap(next)
def get_item(self, w_dict, i): key, w_val = get_dict_item(self.unerase(w_dict.hstorage), i) return self.wrap(key), w_val
def get_item(self, i): return get_dict_item(self.data, i)
def get_item(self, w_dict, i): key, w_val = get_dict_item(self.unerase(w_dict.hstorage), i) return self.wrap(key), w_val