fix some typos

This commit is contained in:
Dan Halbert 2021-06-21 17:47:12 -04:00
parent 51c547a5b9
commit 8c74b4a5f2
3 changed files with 6 additions and 4 deletions

View File

@ -189,14 +189,16 @@ mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t
const mp_float_t f = (float_in == MP_OBJ_NULL) const mp_float_t f = (float_in == MP_OBJ_NULL)
? default_for_null ? default_for_null
: mp_obj_get_float(float_in); : mp_obj_get_float(float_in);
if (f <= 0.0f) { if (f <= (mp_float_t)0.0) {
mp_raise_ValueError_varg(translate("%q must be >= 0"), arg_name); mp_raise_ValueError_varg(translate("%q must be >= 0"), arg_name);
} }
return f; return f;
} }
size_t mp_arg_validate_length_with_name(mp_int_t i, size_t length, qstr arg_name, qstr length_name) { size_t mp_arg_validate_length_with_name(mp_int_t i, size_t length, qstr arg_name, qstr length_name) {
mp_raise_ValueError_varg(translate("%q length must be %q"), MP_QSTR_pressed, MP_QSTR_num_keys); if (i != (mp_int_t)length) {
mp_raise_ValueError_varg(translate("%q length must be %q"), MP_QSTR_pressed, MP_QSTR_num_keys);
}
return (size_t)i; return (size_t)i;
} }

View File

@ -36,7 +36,7 @@
//| class Keys: //| class Keys:
//| """Manage a set of independent keys.""" //| """Manage a set of independent keys."""
//| //|
//| def __init__(self, pins: Sequence[microcontroller.Pin], *, level_when_pressed: bool, pull: bool = True, interval: float = 0.020, max_events: int = 64) -> None: //| def __init__(self, pins: Sequence[microcontroller.Pin], *, value_when_pressed: bool, pull: bool = True, interval: float = 0.020, max_events: int = 64) -> None:
//| """ //| """
//| Create a `Keys` object that will scan keys attached to the given sequence of pins. //| Create a `Keys` object that will scan keys attached to the given sequence of pins.
//| Each key is independent and attached to its own pin. //| Each key is independent and attached to its own pin.

View File

@ -36,7 +36,7 @@
//| class ShiftRegisterKeys: //| class ShiftRegisterKeys:
//| """Manage a set of keys attached to an incoming shift register.""" //| """Manage a set of keys attached to an incoming shift register."""
//| //|
//| def __init__(self, clock: microcontroller.Pin, data: microcontroller.Pin, latch: microcontroller.Pin, level_when_pressed: bool, interval: float = 0.020, max_events: int = 64) -> None: //| def __init__(self, clock: microcontroller.Pin, data: microcontroller.Pin, latch: microcontroller.Pin, value_when_pressed: bool, interval: float = 0.020, max_events: int = 64) -> None:
//| """ //| """
//| Create a `Keys` object that will scan keys attached to a parallel-in serial-out shift register //| Create a `Keys` object that will scan keys attached to a parallel-in serial-out shift register
//| like the 74HC165 or equivalent. //| like the 74HC165 or equivalent.