34 #define MP_OBJ_IS_DICT_TYPE(o) (MP_OBJ_IS_OBJ(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->make_new == dict_make_new) 45 for (
size_t i = *cur; i < max; i++) {
46 if (MP_MAP_SLOT_IS_FILLED(map, i)) {
48 return &(map->
table[i]);
62 mp_printf(print,
"%q(", self->base.type->name);
85 dict->
base.type = type;
86 #if MICROPY_PY_COLLECTIONS_ORDEREDDICT 91 if (n_args > 0 || n_kw > 0) {
105 #if MICROPY_PY_SYS_GETSIZEOF 107 size_t sz =
sizeof(*self) +
sizeof(*
self->map.table) * self->map.alloc;
120 return mp_obj_new_bool(elem !=
NULL);
123 #if MICROPY_PY_COLLECTIONS_ORDEREDDICT 127 size_t c1 = 0, c2 = 0;
244 other->
base.type =
self->base.type;
245 other->
map.
used =
self->map.used;
383 for (
size_t i = 0; i < kwargs->
alloc; i++) {
384 if (MP_MAP_SLOT_IS_FILLED(kwargs, i)) {
429 switch (self->kind) {
445 .
name = MP_QSTR_iterator,
496 .
name = MP_QSTR_dict_view,
554 .
name = MP_QSTR_dict,
564 #if MICROPY_PY_COLLECTIONS_ORDEREDDICT 567 .
name = MP_QSTR_OrderedDict,
592 return self->map.used;
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_fromkeys_fun_obj, 2, 3, dict_fromkeys)
NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const char *msg)
const mp_obj_type_t mp_type_ordereddict
mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items)
STATIC const mp_obj_type_t dict_view_it_type
#define MP_OBJ_IS_TYPE(o, t)
STATIC mp_obj_t dict_copy(mp_obj_t self_in)
STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_clear_obj, dict_clear)
void mp_map_init_fixed_table(mp_map_t *map, size_t n, const mp_obj_t *table)
STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind)
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index)
#define MP_OBJ_IS_DICT_TYPE(o)
void mp_map_init(mp_map_t *map, size_t n)
mp_obj_t mp_obj_new_dict(size_t n_args)
int mp_print_str(const mp_print_t *print, const char *str)
STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args)
#define MP_OBJ_FROM_PTR(p)
bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2)
void mp_arg_check_num(size_t n_args, size_t n_kw, size_t n_args_min, size_t n_args_max, bool takes_kw)
const mp_obj_type_t mp_type_dict
STATIC mp_obj_t dict_get(size_t n_args, const mp_obj_t *args)
STATIC mp_obj_t dict_items(mp_obj_t self_in)
void mp_map_clear(mp_map_t *map)
STATIC mp_obj_t dict_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
STATIC mp_obj_t dict_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf)
#define MP_OBJ_SMALL_INT_VALUE(o)
STATIC mp_obj_t dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)
mp_obj_t(* mp_fun_1_t)(mp_obj_t)
STATIC MP_DEFINE_CONST_DICT(dict_locals_dict, dict_locals_dict_table)
mp_map_elem_t * mp_map_lookup(mp_map_t *map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind)
STATIC mp_obj_t dict_clear(mp_obj_t self_in)
STATIC mp_obj_t dict_view_it_iternext(mp_obj_t self_in)
mp_obj_t mp_obj_len_maybe(mp_obj_t o_in)
#define MP_OBJ_NEW_SMALL_INT(small_int)
const mp_obj_type_t mp_type_polymorph_iter
STATIC mp_obj_t mp_obj_new_dict_view(mp_obj_t dict, mp_dict_view_kind_t kind)
STATIC mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_lookup_kind_t lookup_kind)
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(dict_fromkeys_obj, MP_ROM_PTR(&dict_fromkeys_fun_obj))
mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg)
#define mp_check_self(pred)
mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value)
void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind)
void mp_obj_dict_init(mp_obj_dict_t *dict, size_t n_args)
STATIC mp_map_elem_t * dict_iter_next(mp_obj_dict_t *dict, size_t *cur)
mp_map_t * mp_obj_dict_get_map(mp_obj_t self_in)
STATIC mp_obj_t dict_view_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
STATIC mp_obj_t dict_view_getiter(mp_obj_t view_in, mp_obj_iter_buf_t *iter_buf)
STATIC mp_obj_t dict_values(mp_obj_t self_in)
size_t mp_obj_dict_len(mp_obj_t self_in)
const mp_obj_type_t mp_type_type
STATIC const char *const mp_dict_view_names[]
NORETURN void mp_raise_ValueError(const char *msg)
enum _mp_map_lookup_kind_t mp_map_lookup_kind_t
enum _mp_dict_view_kind_t mp_dict_view_kind_t
STATIC mp_obj_t dict_pop(size_t n_args, const mp_obj_t *args)
mp_obj_t mp_identity_getiter(mp_obj_t self, mp_obj_iter_buf_t *iter_buf)
STATIC const mp_obj_type_t dict_view_type
STATIC mp_obj_t dict_keys(mp_obj_t self_in)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key)
mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf)
STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
size_t all_keys_are_qstrs
struct _mp_obj_dict_it_t mp_obj_dict_it_t
#define MP_OBJ_STOP_ITERATION
mp_obj_t mp_iternext(mp_obj_t o_in)
int mp_printf(const mp_print_t *print, const char *fmt,...)
STATIC mp_obj_t dict_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dict_update_obj, 1, dict_update)
STATIC mp_obj_t dict_popitem(mp_obj_t self_in)
STATIC mp_obj_t dict_unary_op(mp_unary_op_t op, mp_obj_t self_in)
STATIC const mp_rom_map_elem_t dict_locals_dict_table[]
const mp_obj_type_t mp_type_KeyError
struct _mp_obj_dict_view_it_t mp_obj_dict_view_it_t
STATIC mp_obj_t dict_it_iternext(mp_obj_t self_in)
void * memcpy(void *dst, const void *src, size_t n)
STATIC void dict_view_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind)
STATIC mp_obj_t dict_setdefault(size_t n_args, const mp_obj_t *args)
STATIC mp_obj_t dict_view(mp_obj_t self_in, mp_dict_view_kind_t kind)
struct _mp_obj_dict_t * locals_dict
struct _mp_obj_dict_view_t mp_obj_dict_view_t