From 6f8fe1b3e13ce67613115f16d79fec4e0690addb Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 16 Sep 2022 09:34:25 -0400 Subject: [PATCH] touch up analogbufio ValueError msg; consolidate with another message --- locale/circuitpython.pot | 15 +++++---------- shared-bindings/analogbufio/BufferedIn.c | 2 +- shared-bindings/audiocore/RawSample.c | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 30971fd9b1..52f1bdb5ad 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -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" diff --git a/shared-bindings/analogbufio/BufferedIn.c b/shared-bindings/analogbufio/BufferedIn.c index a0a0f27161..12a8d90e61 100644 --- a/shared-bindings/analogbufio/BufferedIn.c +++ b/shared-bindings/analogbufio/BufferedIn.c @@ -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 diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 02d4bbaa2f..85ad752bab 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -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,