all: Reformat C and Python source code with tools/codeformat.py.

This is run with uncrustify 0.70.1, and black 19.10b0.
This commit is contained in:
Damien George
2020-02-27 15:36:53 +11:00
parent 3f39d18c2b
commit 69661f3343
539 changed files with 10496 additions and 8254 deletions

View File

@@ -59,7 +59,7 @@ STATIC const mp_obj_type_t range_it_type = {
STATIC mp_obj_t mp_obj_new_range_iterator(mp_int_t cur, mp_int_t stop, mp_int_t step, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_range_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_obj_range_it_t *o = (mp_obj_range_it_t*)iter_buf;
mp_obj_range_it_t *o = (mp_obj_range_it_t *)iter_buf;
o->base.type = &range_it_type;
o->cur = cur;
o->stop = stop;
@@ -132,9 +132,12 @@ STATIC mp_obj_t range_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_range_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t len = range_len(self);
switch (op) {
case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len > 0);
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len);
default: return MP_OBJ_NULL; // op not supported
case MP_UNARY_OP_BOOL:
return mp_obj_new_bool(len > 0);
case MP_UNARY_OP_LEN:
return MP_OBJ_NEW_SMALL_INT(len);
default:
return MP_OBJ_NULL; // op not supported
}
}
@@ -152,7 +155,7 @@ STATIC mp_obj_t range_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
&& (lhs_len == 0
|| (lhs->start == rhs->start
&& (lhs_len == 1 || lhs->step == rhs->step)))
);
);
}
#endif
@@ -161,7 +164,7 @@ STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
// load
mp_obj_range_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t len = range_len(self);
#if MICROPY_PY_BUILTINS_SLICE
#if MICROPY_PY_BUILTINS_SLICE
if (mp_obj_is_type(index, &mp_type_slice)) {
mp_bound_slice_t slice;
mp_seq_get_fast_slice_indexes(len, index, &slice);
@@ -176,7 +179,7 @@ STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
}
return MP_OBJ_FROM_PTR(o);
}
#endif
#endif
size_t index_val = mp_get_index(self->base.type, len, index, false);
return MP_OBJ_NEW_SMALL_INT(self->start + index_val * self->step);
} else {
@@ -218,7 +221,7 @@ const mp_obj_type_t mp_type_range = {
#endif
.subscr = range_subscr,
.getiter = range_getiter,
#if MICROPY_PY_BUILTINS_RANGE_ATTRS
#if MICROPY_PY_BUILTINS_RANGE_ATTRS
.attr = range_attr,
#endif
#endif
};