47 bool has_single_quote =
false;
48 bool has_double_quote =
false;
49 for (
const byte *s = str_data, *top = str_data + str_len; !has_double_quote && s < top; s++) {
51 has_single_quote =
true;
52 }
else if (*s ==
'"') {
53 has_double_quote =
true;
56 int quote_char =
'\'';
57 if (has_single_quote && !has_double_quote) {
61 for (
const byte *s = str_data, *top = str_data + str_len; s < top; s++) {
62 if (*s == quote_char) {
64 }
else if (*s ==
'\\') {
66 }
else if (*s >= 0x20 && *s != 0x7f && (!is_bytes || *s < 0x80)) {
71 }
else if (*s ==
'\n') {
73 }
else if (*s ==
'\r') {
75 }
else if (*s ==
'\t') {
89 for (
const byte *s = str_data, *top = str_data + str_len; s < top; s++) {
90 if (*s ==
'"' || *s ==
'\\') {
92 }
else if (*s >= 32) {
95 }
else if (*s ==
'\n') {
97 }
else if (*s ==
'\r') {
99 }
else if (*s ==
'\t') {
118 #if !MICROPY_PY_BUILTINS_STR_UNICODE 121 bool is_bytes =
true;
124 mp_printf(print,
"%.*s", str_len, str_data);
134 #if MICROPY_CPYTHON_COMPAT 162 #if MICROPY_PY_BUILTINS_STR_UNICODE_CHECK 174 #if MICROPY_PY_BUILTINS_STR_UNICODE_CHECK 187 #if MICROPY_CPYTHON_COMPAT 200 if (n_args < 2 || n_args > 3) {
218 if (MP_OBJ_IS_SMALL_INT(
args[0])) {
247 #if MICROPY_FULL_CHECKS 248 if (val < 0 || val > 255) {
268 str_index_end = hlen - nlen;
344 const byte *rhs_data;
348 rhs_data = rhs_data_;
355 rhs_data = bufinfo.
buf;
356 rhs_len = bufinfo.
len;
376 memcpy(vstr.
buf + lhs_len, rhs_data, rhs_len);
382 return mp_obj_new_bool(
find_subbytes(lhs_data, lhs_len, rhs_data, rhs_len, 1) !=
NULL);
390 return mp_obj_new_bool(
mp_seq_cmp_bytes(op, lhs_data, lhs_len, rhs_data, rhs_len));
397 #if !MICROPY_PY_BUILTINS_STR_UNICODE 401 size_t index_val =
mp_get_index(type, self_len, index, is_slice);
402 return self_data + index_val;
412 #if MICROPY_PY_BUILTINS_SLICE 415 if (!mp_seq_get_fast_slice_indexes(self_len, index, &slice)) {
421 size_t index_val =
mp_get_index(type, self_len, index,
false);
452 size_t required_len = 0;
453 for (
size_t i = 0; i < seq_len; i++) {
456 "join expects a list of str/bytes objects consistent with self object");
459 required_len += sep_len;
469 for (
size_t i = 0; i < seq_len; i++) {
497 const byte *top = s + len;
504 while (s < top && splits != 0) {
537 if (splits == 0 || s + sep_len > top) {
540 }
else if (
memcmp(s, sep_str, sep_len) == 0) {
560 #if MICROPY_PY_BUILTINS_STR_SPLITLINES 562 enum { ARG_keepends };
563 static const mp_arg_t allowed_args[] = {
564 { MP_QSTR_keepends,
MP_ARG_BOOL, {.u_bool =
false} },
575 const byte *top = s + len;
584 }
else if (*s ==
'\r') {
594 size_t sub_len = s -
start;
595 if (
args[ARG_keepends].u_bool) {
640 const byte *last = s + len;
644 if (splits == 0 || s < beg) {
646 }
else if (
memcmp(s, sep_str, sep_len) == 0) {
651 if (s < beg || splits == 0) {
663 size_t used = org_splits + 1 - idx;
687 const byte *end = haystack + haystack_len;
705 #if MICROPY_PY_BUILTINS_STR_UNICODE 744 if (prefix_len + (
start - str) > str_len) {
747 return mp_obj_new_bool(
memcmp(
start, prefix, prefix_len) == 0);
759 if (suffix_len > str_len) {
762 return mp_obj_new_bool(
memcmp(str + (str_len - suffix_len), suffix, suffix_len) == 0);
772 const byte *chars_to_del;
773 uint chars_to_del_len;
774 static const byte whitespace[] =
" \t\n\r\v\f";
777 chars_to_del = whitespace;
778 chars_to_del_len =
sizeof(whitespace) - 1;
785 chars_to_del_len = l;
790 size_t first_good_char_pos = 0;
791 bool first_good_char_pos_set =
false;
792 size_t last_good_char_pos = 0;
796 i = orig_str_len - 1;
799 for (
size_t len = orig_str_len; len > 0; len--) {
801 if (!first_good_char_pos_set) {
802 first_good_char_pos_set =
true;
803 first_good_char_pos = i;
805 last_good_char_pos = orig_str_len - 1;
807 }
else if (type ==
RSTRIP) {
808 first_good_char_pos = 0;
809 last_good_char_pos = i;
813 last_good_char_pos = i;
818 if (!first_good_char_pos_set) {
827 assert(last_good_char_pos >= first_good_char_pos);
829 size_t stripped_len = last_good_char_pos - first_good_char_pos + 1;
830 if (stripped_len == orig_str_len) {
833 assert(first_good_char_pos == 0);
854 #if MICROPY_PY_BUILTINS_STR_CENTER 858 if (str_len >= width) {
865 int left = (width - str_len) / 2;
875 if (str < top &&
'0' <= *str && *str <=
'9') {
878 *num = *num * 10 + (*str -
'0');
881 while (str < top &&
'0' <= *str && *str <=
'9');
891 return ch &&
strchr(
"bcdeEfFgGnosxX%", ch) !=
NULL;
900 #if MICROPY_PY_BUILTINS_FLOAT 907 #if MICROPY_PY_BUILTINS_FLOAT 909 return mp_obj_new_int_from_float(mp_obj_float_get(arg));
915 #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE 921 #define terse_str_format_value_error() 929 for (; str < top; str++) {
932 if (str < top && *str ==
'}') {
948 if (str < top && *str ==
'{') {
955 const char *field_name =
NULL;
956 const char *field_name_top =
NULL;
957 char conversion =
'\0';
958 const char *format_spec =
NULL;
960 if (str < top && *str !=
'}' && *str !=
'!' && *str !=
':') {
961 field_name = (
const char *)str;
962 while (str < top && *str !=
'}' && *str !=
'!' && *str !=
':') {
965 field_name_top = (
const char *)str;
970 if (str < top && *str ==
'!') {
972 if (str < top && (*str ==
'r' || *str ==
's')) {
982 "end of format while looking for conversion specifier");
985 "unknown conversion specifier %c", *str));
991 if (str < top && *str ==
':') {
1000 for (
int nest = 1; str < top;) {
1003 }
else if (*str ==
'}') {
1037 "can't switch from automatic field numbering to manual field specification");
1040 field_name =
str_to_int(field_name, field_name_top, &index);
1041 if ((
uint)index >= n_args - 1) {
1044 arg =
args[index + 1];
1048 for (lookup = field_name; lookup < field_name_top && *lookup !=
'.' && *lookup !=
'['; lookup++);
1050 field_name = lookup;
1052 if (key_elem ==
NULL) {
1055 arg = key_elem->
value;
1057 if (field_name < field_name_top) {
1066 "can't switch from manual field specification to automatic field numbering");
1069 if ((
uint)*arg_i >= n_args - 1) {
1072 arg =
args[(*arg_i) + 1];
1075 if (!format_spec && !conversion) {
1080 if (conversion ==
's') {
1083 assert(conversion ==
'r');
1115 const char *stop = s + format_spec_vstr.
len;
1122 if (*s ==
'+' || *s ==
'-' || *s ==
' ') {
1125 }
else if (*s ==
' ') {
1187 "sign not allowed with integer format specifier 'c'");
1227 mp_print_mp_int(&print, arg, 16, type - (
'X' -
'A'), flags, fill, width, 0);
1246 "unknown format code '%c' for object of type '%s'",
1291 #if MICROPY_PY_BUILTINS_FLOAT 1298 mp_print_float(&print, mp_obj_get_float(arg), type, flags, fill, width, precision);
1303 #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT 1308 mp_print_float(&print, mp_obj_get_float(arg) * F100,
'f', flags, fill, width, precision);
1318 "unknown format code '%c' for object of type 'float'",
1330 "'=' alignment not allowed in string format specifier");
1339 if (precision < 0) {
1342 if (slen > (
size_t)precision) {
1354 "unknown format code '%c' for object of type 'str'",
1378 const byte *start_str = str;
1385 for (
const byte *top = str + len; str < top; str++) {
1392 goto incomplete_format;
1405 const byte *key = ++str;
1406 while (*str !=
')') {
1429 else if (*str ==
'0') {
1439 if (arg_i >= n_args) {
1440 goto not_enough_args;
1445 str = (
const byte*)
str_to_int((
const char*)str, (
const char*)top, &width);
1449 if (str < top && *str ==
'.') {
1452 if (arg_i >= n_args) {
1453 goto not_enough_args;
1459 str = (
const byte*)
str_to_int((
const char*)str, (
const char*)top, &prec);
1475 if (arg_i >= n_args) {
1479 arg =
args[arg_i++];
1504 #if MICROPY_PY_BUILTINS_FLOAT 1511 mp_print_float(&print, mp_obj_get_float(arg), *str, flags, fill, width, prec);
1539 if (vlen > (
uint)prec) {
1549 mp_print_mp_int(&print, arg, 16, *str - (
'X' -
'A'), flags | alt, fill, width, prec);
1557 "unsupported format character '%c' (0x%x) at index %d",
1558 *str, *str, str - start_str));
1563 if (arg_i != n_args) {
1580 }
else if (max_rep < 0) {
1606 if (old_len > str_len) {
1618 size_t replaced_str_index = 0;
1619 size_t num_replacements_done = 0;
1620 const byte *old_occurrence;
1621 const byte *offset_ptr = str;
1622 size_t str_len_remain = str_len;
1629 replaced_str_index += new_len;
1630 num_replacements_done++;
1632 while (num_replacements_done != (
size_t)max_rep && str_len_remain > 0 && (old_occurrence =
find_subbytes(offset_ptr, str_len_remain, old, old_len, 1)) !=
NULL) {
1634 old_occurrence += 1;
1638 memcpy(
data + replaced_str_index, offset_ptr, old_occurrence - offset_ptr);
1640 replaced_str_index += old_occurrence - offset_ptr;
1643 memcpy(
data + replaced_str_index,
new, new_len);
1645 replaced_str_index += new_len;
1646 offset_ptr = old_occurrence + old_len;
1647 str_len_remain = str + str_len - offset_ptr;
1648 num_replacements_done++;
1653 memcpy(
data + replaced_str_index, offset_ptr, str_len_remain);
1655 replaced_str_index += str_len_remain;
1659 if (num_replacements_done == 0) {
1691 const byte *end = haystack + haystack_len;
1700 if (needle_len == 0) {
1706 for (
const byte *haystack_ptr =
start; haystack_ptr + needle_len <= end;) {
1707 if (
memcmp(haystack_ptr, needle, needle_len) == 0) {
1709 haystack_ptr += needle_len;
1719 #if MICROPY_PY_BUILTINS_STR_PARTITION 1745 if (direction > 0) {
1746 result[0] = self_in;
1748 result[2] = self_in;
1751 const byte *position_ptr =
find_subbytes(str, str_len, sep, sep_len, direction);
1752 if (position_ptr !=
NULL) {
1753 size_t position = position_ptr - str;
1763 return str_partitioner(self_in, arg, 1);
1768 return str_partitioner(self_in, arg, -1);
1779 for (
size_t i = 0; i < self_len; i++) {
1780 *
data++ = op(*self_data++);
1798 if (self_len == 0) {
1803 for (
size_t i = 0; i < self_len; i++) {
1804 if (!f(*self_data++)) {
1809 bool contains_alpha =
false;
1811 for (
size_t i = 0; i < self_len; i++) {
1813 contains_alpha =
true;
1814 if (!f(*(self_data - 1))) {
1820 if (!contains_alpha) {
1853 #if MICROPY_CPYTHON_COMPAT 1860 new_args[0] =
args[0];
1873 new_args[0] =
args[0];
1886 bufinfo->
buf = (
void*)str_data;
1887 bufinfo->
len = str_len;
1900 #if MICROPY_CPYTHON_COMPAT 1902 #if !MICROPY_PY_BUILTINS_STR_UNICODE 1917 #if MICROPY_PY_BUILTINS_STR_SPLITLINES 1929 #if MICROPY_PY_BUILTINS_STR_PARTITION 1933 #if MICROPY_PY_BUILTINS_STR_CENTER 1947 #if !MICROPY_PY_BUILTINS_STR_UNICODE 1952 .
name = MP_QSTR_str,
1966 .
name = MP_QSTR_bytes,
1983 o->
base.type = type;
2002 if (q != MP_QSTR_NULL) {
2011 o->
base.type = type;
2014 if (vstr->
len + 1 == vstr->
alloc) {
2026 if (make_qstr_if_not_already) {
2031 if (q != MP_QSTR_NULL) {
2051 if (MP_OBJ_IS_QSTR(s1) && MP_OBJ_IS_QSTR(s2)) {
2057 if (h1 != 0 && h2 != 0 && h1 != h2) {
2065 return memcmp(d1, d2, l1) == 0;
2075 "can't convert '%q' object to %q implicitly",
2076 src_name, src_name == MP_QSTR_str ? MP_QSTR_bytes : MP_QSTR_str));
2083 if (MP_OBJ_IS_QSTR(self_in)) {
2099 return (
const char*)s;
2109 return (
const char*)s;
2115 #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C 2117 if (MP_OBJ_IS_QSTR(self_in)) {
2136 #if !MICROPY_PY_BUILTINS_STR_UNICODE 2140 if (self->cur < len) {
2163 if (self->cur < len) {
STATIC mp_obj_t str_rstrip(size_t n_args, const mp_obj_t *args)
bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2)
struct _mp_obj_str8_it_t mp_obj_str8_it_t
qstr qstr_from_strn(const char *str, size_t len)
mp_obj_t mp_obj_str_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
#define mp_seq_clear(start, len, alloc_len, item_sz)
#define PF_FLAG_SHOW_COMMA
NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const char *msg)
void * memset(void *b, int c, size_t len)
mp_obj_t mp_obj_new_str(const char *data, size_t len, bool make_qstr_if_not_already)
mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items)
STATIC mp_obj_t str_lower(mp_obj_t self_in)
STATIC mp_obj_t str_upper(mp_obj_t self_in)
#define MICROPY_ERROR_REPORTING_TERSE
STATIC mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args)
NORETURN void mp_raise_NotImplementedError(const char *msg)
STATIC mp_obj_t str_isspace(mp_obj_t self_in)
const char * mp_obj_str_get_data(mp_obj_t self_in, size_t *len)
bool unichar_isalpha(unichar c)
NORETURN void mp_arg_error_unimpl_kw(void)
mp_make_new_fun_t make_new
const mp_obj_type_t mp_type_TypeError
mp_obj_t mp_obj_str_split(size_t n_args, const mp_obj_t *args)
STATIC mp_obj_t str_it_iternext(mp_obj_t self_in)
STATIC bool istype(char ch)
STATIC mp_obj_t str_isdigit(mp_obj_t self_in)
#define MP_OBJ_IS_TYPE(o, t)
mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, const char *fmt,...)
void vstr_init_len(vstr_t *vstr, size_t len)
MP_DEFINE_CONST_FUN_OBJ_KW(str_format_obj, 1, mp_obj_str_format)
#define MP_OBJ_QSTR_VALUE(o)
bool mp_get_buffer(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags)
mp_obj_t mp_obj_new_bytes(const byte *data, size_t len)
STATIC mp_obj_t str_uni_istype(bool(*f)(unichar), mp_obj_t self_in)
bool mp_seq_cmp_bytes(mp_uint_t op, const byte *data1, size_t len1, const byte *data2, size_t len2)
STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
STATIC mp_obj_t str_replace(size_t n_args, const mp_obj_t *args)
mp_obj_type_t * mp_obj_get_type(mp_const_obj_t o_in)
void vstr_init(vstr_t *vstr, size_t alloc)
int mp_print_str(const mp_print_t *print, const char *str)
mp_obj_t mp_obj_str_intern(mp_obj_t str)
#define MP_OBJ_FROM_PTR(p)
const byte * str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, size_t self_len, mp_obj_t index, bool is_slice)
void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals)
#define MP_OBJ_NEW_QSTR(qst)
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)
unichar unichar_tolower(unichar c)
const byte * mp_obj_str_get_data_no_check(mp_obj_t self_in, size_t *len)
STATIC mp_obj_t str_rindex(size_t n_args, const mp_obj_t *args)
void vstr_add_byte(vstr_t *vstr, byte v)
STATIC bool arg_looks_integer(mp_obj_t arg)
STATIC mp_obj_t str_find(size_t n_args, const mp_obj_t *args)
mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items)
const mp_obj_type_t mp_type_str
#define mp_const_empty_bytes
STATIC mp_obj_t str_islower(mp_obj_t self_in)
const byte * utf8_next_char(const byte *s)
STATIC mp_obj_t bytes_it_iternext(mp_obj_t self_in)
STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg)
mp_int_t mp_obj_get_int(mp_const_obj_t arg)
STATIC bool arg_looks_numeric(mp_obj_t arg)
bool unichar_isdigit(unichar c)
mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr)
qstr qstr_find_strn(const char *str, size_t str_len)
#define MP_OBJ_SMALL_INT_VALUE(o)
bool utf8_check(const byte *p, size_t len)
mp_obj_t(* mp_fun_1_t)(mp_obj_t)
STATIC mp_obj_t mp_obj_new_bytes_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf)
#define mp_obj_is_float(o)
STATIC mp_obj_t str_rfind(size_t n_args, const mp_obj_t *args)
mp_map_elem_t * mp_map_lookup(mp_map_t *map, mp_obj_t index, mp_map_lookup_kind_t lookup_kind)
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_split_obj, 1, 3, mp_obj_str_split)
mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg)
void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items)
size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool is_slice)
mp_uint_t utf8_ptr_to_index(const byte *s, const byte *ptr)
mp_obj_t mp_obj_len_maybe(mp_obj_t o_in)
#define MP_OBJ_NEW_SMALL_INT(small_int)
#define MICROPY_ERROR_REPORTING
STATIC mp_obj_t str_count(size_t n_args, const mp_obj_t *args)
STATIC mp_obj_t str_isupper(mp_obj_t self_in)
STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict)
const mp_obj_type_t mp_type_polymorph_iter
bool unichar_isspace(unichar c)
STATIC mp_obj_t str_isalpha(mp_obj_t self_in)
#define MICROPY_ERROR_REPORTING_NORMAL
STATIC mp_obj_t str_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index)
STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args)
MP_DEFINE_CONST_FUN_OBJ_1(str_lower_obj, str_lower)
mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg)
#define mp_check_self(pred)
char * strchr(const char *s, int c)
#define PF_FLAG_SHOW_SIGN
void * memmove(void *dst, const void *src, size_t n)
bool unichar_islower(unichar c)
STATIC mp_obj_t str_caseconv(unichar(*op)(unichar), mp_obj_t self_in)
STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *arg_i, size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind)
#define GET_STR_LEN(str_obj_in, str_len)
STATIC mp_obj_t str_lstrip(size_t n_args, const mp_obj_t *args)
void mp_obj_tuple_get(mp_obj_t self_in, size_t *len, mp_obj_t **items)
const mp_obj_type_t mp_type_ValueError
void mp_str_print_quoted(const mp_print_t *print, const byte *str_data, size_t str_len, bool is_bytes)
const byte * find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction)
void mp_seq_multiply(const void *items, size_t item_sz, size_t len, size_t times, void *dest)
qstr mp_obj_str_get_qstr(mp_obj_t self_in)
STATIC void str_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind)
STATIC MP_DEFINE_CONST_DICT(str8_locals_dict, str8_locals_dict_table)
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index)
mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags)
const mp_obj_type_t mp_type_UnicodeError
bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value)
const mp_obj_type_t mp_type_type
const mp_obj_type_t mp_type_bool
#define PF_FLAG_LEFT_ADJUST
const byte * qstr_data(qstr q, size_t *len)
#define m_renew(type, ptr, old_num, new_num)
STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in)
const mp_obj_type_t mp_type_IndexError
NORETURN void mp_raise_ValueError(const char *msg)
STATIC mp_obj_t arg_as_int(mp_obj_t arg)
void mp_str_print_json(const mp_print_t *print, const byte *str_data, size_t str_len)
#define PF_FLAG_SPACE_SIGN
const char * mp_obj_str_get_str(mp_obj_t self_in)
void mp_get_buffer_raise(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags)
mp_uint_t qstr_compute_hash(const byte *data, size_t len)
char * vstr_null_terminated_str(vstr_t *vstr)
const mp_obj_type_t mp_type_slice
STATIC const char * str_to_int(const char *str, const char *top, int *num)
mp_obj_t mp_obj_str_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)
const mp_obj_type_t mp_type_tuple
const mp_obj_type_t mp_type_dict
STATIC const mp_rom_map_elem_t str8_locals_dict_table[]
mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf)
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte *data, size_t len)
const char * mp_obj_get_type_str(mp_const_obj_t o_in)
LIBA_BEGIN_DECLS int memcmp(const void *s1, const void *s2, size_t n)
STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args)
unichar unichar_toupper(unichar c)
STATIC NORETURN void terse_str_format_value_error(void)
#define PF_FLAG_ADD_PERCENT
int mp_print_strn(const mp_print_t *print, const char *str, size_t len, int flags, char fill, int width)
#define MP_OBJ_STOP_ITERATION
#define PF_FLAG_SHOW_OCTAL_LETTER
#define PF_FLAG_CENTER_ADJUST
mp_obj_t mp_iternext(mp_obj_t o_in)
#define PF_FLAG_PAD_AFTER_SIGN
int mp_printf(const mp_print_t *print, const char *fmt,...)
#define PF_FLAG_SHOW_PREFIX
const mp_obj_type_t mp_type_bytes
STATIC mp_obj_t str_index(size_t n_args, const mp_obj_t *args)
int mp_print_mp_int(const mp_print_t *print, mp_obj_t x, int base, int base_char, int flags, char fill, int width, int prec)
NORETURN void mp_raise_TypeError(const char *msg)
#define MP_OBJ_IS_STR_OR_BYTES(o)
STATIC mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf)
mp_uint_t unichar_charlen(const char *str, mp_uint_t len)
#define GET_STR_DATA_LEN(str_obj_in, str_data, str_len)
MP_DEFINE_CONST_FUN_OBJ_2(str_join_obj, str_join)
const mp_obj_type_t mp_type_list
#define MICROPY_PY_BUILTINS_STR_UNICODE
void vstr_init_print(vstr_t *vstr, size_t alloc, struct _mp_print_t *print)
void vstr_clear(vstr_t *vstr)
const mp_obj_type_t mp_type_KeyError
STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args)
#define GET_STR_HASH(str_obj_in, str_hash)
void * memcpy(void *dst, const void *src, size_t n)
STATIC bool isalignment(char ch)
bool unichar_isupper(unichar c)
mp_obj_t mp_obj_str_format(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
STATIC mp_obj_t str_strip(size_t n_args, const mp_obj_t *args)
const mp_obj_str_t mp_const_empty_bytes_obj
STATIC mp_obj_t bytes_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args)