def impl(d): status, keyval = _dict_popitem(d) if status == Status.OK: return _nonoptional(keyval) elif status == Status.ERR_DICT_EMPTY: raise KeyError() else: raise AssertionError('internal dict error during popitem')
def integer_impl(l, index): index = handle_index(l, index) castedindex = _cast(index, indexty) status, item = _list_getitem(l, castedindex) if status == ListStatus.LIST_OK: return _nonoptional(item) else: raise AssertionError("internal list error during getitem")
def impl(d, key): castedkey = _cast(key, keyty) ix, val = _dict_lookup(d, castedkey, hash(castedkey)) if ix == DKIX.EMPTY: raise KeyError() elif ix < DKIX.EMPTY: raise AssertionError("internal dict error during lookup") else: return _nonoptional(val)
def impl(l, index=-1): if len(l) == 0: raise IndexError("pop from empty list") index = handle_index(l, index) castedindex = _cast(index, indexty) status, item = _list_pop(l, castedindex) if status == ListStatus.LIST_OK: return _nonoptional(item) else: raise AssertionError("internal list error during pop")