touch up analogbufio ValueError msg; consolidate with another message

This commit is contained in:
Dan Halbert 2022-09-16 09:34:25 -04:00
parent 8a568d18b5
commit 6f8fe1b3e1
3 changed files with 7 additions and 12 deletions

View File

@ -79,10 +79,6 @@ msgstr ""
msgid "%q"
msgstr ""
#: shared-bindings/analogbufio/BufferedIn.c
msgid "%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"
msgstr ""
#: shared-bindings/microcontroller/Pin.c
msgid "%q and %q contain duplicate pins"
msgstr ""
@ -163,6 +159,11 @@ msgstr ""
msgid "%q must be >= 1"
msgstr ""
#: shared-bindings/analogbufio/BufferedIn.c
#: shared-bindings/audiocore/RawSample.c
msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"
msgstr ""
#: py/argcheck.c
msgid "%q must be a string"
msgstr ""
@ -3878,12 +3879,6 @@ msgstr ""
msgid "rsplit(None,n)"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid ""
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
"'B'"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/raspberrypi/common-hal/audiobusio/PDMIn.c
msgid "sampling rate out of range"

View File

@ -98,7 +98,7 @@ STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_
if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') {
bytes_per_sample = 2;
} else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) {
mp_raise_ValueError_varg(translate("%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"), MP_QSTR_buffer);
mp_raise_ValueError_varg(translate("%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"), MP_QSTR_buffer);
}
// Validate sample rate here

View File

@ -88,7 +88,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a
if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') {
bytes_per_sample = 2;
} else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) {
mp_raise_ValueError(translate("sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or 'B'"));
mp_raise_ValueError_varg(translate("%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"), MP_QSTR_buffer);
}
common_hal_audioio_rawsample_construct(self, ((uint8_t *)bufinfo.buf), bufinfo.len,
bytes_per_sample, signed_samples, args[ARG_channel_count].u_int,