Remove all kwarg from ScanEntry.matches

Fixes #3007
This commit is contained in:
Scott Shawcroft 2022-08-09 14:37:52 -07:00
parent 5084de1b73
commit 7a07247974
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 3 additions and 6 deletions

View File

@ -48,25 +48,22 @@
//| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool:
//| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter
//| than the scan filtering which accepts any advertisements that match any of the prefixes
//| where ``match_all`` is False.
//|
//| ``all`` also works for ``match_all`` but will be removed in CircuitPython 8."""
//| where ``match_all`` is False."""
//| ...
//|
STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
enum { ARG_prefixes, ARG_all, ARG_match_all };
enum { ARG_prefixes, ARG_match_all };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_prefixes, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_all, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_match_all, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
bool match_all = args[ARG_all].u_bool && args[ARG_match_all].u_bool;
bool match_all = args[ARG_match_all].u_bool;
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[ARG_prefixes].u_obj, &bufinfo, MP_BUFFER_READ);