diff --git a/ports/espressif/bindings/espcamera/__init__.c b/ports/espressif/bindings/espcamera/__init__.c index 37b506015f..633f547fe9 100644 --- a/ports/espressif/bindings/espcamera/__init__.c +++ b/ports/espressif/bindings/espcamera/__init__.c @@ -45,6 +45,7 @@ //| Non-Espressif microcontrollers use the `imagecapture` module together with wrapper libraries such as `adafruit_ov5640 `_. //| //| """ +//| //| class GrabMode: //| """Controls when a new frame is grabbed.""" diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index 12781000ae..c1ef9da1e0 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -37,6 +37,7 @@ //| """Direct access to a few ESP-IDF details. This module *should not* include any functionality //| that could be implemented by other frameworks. It should only include ESP-IDF specific //| things.""" +//| //| def heap_caps_get_total_size() -> int: //| """Return the total size of the ESP-IDF, which includes the CircuitPython heap.""" @@ -72,7 +73,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he //| """Erase all data in the non-volatile storage (nvs), including data stored by with `microcontroller.nvm` //| //| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the -//| layout of data in nvs has changed. The old data will be lost when you perform this operation.""" +//| layout of data in nvs has changed. The old data will be lost when you perform this operation. +//| """ //| STATIC mp_obj_t espidf_erase_nvs(void) { ESP_ERROR_CHECK(nvs_flash_deinit()); diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 5301086709..ada9f46020 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -94,7 +94,6 @@ //| wrap_target: int = 0, //| wrap: int = -1, //| ) -> None: -//| //| """Construct a StateMachine object on the given pins with the given program. //| //| :param ReadableBuffer program: the program to run with the state machine @@ -659,7 +658,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach //| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]`` //| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)`` //| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written) -//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)""" +//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read) +//| """ //| ... STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c index ce3be4aa52..193a3a2025 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.c +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -38,6 +38,7 @@ //| Learn guide `_. //| //| """ +//| //| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool: //| """Return True if the pins have sequential GPIO numbers, False otherwise""" diff --git a/ports/stm/boards/swan_r5/tests/board_voltage.py b/ports/stm/boards/swan_r5/tests/board_voltage.py index 6191067fde..2cb0ad4cc0 100644 --- a/ports/stm/boards/swan_r5/tests/board_voltage.py +++ b/ports/stm/boards/swan_r5/tests/board_voltage.py @@ -44,6 +44,7 @@ PASS = "PASS" FAIL = "FAIL" NA = "N/A" + # Determine if given value is a number def _is_number(val): try: @@ -61,7 +62,6 @@ def _deinit_pins(gpios): # Toggle IO pins while waiting for answer def _toggle_wait(pin_gpios): - timestamp = time.monotonic() led_state = False failed = [] @@ -96,7 +96,6 @@ def buildPin(pin): def run_test(pins): - """ Toggles all available GPIO on and off repeatedly. @@ -114,7 +113,6 @@ def run_test(pins): gpio_pins = analog_pins + digital_pins if gpio_pins: - # Print out the LEDs found print("GPIO pins found:", end=" ") for pin in gpio_pins: diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py index 3e48d4145d..e3188e2e24 100644 --- a/ports/stm/tools/parse_af_csv.py +++ b/ports/stm/tools/parse_af_csv.py @@ -31,6 +31,7 @@ import sys # # See examples/stm32f405.csv for example formatting. + # Most peripherals (SPI, I2C) output 3 values: # peripheral index, alt function, pin string def evaluate_periph(inper, inlist, periph, subtype, altfn, pin): diff --git a/py/genlast.py b/py/genlast.py index 460271af81..1c5089fdfc 100644 --- a/py/genlast.py +++ b/py/genlast.py @@ -59,7 +59,6 @@ def maybe_preprocess(command, output_dir, fn): if __name__ == "__main__": - idx1 = sys.argv.index("--") idx2 = sys.argv.index("--", idx1 + 1) output_dir = sys.argv[1] diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 2abbdedefd..d16bb0d09a 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -249,6 +249,7 @@ static_qstr_list = [ "zip", ] + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 diff --git a/py/maketranslationdata.py b/py/maketranslationdata.py index fbf396c73f..a07f70265c 100644 --- a/py/maketranslationdata.py +++ b/py/maketranslationdata.py @@ -84,6 +84,7 @@ C_ESCAPES = { '"': '\\"', } + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 @@ -277,7 +278,7 @@ def compute_huffman_coding(translation_name, translations, f): counter = collections.Counter() for t in texts: - for (found, word) in extractor.iter_words(t): + for found, word in extractor.iter_words(t): if not found: for substr in iter_substrings(word, minlen=2, maxlen=11): counter[substr] += 1 diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index e1c5fc3ad5..823250c365 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -256,7 +256,8 @@ MP_PROPERTY_GETTER(bleio_characteristic_service_obj, //| """Set the remote characteristic's CCCD to enable or disable notification and indication. //| //| :param bool notify: True if Characteristic should receive notifications of remote writes -//| :param float indicate: True if Characteristic should receive indications of remote writes""" +//| :param float indicate: True if Characteristic should receive indications of remote writes +//| """ //| ... STATIC mp_obj_t bleio_characteristic_set_cccd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 12853b3ac3..218d72bdbb 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -47,7 +47,6 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self //| def __init__( //| self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64 //| ) -> None: -//| //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| add the newly-written bytes to a FIFO buffer. //| diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index b0f37d9fe5..ec4e0c72e8 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -54,7 +54,8 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| ... //| def __next__(self) -> ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still -//| active. Raises `StopIteration` if scanning is finished and no other results are available.""" +//| active. Raises `StopIteration` if scanning is finished and no other results are available. +//| """ //| ... //| diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 59c6c354a4..f34d3af5c5 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -58,6 +58,7 @@ //| adapter: Adapter //| """BLE Adapter used to manage device discovery and connections. //| This object is the sole instance of `_bleio.Adapter`.""" +//| //| class BluetoothError(Exception): //| """Catchall exception for Bluetooth related errors.""" diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index bd0cf9b4ea..5975ee1ca1 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -93,7 +93,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc); //| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7) //| :param int ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -109,7 +110,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc); //| //| :param int prim: graphics primitive. //| -//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.""" +//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``. +//| """ //| ... STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) { @@ -137,7 +139,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat); //| //| :param int handle: bitmap handle. Range 0-31. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) { @@ -218,7 +221,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize); //| def BitmapSource(self, addr: int) -> None: //| """Set the source address for bitmap graphics //| -//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215""" +//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215 +//| """ //| ... STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) { @@ -255,7 +259,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -274,7 +279,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -290,7 +296,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb); //| //| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) { @@ -308,7 +315,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -327,7 +335,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd); //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -343,7 +352,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme); //| //| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) { @@ -359,7 +369,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf); //| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2) //| :param int dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -388,7 +399,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call); //| //| :param int cell: bitmap cell number. Range 0-127. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) { @@ -403,7 +415,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell); //| //| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) { @@ -420,7 +433,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora); //| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) { @@ -454,7 +468,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear); //| //| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) { @@ -469,7 +484,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil); //| //| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -483,7 +499,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag); //| //| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) { @@ -501,7 +518,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora); //| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1 //| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) { @@ -521,7 +539,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask); //| :param int green: green for the current color. Range 0-255. The initial value is 255 //| :param int blue: blue for the current color. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { @@ -547,7 +566,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); //| def End(self) -> None: //| """End drawing a graphics primitive //| -//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.""" +//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`. +//| """ //| ... STATIC mp_obj_t _end(mp_obj_t self) { @@ -599,7 +619,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop); //| //| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { @@ -648,7 +669,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext); //| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize //| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -665,7 +687,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize); //| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -683,7 +706,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy); //| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0 //| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) { @@ -700,7 +724,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc); //| //| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) { @@ -716,7 +741,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask); //| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1) //| :param int spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -732,7 +758,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop); //| //| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) { @@ -747,7 +774,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask); //| //| :param int s: tag value. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { @@ -857,7 +885,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); //| //| :param float width: line width in pixels. Range 0-511. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { @@ -872,7 +901,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); //| //| :param float size: point diameter in pixels. Range 0-1023. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { @@ -887,7 +917,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); //| //| :param float x: signed x-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { @@ -902,7 +933,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); //| //| :param float y: signed y-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... @@ -918,7 +950,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); //| //| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... // } diff --git a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c index d2b7f0c6ce..a77179c886 100644 --- a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c @@ -43,7 +43,6 @@ //| """I2C Device Manager""" //| //| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None: -//| //| """Represents a single I2C device and manages locking the bus and the device //| address. //| diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index 6626d27f77..6108247aa1 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -51,7 +51,6 @@ //| phase: int = 0, //| extra_clocks: int = 0 //| ) -> None: -//| //| """ //| Represents a single SPI device and manages locking the bus and the device address. //| diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index b5b0f1bb41..2848a02c62 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -78,7 +78,8 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t //| :param float brightness: Brightness (0 to 1.0, default 1.0) //| :param bool auto_write: Whether to automatically write pixels (Default False) //| :param ~circuitpython_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values. -//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values.""" +//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values. +//| """ //| ... STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer }; diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index f61482682f..29c9b49d3f 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -73,6 +73,7 @@ //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep. //| If no alarm occured since the last hard reset or soft restart, value is ``None``. //| """ +//| // wake_alarm is implemented as a dictionary entry, so there's no code here. diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index 914cac582b..9a91e0bc80 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -37,11 +37,11 @@ //| |see_cpython_module| :mod:`cpython:atexit`. //| """ //| ... +//| //| def register( //| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any] //| ) -> Callable[..., Any]: -//| //| """Register func as a function to be executed at termination. //| //| Any optional arguments that are to be passed to func must be passed as arguments to `register()`. @@ -65,7 +65,6 @@ STATIC mp_obj_t atexit_register(size_t n_args, const mp_obj_t *pos_args, mp_map_ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register); //| def unregister(func: Callable[..., Any]) -> None: -//| //| """Remove func from the list of functions to be run at termination. //| //| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once, diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index 0bdef1f4cd..16a1be520f 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -62,7 +62,8 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t //| //| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, `audiomixer.Mixer` or `audiomp3.MP3Decoder`. //| -//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.""" +//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor. +//| """ //| ... STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 4a8805b294..68e78cb0d5 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -45,7 +45,6 @@ //| """ //| //| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: -//| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param Union[str, typing.BinaryIO] file: The name of a mp3 file (preferred) or an already opened mp3 file diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 4d968db717..493ff93b09 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -50,6 +50,7 @@ //| `_ //| for information about using the :py:mod:`displayio` module. //| """ +//| STATIC int16_t validate_point(mp_obj_t point, int16_t default_value) { // Checks if point is None and returns default_value, otherwise decodes integer value diff --git a/shared-bindings/bitops/__init__.c b/shared-bindings/bitops/__init__.c index ea4e70ae3a..3107b310db 100644 --- a/shared-bindings/bitops/__init__.c +++ b/shared-bindings/bitops/__init__.c @@ -30,6 +30,7 @@ #include "shared-bindings/bitops/__init__.h" //| """Routines for low-level manipulation of binary data""" +//| //| def bit_transpose( //| input: ReadableBuffer, output: WriteableBuffer, width: int = 8 diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index e4003d4f6b..971ed2f676 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -58,10 +58,12 @@ //| """Board ID string. The unique identifier for the board model in //| circuitpython, as well as on circuitpython.org. //| Example: "hallowing_m0_express".""" +//| //| def I2C() -> busio.I2C: //| """Returns the `busio.I2C` object for the board's designated I2C bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.I2C`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.I2C`. +//| """ //| ... //| #if CIRCUITPY_BOARD_I2C @@ -78,7 +80,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0); //| def SPI() -> busio.SPI: //| """Returns the `busio.SPI` object for the board's designated SPI bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.SPI`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.SPI`. +//| """ //| ... //| #if CIRCUITPY_BOARD_SPI @@ -95,7 +98,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0); //| def UART() -> busio.UART: //| """Returns the `busio.UART` object for the board's designated UART bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.UART`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.UART`. +//| """ //| ... //| #if CIRCUITPY_BOARD_UART diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index de373aaeb4..5cf52eaa1a 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -48,7 +48,6 @@ //| frequency: int = 100000, //| timeout: int = 255 //| ) -> None: -//| //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index af985ed632..ccdceb5760 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -61,7 +61,6 @@ //| MISO: Optional[microcontroller.Pin] = None, //| half_duplex: bool = False, //| ) -> None: -//| //| """Construct an SPI object on the given pins. //| //| .. note:: The SPI peripherals allocated in order of desirability, if possible, diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index 0416e5cb39..ecef7ebde6 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -58,6 +58,7 @@ //| For more information on working with this module, refer to //| `this Learn Guide on using it `_. //| """ +//| #include "py/obj.h" #include "py/enum.h" diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 448aa25b79..47b1de8914 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -41,6 +41,7 @@ //| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"] //| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`""" +//| //| class Display: //| """Manage updating a display over a display bus @@ -282,7 +283,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show //| //| :param Optional[int] target_frames_per_second: The target frame rate that :py:func:`refresh` should try to //| achieve. Set to `None` for immediate refresh. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -445,7 +447,8 @@ MP_PROPERTY_GETSET(displayio_display_root_group_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... //| STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 6fde664670..4745223ad3 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -117,7 +117,8 @@ //| :param float seconds_per_frame: Minimum number of seconds between screen refreshes //| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale -//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length""" +//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length +//| """ //| ... STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 14edf7b0be..f2647b0b16 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -59,7 +59,8 @@ //| //| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines //| :param int device_address: The I2C address of the device -//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used""" +//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used +//| """ //| ... STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_bus, ARG_device_address, ARG_reset }; diff --git a/shared-bindings/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index fedc9c08af..b77fb6d76b 100644 --- a/shared-bindings/dualbank/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -65,6 +65,7 @@ //| dualbank.switch() //| """ //| ... +//| #if CIRCUITPY_STORAGE_EXTEND STATIC void raise_error_if_storage_extended(void) { diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 51124984bf..030b924c1e 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -58,7 +58,8 @@ //| //| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to //| :param bool auto_refresh: Automatically refresh the screen -//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)""" +//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS }; @@ -134,7 +135,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebuffer //| without calls to this.) //| //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -263,7 +265,8 @@ MP_PROPERTY_GETTER(framebufferio_framebufferframebuffer_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_y, ARG_buffer }; diff --git a/shared-bindings/getpass/__init__.c b/shared-bindings/getpass/__init__.c index 340b8fd7c6..811d78e03d 100644 --- a/shared-bindings/getpass/__init__.c +++ b/shared-bindings/getpass/__init__.c @@ -33,9 +33,9 @@ //| //| """ //| ... +//| //| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str: -//| //| """Prompt the user without echoing. //| //| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``. diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c index f385885b4d..e3cbbc39d3 100644 --- a/shared-bindings/hashlib/Hash.c +++ b/shared-bindings/hashlib/Hash.c @@ -49,7 +49,8 @@ MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_ //| def update(self, data: ReadableBuffer) -> None: //| """Update the hash with the given bytes. //| -//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer""" +//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer +//| """ //| ... mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) { mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index fb4c8bf38d..6da5a52299 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -35,6 +35,7 @@ //| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress //| module. //| """ +//| bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t *ip_out) { diff --git a/shared-bindings/is31fl3741/IS31FL3741.c b/shared-bindings/is31fl3741/IS31FL3741.c index 706e3deb2b..17b12da67a 100644 --- a/shared-bindings/is31fl3741/IS31FL3741.c +++ b/shared-bindings/is31fl3741/IS31FL3741.c @@ -141,7 +141,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(is31fl3741_IS31FL3741_set_led_obj, 4, 4, is3 //| """Write buf out on the I2C bus to the IS31FL3741. //| //| :param ~Tuple[int, ...] mapping: map the pixels in the buffer to the order addressed by the driver chip -//| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t is31fl3741_IS31FL3741_write(mp_obj_t self_in, mp_obj_t mapping, mp_obj_t buffer) { diff --git a/shared-bindings/keypad/Event.c b/shared-bindings/keypad/Event.c index 56a5815636..c8d24294f8 100644 --- a/shared-bindings/keypad/Event.c +++ b/shared-bindings/keypad/Event.c @@ -148,7 +148,8 @@ STATIC mp_obj_t keypad_event_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_ob //| def __hash__(self) -> int: //| """Returns a hash for the `Event`, so it can be used in dictionaries, etc.. //| -//| Note that as events with different timestamps compare equal, they also hash to the same value.""" +//| Note that as events with different timestamps compare equal, they also hash to the same value. +//| """ //| ... //| STATIC mp_obj_t keypad_event_unary_op(mp_unary_op_t op, mp_obj_t self_in) { diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 42a32749da..8aee44ffb8 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -86,6 +86,7 @@ STATIC NORETURN void math_error(void) { //| //| pi: float //| """the ratio of a circle's circumference to its diameter""" +//| //| def acos(x: float) -> float: //| """Return the inverse cosine of ``x``.""" diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 12c91cd150..7b05acd095 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -34,6 +34,7 @@ #include "shared-bindings/memorymonitor/AllocationSize.h" //| """Memory monitoring helpers""" +//| //| class AllocationError(Exception): //| """Catchall exception for allocation related errors.""" diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 5716f7270e..2c1fdd5b58 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -60,6 +60,7 @@ //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` //| (clock frequency) on chips with more than 1 cpu. The index selects which cpu. //| This object is an instance of `microcontroller.Processor`.""" +//| //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index d505e3a6d8..7773d6d190 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -84,6 +84,7 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| //| """ +//| //| def pack( //| obj: object, diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index 66c36af34b..cc0e2a041a 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -109,7 +109,8 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { //| """Write buf out on the given DigitalInOut. //| //| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with -//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) { diff --git a/shared-bindings/rainbowio/__init__.c b/shared-bindings/rainbowio/__init__.c index 0dfdcd3a45..324f43198e 100644 --- a/shared-bindings/rainbowio/__init__.c +++ b/shared-bindings/rainbowio/__init__.c @@ -33,7 +33,8 @@ //| //| def colorwheel(n: float) -> int: //| """C implementation of the common colorwheel() function found in many examples. -//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar).""" +//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar). +//| """ //| ... //| STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) { diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index fcf432931e..33cd9e90d0 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -47,6 +47,7 @@ //| from typing import TypeVar //| //| _T = TypeVar("_T") +//| //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index 64adfe7d9e..0220745c0f 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -36,6 +36,7 @@ //| The `rtc` module provides support for a Real Time Clock. You can access and manage the //| RTC using :class:`rtc.RTC`. It also backs the :func:`time.time` and :func:`time.localtime` //| functions using the onboard RTC if present.""" +//| void rtc_reset(void) { MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj; diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 960d4a733e..ce67834774 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -126,7 +126,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -166,7 +165,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_sync_obj, sdcardio_sdcard_sync); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index f4cc4a9bb1..776b20fafe 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -160,7 +160,6 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -182,7 +181,6 @@ STATIC mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index fbf78a4cdc..9d439b5bd4 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -379,7 +379,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, //| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| -//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" +//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely. +//| """ //| ... //| STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index f056c741f3..3023721378 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -52,6 +52,7 @@ //| returned by :py:attr:`wifi.radio` //| """ //| ... +//| STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); diff --git a/shared-bindings/ssl/SSLSocket.c b/shared-bindings/ssl/SSLSocket.c index d6f4ad051c..e0e7911715 100644 --- a/shared-bindings/ssl/SSLSocket.c +++ b/shared-bindings/ssl/SSLSocket.c @@ -240,7 +240,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send); //| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| -//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" +//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely. +//| """ //| ... STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 9204c92790..6967860054 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -36,6 +36,7 @@ //| //| |see_cpython_module| :mod:`cpython:ssl`. //| """ +//| //| def create_default_context() -> ssl.SSLContext: //| """Return the default SSLContext.""" diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 59bc78005d..5b63a15f15 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -46,6 +46,7 @@ //| //| Supported format codes: *b*, *B*, *x*, *h*, *H*, *i*, *I*, *l*, *L*, *q*, *Q*, //| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support).""" +//| //| def calcsize(fmt: str) -> int: diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 37f35e2e18..2c84fbc0dd 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -59,6 +59,7 @@ //| The status bar reports the current IP or BLE connection, what file is running, //| the last exception name and location, and firmware version information. //| This object is the sole instance of `supervisor.StatusBar`.""" +//| //| def reload() -> None: //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index 153587e919..3ad601eb39 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -37,6 +37,7 @@ //| |see_cpython_module| :mod:`cpython:traceback`. //| """ //| ... +//| STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *print, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_exc, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain }; diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 376be78ef1..40aa869225 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/uheap/__init__.h" //| """Heap size analysis""" +//| //| def info(object: object) -> int: //| """Prints memory debugging info for the given object and returns the diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index 84d202945a..faeef23a88 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -40,6 +40,7 @@ //| //| This is a subset of the PyUSB core module. //| """ +//| //| class USBError(OSError): //| """Catchall exception for USB related errors.""" diff --git a/shared-bindings/usb_cdc/__init__.c b/shared-bindings/usb_cdc/__init__.c index e23e289309..b4e712e854 100644 --- a/shared-bindings/usb_cdc/__init__.c +++ b/shared-bindings/usb_cdc/__init__.c @@ -62,6 +62,7 @@ //| """A `Serial` object that can be used to send and receive binary data to and from //| the host. //| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled.""" +//| //| def disable() -> None: //| """Do not present any USB CDC device to the host. diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 9cb9303143..5c61cc52de 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -47,6 +47,7 @@ //| containing a `Device` that describes the boot device chosen (keyboard or mouse). //| The request for a boot device overrides any other HID devices. //| """ +//| //| def disable() -> None: //| """Do not present any USB HID devices to the host computer. diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index 982cd144da..d3d5cf2626 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -42,6 +42,7 @@ //| //| ports: Tuple[Union[PortIn, PortOut], ...] //| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`.""" +//| //| def disable() -> None: //| """Disable presenting a USB MIDI device to the host. diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index b42fb2a614..17bdcbb1c0 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -35,6 +35,7 @@ //| """Stack information and analysis""" +//| #if MICROPY_MAX_STACK_USAGE //| def max_stack_usage() -> int: diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 87cd46ad9a..9896876a8a 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -24,7 +24,8 @@ //| :param int radius: The radius of the circle in pixels //| :param int x: Initial x position of the axis. //| :param int y: Initial y position of the axis. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 6ad102e6e6..b188fc4955 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -32,7 +32,8 @@ //| :param List[Tuple[int,int]] points: Vertices for the polygon //| :param int x: Initial screen x position of the 0,0 origin in the points list. //| :param int y: Initial screen y position of the 0,0 origin in the points list. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index a4f3e12e69..ad864f2c2d 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -25,7 +25,8 @@ //| :param int height: The number of pixels high //| :param int x: Initial x position of the top left corner. //| :param int y: Initial y position of the top left corner. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c index df55ab7c16..5281f1c3fc 100644 --- a/shared-bindings/watchdog/__init__.c +++ b/shared-bindings/watchdog/__init__.c @@ -49,6 +49,7 @@ //| w.timeout=2.5 # Set a timeout of 2.5 seconds //| w.mode = WatchDogMode.RAISE //| w.feed()""" +//| //| class WatchDogTimeout(Exception): //| """Exception raised when the watchdog timer is set to diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index d9c2a01810..ba02914638 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -46,6 +46,7 @@ //| The `zlib` module allows limited functionality similar to the CPython zlib library. //| This module allows to decompress binary data compressed with DEFLATE algorithm //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" +//| //| def zlib_decompress( //| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 diff --git a/tests/extmod/framebuf_subclass.py b/tests/extmod/framebuf_subclass.py index a9e3c5efc7..4cd9ea4eb5 100644 --- a/tests/extmod/framebuf_subclass.py +++ b/tests/extmod/framebuf_subclass.py @@ -34,6 +34,7 @@ fb.pixel(2, 2, 0x0708) fb2.blit(fb, 0, 0) print(bytes(fb2)) + # Test that blitting something that isn't a subclass fails with TypeError. class NotAFrameBuf: pass diff --git a/tests/extmod/uasyncio_exception.py b/tests/extmod/uasyncio_exception.py index aae55d6320..4e4f978dc2 100644 --- a/tests/extmod/uasyncio_exception.py +++ b/tests/extmod/uasyncio_exception.py @@ -9,6 +9,7 @@ except ImportError: print("SKIP") raise SystemExit + # main task raising an exception async def main(): print("main start") @@ -21,6 +22,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # sub-task raising an exception async def task(): print("task start") @@ -40,6 +42,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # main task raising an exception with sub-task not yet scheduled # TODO not currently working, task is never scheduled async def task(): diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 10e92d6940..935f01d24f 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index 7c75a6d044..6094b5a6f1 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index 1b7b04ee63..f5de729402 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -12,7 +12,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index e447ff4eb3..1998319dbe 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS_OLD: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 4b79391102..a22d480dfd 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisklarge.py b/tests/extmod/vfs_fat_ramdisklarge.py index 69d4a8cbbd..649a53db14 100644 --- a/tests/extmod/vfs_fat_ramdisklarge.py +++ b/tests/extmod/vfs_fat_ramdisklarge.py @@ -14,7 +14,6 @@ except AttributeError: class RAMBDevSparse: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/import/module_getattr.py b/tests/import/module_getattr.py index df7a621815..9ca0d18455 100644 --- a/tests/import/module_getattr.py +++ b/tests/import/module_getattr.py @@ -8,6 +8,7 @@ try: except AttributeError: pass + # define __getattr__ def __getattr__(attr): if attr == "does_not_exist": diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py index 6535a495d4..208709a25f 100644 --- a/tests/inlineasm/asmsum.py +++ b/tests/inlineasm/asmsum.py @@ -1,6 +1,5 @@ @micropython.asm_thumb def asm_sum_words(r0, r1): - # r0 = len # r1 = ptr # r2 = sum @@ -25,7 +24,6 @@ def asm_sum_words(r0, r1): @micropython.asm_thumb def asm_sum_bytes(r0, r1): - # r0 = len # r1 = ptr # r2 = sum diff --git a/tests/micropython/const2.py b/tests/micropython/const2.py index ed4720122e..d8b68c25f3 100644 --- a/tests/micropython/const2.py +++ b/tests/micropython/const2.py @@ -11,6 +11,7 @@ import micropython as X print(globals()["X"]) + # function name that matches a constant def X(): print("function X", X) @@ -18,6 +19,7 @@ def X(): globals()["X"]() + # arguments that match a constant def f(X, *Y, **Z): pass @@ -25,6 +27,7 @@ def f(X, *Y, **Z): f(1) + # class name that matches a constant class X: def f(self): @@ -33,6 +36,7 @@ class X: globals()["X"]().f() + # constant within a class class A: C1 = const(4) diff --git a/tests/micropython/heapalloc_yield_from.py b/tests/micropython/heapalloc_yield_from.py index 58788b1dbc..9507171890 100644 --- a/tests/micropython/heapalloc_yield_from.py +++ b/tests/micropython/heapalloc_yield_from.py @@ -2,6 +2,7 @@ import micropython + # Yielding from a function generator def sub_gen(a): for i in range(a): @@ -18,6 +19,7 @@ print(next(g)) print(next(g)) micropython.heap_unlock() + # Yielding from a user iterator class G: def __init__(self): diff --git a/tests/micropython/native_closure.py b/tests/micropython/native_closure.py index 07014e90da..8182cfea70 100644 --- a/tests/micropython/native_closure.py +++ b/tests/micropython/native_closure.py @@ -1,5 +1,6 @@ # test native emitter can handle closures correctly + # basic closure @micropython.native def f(): @@ -15,6 +16,7 @@ def f(): print(f()()) + # closing over an argument @micropython.native def f(x): @@ -28,6 +30,7 @@ def f(x): print(f(2)()) + # closing over an argument and a normal local @micropython.native def f(x): diff --git a/tests/micropython/native_gen.py b/tests/micropython/native_gen.py index fb42f9e25e..7ea45b1497 100644 --- a/tests/micropython/native_gen.py +++ b/tests/micropython/native_gen.py @@ -1,5 +1,6 @@ # test for native generators + # simple generator with yield and return @micropython.native def gen1(x): @@ -16,6 +17,7 @@ try: except StopIteration as e: print(e.args[0]) + # using yield from @micropython.native def gen2(x): diff --git a/tests/micropython/native_misc.py b/tests/micropython/native_misc.py index f5ef807fe1..f40fcb2407 100644 --- a/tests/micropython/native_misc.py +++ b/tests/micropython/native_misc.py @@ -1,5 +1,6 @@ # tests for natively compiled functions + # basic test @micropython.native def native_test(x): @@ -14,6 +15,7 @@ import gc gc.collect() native_test(3) + # native with 2 args @micropython.native def f(a, b): @@ -22,6 +24,7 @@ def f(a, b): f(1, 2) + # native with 3 args @micropython.native def f(a, b, c): @@ -30,6 +33,7 @@ def f(a, b, c): f(1, 2, 3) + # check not operator @micropython.native def f(a): diff --git a/tests/micropython/native_try.py b/tests/micropython/native_try.py index 492b59085c..6a2152b28c 100644 --- a/tests/micropython/native_try.py +++ b/tests/micropython/native_try.py @@ -1,5 +1,6 @@ # test native try handling + # basic try-finally @micropython.native def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.native def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.native def f(): diff --git a/tests/micropython/native_try_deep.py b/tests/micropython/native_try_deep.py index 3d31248df0..26b9243e03 100644 --- a/tests/micropython/native_try_deep.py +++ b/tests/micropython/native_try_deep.py @@ -1,5 +1,6 @@ # test native try handling + # deeply nested try (9 deep) @micropython.native def f(): diff --git a/tests/micropython/native_with.py b/tests/micropython/native_with.py index 4e20b23856..9c0b98af90 100644 --- a/tests/micropython/native_with.py +++ b/tests/micropython/native_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.native def f(): diff --git a/tests/micropython/viper_args.py b/tests/micropython/viper_args.py index 8e3225331a..27c73fa795 100644 --- a/tests/micropython/viper_args.py +++ b/tests/micropython/viper_args.py @@ -56,6 +56,7 @@ def f6(x1: int, x2: int, x3: int, x4: int, x5: int, x6: int): f6(1, 2, 3, 4, 5, 6) + # test compiling *x, **x, * args (currently unsupported at runtime) @micropython.viper def f(*x, **y): diff --git a/tests/micropython/viper_cond.py b/tests/micropython/viper_cond.py index d5ebf837bd..752261ff50 100644 --- a/tests/micropython/viper_cond.py +++ b/tests/micropython/viper_cond.py @@ -10,6 +10,7 @@ def f(): f() + # using True as a conditional @micropython.viper def f(): @@ -20,6 +21,7 @@ def f(): f() + # using an int as a conditional @micropython.viper def g(): @@ -30,6 +32,7 @@ def g(): g() + # using an int as a conditional that has the lower 16-bits clear @micropython.viper def h(): diff --git a/tests/micropython/viper_misc.py b/tests/micropython/viper_misc.py index 41389c751d..f9267f65ca 100644 --- a/tests/micropython/viper_misc.py +++ b/tests/micropython/viper_misc.py @@ -1,5 +1,6 @@ import micropython + # viper function taking and returning ints @micropython.viper def viper_int(x: int, y: int) -> int: @@ -8,6 +9,7 @@ def viper_int(x: int, y: int) -> int: print(viper_int(1, 2)) + # viper function taking and returning objects @micropython.viper def viper_object(x: object, y: object) -> object: @@ -16,6 +18,7 @@ def viper_object(x: object, y: object) -> object: print(viper_object(1, 2)) + # return None as non-object (should return 0) @micropython.viper def viper_ret_none() -> int: @@ -24,6 +27,7 @@ def viper_ret_none() -> int: print(viper_ret_none()) + # return Ellipsis as object @micropython.viper def viper_ret_ellipsis() -> object: @@ -32,6 +36,7 @@ def viper_ret_ellipsis() -> object: print(viper_ret_ellipsis()) + # 3 args @micropython.viper def viper_3args(a: int, b: int, c: int) -> int: @@ -40,6 +45,7 @@ def viper_3args(a: int, b: int, c: int) -> int: print(viper_3args(1, 2, 3)) + # 4 args @micropython.viper def viper_4args(a: int, b: int, c: int, d: int) -> int: @@ -49,6 +55,7 @@ def viper_4args(a: int, b: int, c: int, d: int) -> int: # viper call with 4 args not yet supported # print(viper_4args(1, 2, 3, 4)) + # a local (should have automatic type int) @micropython.viper def viper_local(x: int) -> int: @@ -58,6 +65,7 @@ def viper_local(x: int) -> int: print(viper_local(3)) + # without type annotation, types should default to object @micropython.viper def viper_no_annotation(x, y): @@ -66,6 +74,7 @@ def viper_no_annotation(x, y): print(viper_no_annotation(4, 5)) + # a for loop @micropython.viper def viper_for(a: int, b: int) -> int: @@ -77,6 +86,7 @@ def viper_for(a: int, b: int) -> int: print(viper_for(10, 10000)) + # accessing a global @micropython.viper def viper_access_global(): @@ -87,6 +97,7 @@ def viper_access_global(): print(viper_access_global(), gl) + # calling print with object and int types @micropython.viper def viper_print(x, y: int): @@ -95,6 +106,7 @@ def viper_print(x, y: int): viper_print(1, 2) + # convert constants to objects in tuple @micropython.viper def viper_tuple_consts(x): @@ -103,6 +115,7 @@ def viper_tuple_consts(x): print(viper_tuple_consts(0)) + # making a tuple from an object and an int @micropython.viper def viper_tuple(x, y: int): @@ -111,6 +124,7 @@ def viper_tuple(x, y: int): print(viper_tuple(1, 2)) + # making a list from an object and an int @micropython.viper def viper_list(x, y: int): @@ -119,6 +133,7 @@ def viper_list(x, y: int): print(viper_list(1, 2)) + # making a set from an object and an int @micropython.viper def viper_set(x, y: int): @@ -127,6 +142,7 @@ def viper_set(x, y: int): print(sorted(list(viper_set(1, 2)))) + # raising an exception @micropython.viper def viper_raise(x: int): @@ -138,6 +154,7 @@ try: except OSError as e: print(repr(e)) + # calling GC after defining the function @micropython.viper def viper_gc() -> int: diff --git a/tests/micropython/viper_misc2.py b/tests/micropython/viper_misc2.py index 8f0be487d6..cc77134bd4 100644 --- a/tests/micropython/viper_misc2.py +++ b/tests/micropython/viper_misc2.py @@ -1,5 +1,6 @@ # Miscellaneous viper tests + # Test correct use of registers in load and store @micropython.viper def expand(dest: ptr8, source: ptr8, length: int): diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py index 055c08d8e5..91673f2c10 100644 --- a/tests/micropython/viper_misc_intbig.py +++ b/tests/micropython/viper_misc_intbig.py @@ -1,5 +1,6 @@ import micropython + # unsigned ints @micropython.viper def viper_uint() -> uint: diff --git a/tests/micropython/viper_try.py b/tests/micropython/viper_try.py index 61335af221..f5822a6682 100644 --- a/tests/micropython/viper_try.py +++ b/tests/micropython/viper_try.py @@ -1,5 +1,6 @@ # test try handling within a viper function + # basic try-finally @micropython.viper def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.viper def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.viper def f(): diff --git a/tests/micropython/viper_types.py b/tests/micropython/viper_types.py index 3af148171e..3e0a4f6640 100644 --- a/tests/micropython/viper_types.py +++ b/tests/micropython/viper_types.py @@ -2,6 +2,7 @@ import micropython + # converting incoming arg to bool @micropython.viper def f1(x: bool): @@ -13,6 +14,7 @@ f1(1) f1([]) f1([1]) + # taking and returning a bool @micropython.viper def f2(x: bool) -> bool: @@ -22,6 +24,7 @@ def f2(x: bool) -> bool: print(f2([])) print(f2([1])) + # converting to bool within function @micropython.viper def f3(x) -> bool: diff --git a/tests/micropython/viper_with.py b/tests/micropython/viper_with.py index d640c8ae0f..40fbf6fb31 100644 --- a/tests/micropython/viper_with.py +++ b/tests/micropython/viper_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.viper def f(): diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index cff1894106..1c3706ec33 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -111,6 +111,7 @@ try: except NotImplementedError: print("NotImplementedError") + # can't assign attributes to a function def f(): pass @@ -127,6 +128,7 @@ try: except TypeError: print("TypeError") + # test when object explicitly listed at not-last position in parent tuple # this is not compliant with CPython because of illegal MRO class A: @@ -140,6 +142,7 @@ class B(object, A): B().foo() + # can't assign property (or other special accessors) to already-subclassed class class A: pass diff --git a/tests/misc/sys_settrace_generator.py b/tests/misc/sys_settrace_generator.py index 43065df4ae..1199f1f4eb 100644 --- a/tests/misc/sys_settrace_generator.py +++ b/tests/misc/sys_settrace_generator.py @@ -48,11 +48,9 @@ def test_generator(): gen = make_gen() r = 0 try: - r += gen.send(None) while True: - r += gen.send(None) except StopIteration as e: diff --git a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py index a60ca955d7..fcf034af25 100644 --- a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py +++ b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py @@ -1,5 +1,6 @@ print("Now comes the language constructions tests.") + # function def test_func(): def test_sub_func(): diff --git a/tests/perf_bench/bm_nqueens.py b/tests/perf_bench/bm_nqueens.py index 773dd3f7ed..160f1178aa 100644 --- a/tests/perf_bench/bm_nqueens.py +++ b/tests/perf_bench/bm_nqueens.py @@ -5,6 +5,7 @@ # author: collinwinter@google.com (Collin Winter) # n_queens function: Copyright 2009 Raymond Hettinger + # Pure-Python implementation of itertools.permutations(). def permutations(iterable, r=None): """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)""" diff --git a/tests/perf_bench/misc_aes.py b/tests/perf_bench/misc_aes.py index 0743737cb7..8a9c58bb38 100644 --- a/tests/perf_bench/misc_aes.py +++ b/tests/perf_bench/misc_aes.py @@ -33,6 +33,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -64,6 +65,7 @@ def aes_r_con(a): ################################################################## # basic AES algorithm; see FIPS-197 + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/run-internalbench.py b/tests/run-internalbench.py index 606fc3b772..24f6d5a771 100755 --- a/tests/run-internalbench.py +++ b/tests/run-internalbench.py @@ -26,7 +26,6 @@ def run_tests(pyb, test_dict): for base_test, tests in sorted(test_dict.items()): print(base_test + ":") for test_file in tests: - # run MicroPython if pyb is None: # run on PC diff --git a/tests/stress/qstr_limit.py b/tests/stress/qstr_limit.py index d8ce0cf7cd..08b10a039f 100644 --- a/tests/stress/qstr_limit.py +++ b/tests/stress/qstr_limit.py @@ -17,6 +17,7 @@ for l in range(254, 259): continue print(var in g) + # calling a function with kwarg def f(**k): print(k) @@ -36,6 +37,7 @@ for l in range(254, 259): except RuntimeError: print("RuntimeError", l) + # hasattr, setattr, getattr class A: pass diff --git a/tests/stress/recursive_gen.py b/tests/stress/recursive_gen.py index 8c21397658..e051abb84d 100644 --- a/tests/stress/recursive_gen.py +++ b/tests/stress/recursive_gen.py @@ -1,5 +1,6 @@ # test deeply recursive generators + # simple "yield from" recursion def gen(): yield from gen() @@ -10,6 +11,7 @@ try: except RuntimeError: print("RuntimeError") + # recursion via an iterator over a generator def gen2(): for x in gen2(): diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py index 9b52e0c016..7bacabec3a 100644 --- a/tests/thread/mutate_bytearray.py +++ b/tests/thread/mutate_bytearray.py @@ -9,6 +9,7 @@ import _thread # the shared bytearray ba = bytearray() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_dict.py b/tests/thread/mutate_dict.py index 0840dcafba..fb87190e77 100644 --- a/tests/thread/mutate_dict.py +++ b/tests/thread/mutate_dict.py @@ -9,6 +9,7 @@ import _thread # the shared dict di = {"a": "A", "b": "B", "c": "C", "d": "D"} + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py index 8ba91cbde3..cc0ad9885d 100644 --- a/tests/thread/mutate_instance.py +++ b/tests/thread/mutate_instance.py @@ -6,6 +6,7 @@ import _thread + # the shared user class and instance class User: def __init__(self): @@ -16,6 +17,7 @@ class User: user = User() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_list.py b/tests/thread/mutate_list.py index 8ce15c0852..4df86b3008 100644 --- a/tests/thread/mutate_list.py +++ b/tests/thread/mutate_list.py @@ -9,6 +9,7 @@ import _thread # the shared list li = list() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_set.py b/tests/thread/mutate_set.py index 61169b8aa9..587a3a259a 100644 --- a/tests/thread/mutate_set.py +++ b/tests/thread/mutate_set.py @@ -9,6 +9,7 @@ import _thread # the shared set se = set([-1, -2, -3, -4]) + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index 673337563d..199fe3c88c 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -40,6 +40,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -82,6 +83,7 @@ def aes_r_con(a): # using OCB, where the sequence is xored against the plaintext. # Care must be taken to (almost) always choose a different IV. + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 2099f94bdb..9e7d7f0326 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -10,6 +10,7 @@ except ImportError: import time import _thread + # function to check the interned string def check(s, val): assert type(s) == str diff --git a/tests/unicode/unicode_id.py b/tests/unicode/unicode_id.py index 3a58e3f72b..32817287e9 100644 --- a/tests/unicode/unicode_id.py +++ b/tests/unicode/unicode_id.py @@ -10,6 +10,7 @@ bβ = 3 βb = 4 print(α, αβγ, bβ, βb) + # function, argument, local identifiers def α(β, γ): δ = β + γ @@ -18,6 +19,7 @@ def α(β, γ): α(1, 2) + # class, method identifiers class φ: def __init__(self): diff --git a/tools/codeformat.py b/tools/codeformat.py index 223c2bad45..f76e5f0681 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -71,6 +71,7 @@ EXCLUSIONS = [ "ports/raspberrypi/lwip_src", ] + # None of the standard Python path matching routines implement the matching # we want, which is most like git's "pathspec" version of globs. # In particular, we want "**/" to match all directories. diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 5f4f9c9561..e6bc703c02 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -215,7 +215,7 @@ def convert_folder(top_level, stub_directory): return (ok, total) error = False - for (level, msg) in find_stub_issues(tree): + for level, msg in find_stub_issues(tree): if level == "ERROR": error = True print(f"[{level}] {msg}") diff --git a/tools/gen_crt_bundle.py b/tools/gen_crt_bundle.py index eb314bf25e..da0d8837a9 100755 --- a/tools/gen_crt_bundle.py +++ b/tools/gen_crt_bundle.py @@ -72,7 +72,6 @@ class CertificateBundle: os.remove(ca_bundle_bin_file) def add_from_path(self, crts_path): - found = False for file_path in os.listdir(crts_path): found |= self.add_from_file(os.path.join(crts_path, file_path)) @@ -161,7 +160,6 @@ class CertificateBundle: return bundle def add_with_filter(self, crts_path, filter_path): - filter_set = set() with open(filter_path, "r", encoding="utf-8") as f: csv_reader = csv.reader(f, delimiter=",") diff --git a/tools/gendoc.py b/tools/gendoc.py index bf79b3cf5f..f3df853e49 100644 --- a/tools/gendoc.py +++ b/tools/gendoc.py @@ -11,6 +11,7 @@ import argparse import re import markdown + # given a list of (name,regex) pairs, find the first one that matches the given line def re_match_first(regexs, line): for name, regex in regexs: diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 32b064d35f..02ea656c99 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -107,6 +107,7 @@ MP_BC_LOAD_GLOBAL = 0x12 MP_BC_LOAD_ATTR = 0x13 MP_BC_STORE_ATTR = 0x18 + # this function mirrors that in py/bc.c def mp_opcode_format(bytecode, ip, count_var_uint): opcode = bytecode[ip] diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index 30263d2e02..6c41c4cd43 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -46,7 +46,6 @@ def version_string(path=None, *, valid_semver=False): # with actual version info derived from git. def copy_and_process(in_dir, out_dir): for root, subdirs, files in os.walk(in_dir): - # Skip library examples directory and subfolders. relative_path_parts = Path(root).relative_to(in_dir).parts if relative_path_parts and relative_path_parts[0] in [