Merge pull request #7532 from MicroDev1/format

Run updated pre-commit
This commit is contained in:
Dan Halbert 2023-02-01 09:52:28 -05:00 committed by GitHub
commit 5657fb0913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 237 additions and 93 deletions

View File

@ -45,6 +45,7 @@
//| Non-Espressif microcontrollers use the `imagecapture` module together with wrapper libraries such as `adafruit_ov5640 <https://circuitpython.readthedocs.io/projects/ov5640/en/latest/>`_. //| Non-Espressif microcontrollers use the `imagecapture` module together with wrapper libraries such as `adafruit_ov5640 <https://circuitpython.readthedocs.io/projects/ov5640/en/latest/>`_.
//| //|
//| """ //| """
//|
//| class GrabMode: //| class GrabMode:
//| """Controls when a new frame is grabbed.""" //| """Controls when a new frame is grabbed."""

View File

@ -37,6 +37,7 @@
//| """Direct access to a few ESP-IDF details. This module *should not* include any functionality //| """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 //| that could be implemented by other frameworks. It should only include ESP-IDF specific
//| things.""" //| things."""
//|
//| def heap_caps_get_total_size() -> int: //| def heap_caps_get_total_size() -> int:
//| """Return the total size of the ESP-IDF, which includes the CircuitPython heap.""" //| """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` //| """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 //| 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) { STATIC mp_obj_t espidf_erase_nvs(void) {
ESP_ERROR_CHECK(nvs_flash_deinit()); ESP_ERROR_CHECK(nvs_flash_deinit());

View File

@ -94,7 +94,6 @@
//| wrap_target: int = 0, //| wrap_target: int = 0,
//| wrap: int = -1, //| wrap: int = -1,
//| ) -> None: //| ) -> None:
//|
//| """Construct a StateMachine object on the given pins with the given program. //| """Construct a StateMachine object on the given pins with the given program.
//| //|
//| :param ReadableBuffer program: the program to run with the state machine //| :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_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 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_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) { STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -38,6 +38,7 @@
//| Learn guide <https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython>`_. //| Learn guide <https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython>`_.
//| //|
//| """ //| """
//|
//| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool: //| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool:
//| """Return True if the pins have sequential GPIO numbers, False otherwise""" //| """Return True if the pins have sequential GPIO numbers, False otherwise"""

View File

@ -44,6 +44,7 @@ PASS = "PASS"
FAIL = "FAIL" FAIL = "FAIL"
NA = "N/A" NA = "N/A"
# Determine if given value is a number # Determine if given value is a number
def _is_number(val): def _is_number(val):
try: try:
@ -61,7 +62,6 @@ def _deinit_pins(gpios):
# Toggle IO pins while waiting for answer # Toggle IO pins while waiting for answer
def _toggle_wait(pin_gpios): def _toggle_wait(pin_gpios):
timestamp = time.monotonic() timestamp = time.monotonic()
led_state = False led_state = False
failed = [] failed = []
@ -96,7 +96,6 @@ def buildPin(pin):
def run_test(pins): def run_test(pins):
""" """
Toggles all available GPIO on and off repeatedly. Toggles all available GPIO on and off repeatedly.
@ -114,7 +113,6 @@ def run_test(pins):
gpio_pins = analog_pins + digital_pins gpio_pins = analog_pins + digital_pins
if gpio_pins: if gpio_pins:
# Print out the LEDs found # Print out the LEDs found
print("GPIO pins found:", end=" ") print("GPIO pins found:", end=" ")
for pin in gpio_pins: for pin in gpio_pins:

View File

@ -31,6 +31,7 @@ import sys
# #
# See examples/stm32f405.csv for example formatting. # See examples/stm32f405.csv for example formatting.
# Most peripherals (SPI, I2C) output 3 values: # Most peripherals (SPI, I2C) output 3 values:
# peripheral index, alt function, pin string # peripheral index, alt function, pin string
def evaluate_periph(inper, inlist, periph, subtype, altfn, pin): def evaluate_periph(inper, inlist, periph, subtype, altfn, pin):

View File

@ -59,7 +59,6 @@ def maybe_preprocess(command, output_dir, fn):
if __name__ == "__main__": if __name__ == "__main__":
idx1 = sys.argv.index("--") idx1 = sys.argv.index("--")
idx2 = sys.argv.index("--", idx1 + 1) idx2 = sys.argv.index("--", idx1 + 1)
output_dir = sys.argv[1] output_dir = sys.argv[1]

View File

@ -249,6 +249,7 @@ static_qstr_list = [
"zip", "zip",
] ]
# this must match the equivalent function in qstr.c # this must match the equivalent function in qstr.c
def compute_hash(qstr, bytes_hash): def compute_hash(qstr, bytes_hash):
hash = 5381 hash = 5381

View File

@ -84,6 +84,7 @@ C_ESCAPES = {
'"': '\\"', '"': '\\"',
} }
# this must match the equivalent function in qstr.c # this must match the equivalent function in qstr.c
def compute_hash(qstr, bytes_hash): def compute_hash(qstr, bytes_hash):
hash = 5381 hash = 5381
@ -277,7 +278,7 @@ def compute_huffman_coding(translation_name, translations, f):
counter = collections.Counter() counter = collections.Counter()
for t in texts: for t in texts:
for (found, word) in extractor.iter_words(t): for found, word in extractor.iter_words(t):
if not found: if not found:
for substr in iter_substrings(word, minlen=2, maxlen=11): for substr in iter_substrings(word, minlen=2, maxlen=11):
counter[substr] += 1 counter[substr] += 1

View File

@ -256,7 +256,8 @@ MP_PROPERTY_GETTER(bleio_characteristic_service_obj,
//| """Set the remote characteristic's CCCD to enable or disable notification and indication. //| """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 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) { 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]); bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);

View File

@ -47,7 +47,6 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
//| def __init__( //| def __init__(
//| self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64 //| self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64
//| ) -> None: //| ) -> None:
//|
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
//| add the newly-written bytes to a FIFO buffer. //| add the newly-written bytes to a FIFO buffer.
//| //|

View File

@ -54,7 +54,8 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
//| ... //| ...
//| def __next__(self) -> ScanEntry: //| def __next__(self) -> ScanEntry:
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still //| """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.
//| """
//| ... //| ...
//| //|

View File

@ -58,6 +58,7 @@
//| adapter: Adapter //| adapter: Adapter
//| """BLE Adapter used to manage device discovery and connections. //| """BLE Adapter used to manage device discovery and connections.
//| This object is the sole instance of `_bleio.Adapter`.""" //| This object is the sole instance of `_bleio.Adapter`."""
//|
//| class BluetoothError(Exception): //| class BluetoothError(Exception):
//| """Catchall exception for Bluetooth related errors.""" //| """Catchall exception for Bluetooth related errors."""

View File

@ -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 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 //| :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) { 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. //| :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) { 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 //| :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) { 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: //| def BitmapSource(self, addr: int) -> None:
//| """Set the source address for bitmap graphics //| """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) { 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. //| 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) { 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. //| 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) { 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 //| :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) { 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. //| 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) { 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. //| 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) { 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 //| :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) { 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 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) //| :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) { 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 //| :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) { 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 //| :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) { 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 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 //| :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) { 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 //| :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) { 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 //| :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) { STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
uint32_t s = mp_obj_get_int_truncated(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 //| :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) { 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 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 //| :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) { 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 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 //| :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) { 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: //| def End(self) -> None:
//| """End drawing a graphics primitive //| """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) { 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 //| :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) { 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 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 //| :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) { 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 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 //| :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) { 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 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 //| :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) { 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 //| :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) { 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 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) //| :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) { 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 //| :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) { 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 //| :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) { 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 //| :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) { 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 //| :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) { 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 //| :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) { 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 //| :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 //| :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`.
//| """
//| ... //| ...
// } // }

View File

@ -43,7 +43,6 @@
//| """I2C Device Manager""" //| """I2C Device Manager"""
//| //|
//| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None: //| 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 //| """Represents a single I2C device and manages locking the bus and the device
//| address. //| address.
//| //|

View File

@ -51,7 +51,6 @@
//| phase: int = 0, //| phase: int = 0,
//| extra_clocks: int = 0 //| extra_clocks: int = 0
//| ) -> None: //| ) -> None:
//|
//| """ //| """
//| Represents a single SPI device and manages locking the bus and the device address. //| Represents a single SPI device and manages locking the bus and the device address.
//| //|

View File

@ -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 float brightness: Brightness (0 to 1.0, default 1.0)
//| :param bool auto_write: Whether to automatically write pixels (Default False) //| :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 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) { 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 }; enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer };

View File

@ -73,6 +73,7 @@
//| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep. //| """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``. //| 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. // wake_alarm is implemented as a dictionary entry, so there's no code here.

View File

@ -37,11 +37,11 @@
//| |see_cpython_module| :mod:`cpython:atexit`. //| |see_cpython_module| :mod:`cpython:atexit`.
//| """ //| """
//| ... //| ...
//|
//| def register( //| def register(
//| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any] //| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any]
//| ) -> Callable[..., Any]: //| ) -> Callable[..., Any]:
//|
//| """Register func as a function to be executed at termination. //| """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()`. //| 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); STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register);
//| def unregister(func: Callable[..., Any]) -> None: //| def unregister(func: Callable[..., Any]) -> None:
//|
//| """Remove func from the list of functions to be run at termination. //| """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, //| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once,

View File

@ -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`. //| 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) { 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 }; enum { ARG_sample, ARG_loop };

View File

@ -45,7 +45,6 @@
//| """ //| """
//| //|
//| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: //| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None:
//|
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| """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 //| :param Union[str, typing.BinaryIO] file: The name of a mp3 file (preferred) or an already opened mp3 file

View File

@ -50,6 +50,7 @@
//| <https://learn.adafruit.com/circuitpython-display-support-using-displayio>`_ //| <https://learn.adafruit.com/circuitpython-display-support-using-displayio>`_
//| for information about using the :py:mod:`displayio` module. //| for information about using the :py:mod:`displayio` module.
//| """ //| """
//|
STATIC int16_t validate_point(mp_obj_t point, int16_t default_value) { 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 // Checks if point is None and returns default_value, otherwise decodes integer value

View File

@ -30,6 +30,7 @@
#include "shared-bindings/bitops/__init__.h" #include "shared-bindings/bitops/__init__.h"
//| """Routines for low-level manipulation of binary data""" //| """Routines for low-level manipulation of binary data"""
//|
//| def bit_transpose( //| def bit_transpose(
//| input: ReadableBuffer, output: WriteableBuffer, width: int = 8 //| input: ReadableBuffer, output: WriteableBuffer, width: int = 8

View File

@ -58,10 +58,12 @@
//| """Board ID string. The unique identifier for the board model in //| """Board ID string. The unique identifier for the board model in
//| circuitpython, as well as on circuitpython.org. //| circuitpython, as well as on circuitpython.org.
//| Example: "hallowing_m0_express".""" //| Example: "hallowing_m0_express"."""
//|
//| def I2C() -> busio.I2C: //| def I2C() -> busio.I2C:
//| """Returns the `busio.I2C` object for the board's designated I2C bus(es). //| """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 #if CIRCUITPY_BOARD_I2C
@ -78,7 +80,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0);
//| def SPI() -> busio.SPI: //| def SPI() -> busio.SPI:
//| """Returns the `busio.SPI` object for the board's designated SPI bus(es). //| """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 #if CIRCUITPY_BOARD_SPI
@ -95,7 +98,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0);
//| def UART() -> busio.UART: //| def UART() -> busio.UART:
//| """Returns the `busio.UART` object for the board's designated UART bus(es). //| """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 #if CIRCUITPY_BOARD_UART

View File

@ -48,7 +48,6 @@
//| frequency: int = 100000, //| frequency: int = 100000,
//| timeout: int = 255 //| timeout: int = 255
//| ) -> None: //| ) -> None:
//|
//| """I2C is a two-wire protocol for communicating between devices. At the //| """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 //| physical level it consists of 2 wires: SCL and SDA, the clock and data
//| lines respectively. //| lines respectively.

View File

@ -61,7 +61,6 @@
//| MISO: Optional[microcontroller.Pin] = None, //| MISO: Optional[microcontroller.Pin] = None,
//| half_duplex: bool = False, //| half_duplex: bool = False,
//| ) -> None: //| ) -> None:
//|
//| """Construct an SPI object on the given pins. //| """Construct an SPI object on the given pins.
//| //|
//| .. note:: The SPI peripherals allocated in order of desirability, if possible, //| .. note:: The SPI peripherals allocated in order of desirability, if possible,

View File

@ -58,6 +58,7 @@
//| For more information on working with this module, refer to //| For more information on working with this module, refer to
//| `this Learn Guide on using it <https://learn.adafruit.com/using-canio-circuitpython>`_. //| `this Learn Guide on using it <https://learn.adafruit.com/using-canio-circuitpython>`_.
//| """ //| """
//|
#include "py/obj.h" #include "py/obj.h"
#include "py/enum.h" #include "py/enum.h"

View File

@ -41,6 +41,7 @@
//| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"] //| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"]
//| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`""" //| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`"""
//|
//| class Display: //| class Display:
//| """Manage updating a display over a display bus //| """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 //| :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. //| 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) { 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 }; 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 //| """Extract the pixels from a single row
//| //|
//| :param int y: The top edge of the area //| :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) { STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -117,7 +117,8 @@
//| :param float seconds_per_frame: Minimum number of seconds between screen refreshes //| :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 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 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) { 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, enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height,

View File

@ -59,7 +59,8 @@
//| //|
//| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines //| :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 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) { 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 }; enum { ARG_i2c_bus, ARG_device_address, ARG_reset };

View File

@ -65,6 +65,7 @@
//| dualbank.switch() //| dualbank.switch()
//| """ //| """
//| ... //| ...
//|
#if CIRCUITPY_STORAGE_EXTEND #if CIRCUITPY_STORAGE_EXTEND
STATIC void raise_error_if_storage_extended(void) { STATIC void raise_error_if_storage_extended(void) {

View File

@ -58,7 +58,8 @@
//| //|
//| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to //| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to
//| :param bool auto_refresh: Automatically refresh the screen //| :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) { 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 }; 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.) //| 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 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) { 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 }; 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 //| """Extract the pixels from a single row
//| //|
//| :param int y: The top edge of the area //| :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) { 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 }; enum { ARG_y, ARG_buffer };

View File

@ -33,9 +33,9 @@
//| //|
//| """ //| """
//| ... //| ...
//|
//| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str: //| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str:
//|
//| """Prompt the user without echoing. //| """Prompt the user without echoing.
//| //|
//| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``. //| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``.

View File

@ -49,7 +49,8 @@ MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_
//| def update(self, data: ReadableBuffer) -> None: //| def update(self, data: ReadableBuffer) -> None:
//| """Update the hash with the given bytes. //| """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_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)); mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type));

View File

@ -35,6 +35,7 @@
//| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress //| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress
//| module. //| module.
//| """ //| """
//|
bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t *ip_out) { bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t *ip_out) {

View File

@ -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. //| """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 ~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) { STATIC mp_obj_t is31fl3741_IS31FL3741_write(mp_obj_t self_in, mp_obj_t mapping, mp_obj_t buffer) {

View File

@ -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: //| def __hash__(self) -> int:
//| """Returns a hash for the `Event`, so it can be used in dictionaries, etc.. //| """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) { STATIC mp_obj_t keypad_event_unary_op(mp_unary_op_t op, mp_obj_t self_in) {

View File

@ -86,6 +86,7 @@ STATIC NORETURN void math_error(void) {
//| //|
//| pi: float //| pi: float
//| """the ratio of a circle's circumference to its diameter""" //| """the ratio of a circle's circumference to its diameter"""
//|
//| def acos(x: float) -> float: //| def acos(x: float) -> float:
//| """Return the inverse cosine of ``x``.""" //| """Return the inverse cosine of ``x``."""

View File

@ -34,6 +34,7 @@
#include "shared-bindings/memorymonitor/AllocationSize.h" #include "shared-bindings/memorymonitor/AllocationSize.h"
//| """Memory monitoring helpers""" //| """Memory monitoring helpers"""
//|
//| class AllocationError(Exception): //| class AllocationError(Exception):
//| """Catchall exception for allocation related errors.""" //| """Catchall exception for allocation related errors."""

View File

@ -60,6 +60,7 @@
//| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` //| """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. //| (clock frequency) on chips with more than 1 cpu. The index selects which cpu.
//| This object is an instance of `microcontroller.Processor`.""" //| This object is an instance of `microcontroller.Processor`."""
//|
//| def delay_us(delay: int) -> None: //| def delay_us(delay: int) -> None:
//| """Dedicated delay method used for very short delays. **Do not** do long delays //| """Dedicated delay method used for very short delays. **Do not** do long delays

View File

@ -84,6 +84,7 @@
//| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| print(f"{data} -> {buffer.getvalue()} -> {decoded}")
//| //|
//| """ //| """
//|
//| def pack( //| def pack(
//| obj: object, //| obj: object,

View File

@ -109,7 +109,8 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) {
//| """Write buf out on the given DigitalInOut. //| """Write buf out on the given DigitalInOut.
//| //|
//| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with //| :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) { STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) {

View File

@ -33,7 +33,8 @@
//| //|
//| def colorwheel(n: float) -> int: //| def colorwheel(n: float) -> int:
//| """C implementation of the common colorwheel() function found in many examples. //| """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) { STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) {

View File

@ -47,6 +47,7 @@
//| from typing import TypeVar //| from typing import TypeVar
//| //|
//| _T = TypeVar("_T") //| _T = TypeVar("_T")
//|
//| def seed(seed: int) -> None: //| def seed(seed: int) -> None:
//| """Sets the starting seed of the random number generation. Further calls to //| """Sets the starting seed of the random number generation. Further calls to

View File

@ -36,6 +36,7 @@
//| The `rtc` module provides support for a Real Time Clock. You can access and manage the //| 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` //| RTC using :class:`rtc.RTC`. It also backs the :func:`time.time` and :func:`time.localtime`
//| functions using the onboard RTC if present.""" //| functions using the onboard RTC if present."""
//|
void rtc_reset(void) { void rtc_reset(void) {
MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj; MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj;

View File

@ -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: //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None:
//|
//| """Read one or more blocks from the card //| """Read one or more blocks from the card
//| //|
//| :param int start_block: The block to start reading from //| :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: //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None:
//|
//| """Write one or more blocks to the card //| """Write one or more blocks to the card
//| //|
//| :param int start_block: The block to start writing from //| :param int start_block: The block to start writing from

View File

@ -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); MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count);
//| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None:
//|
//| """Read one or more blocks from the card //| """Read one or more blocks from the card
//| //|
//| :param int start_block: The block to start reading from //| :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); MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks);
//| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None:
//|
//| """Write one or more blocks to the card //| """Write one or more blocks to the card
//| //|
//| :param int start_block: The block to start writing from //| :param int start_block: The block to start writing from

View File

@ -379,7 +379,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4,
//| def settimeout(self, value: int) -> None: //| def settimeout(self, value: int) -> None:
//| """Set the timeout value for this socket. //| """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) { STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {

View File

@ -52,6 +52,7 @@
//| returned by :py:attr:`wifi.radio` //| 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) { 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); mp_arg_check_num(n_args, n_kw, 1, 1, false);

View File

@ -240,7 +240,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send);
//| def settimeout(self, value: int) -> None: //| def settimeout(self, value: int) -> None:
//| """Set the timeout value for this socket. //| """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) { 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); ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -36,6 +36,7 @@
//| //|
//| |see_cpython_module| :mod:`cpython:ssl`. //| |see_cpython_module| :mod:`cpython:ssl`.
//| """ //| """
//|
//| def create_default_context() -> ssl.SSLContext: //| def create_default_context() -> ssl.SSLContext:
//| """Return the default SSLContext.""" //| """Return the default SSLContext."""

View File

@ -46,6 +46,7 @@
//| //|
//| Supported format codes: *b*, *B*, *x*, *h*, *H*, *i*, *I*, *l*, *L*, *q*, *Q*, //| 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).""" //| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support)."""
//|
//| def calcsize(fmt: str) -> int: //| def calcsize(fmt: str) -> int:

View File

@ -59,6 +59,7 @@
//| The status bar reports the current IP or BLE connection, what file is running, //| The status bar reports the current IP or BLE connection, what file is running,
//| the last exception name and location, and firmware version information. //| the last exception name and location, and firmware version information.
//| This object is the sole instance of `supervisor.StatusBar`.""" //| This object is the sole instance of `supervisor.StatusBar`."""
//|
//| def reload() -> None: //| def reload() -> None:
//| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL)."""

View File

@ -37,6 +37,7 @@
//| |see_cpython_module| :mod:`cpython:traceback`. //| |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) { 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 }; enum { ARG_exc, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain };

View File

@ -32,6 +32,7 @@
#include "shared-bindings/uheap/__init__.h" #include "shared-bindings/uheap/__init__.h"
//| """Heap size analysis""" //| """Heap size analysis"""
//|
//| def info(object: object) -> int: //| def info(object: object) -> int:
//| """Prints memory debugging info for the given object and returns the //| """Prints memory debugging info for the given object and returns the

View File

@ -40,6 +40,7 @@
//| //|
//| This is a subset of the PyUSB core module. //| This is a subset of the PyUSB core module.
//| """ //| """
//|
//| class USBError(OSError): //| class USBError(OSError):
//| """Catchall exception for USB related errors.""" //| """Catchall exception for USB related errors."""

View File

@ -62,6 +62,7 @@
//| """A `Serial` object that can be used to send and receive binary data to and from //| """A `Serial` object that can be used to send and receive binary data to and from
//| the host. //| the host.
//| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled.""" //| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled."""
//|
//| def disable() -> None: //| def disable() -> None:
//| """Do not present any USB CDC device to the host. //| """Do not present any USB CDC device to the host.

View File

@ -47,6 +47,7 @@
//| containing a `Device` that describes the boot device chosen (keyboard or mouse). //| containing a `Device` that describes the boot device chosen (keyboard or mouse).
//| The request for a boot device overrides any other HID devices. //| The request for a boot device overrides any other HID devices.
//| """ //| """
//|
//| def disable() -> None: //| def disable() -> None:
//| """Do not present any USB HID devices to the host computer. //| """Do not present any USB HID devices to the host computer.

View File

@ -42,6 +42,7 @@
//| //|
//| ports: Tuple[Union[PortIn, PortOut], ...] //| ports: Tuple[Union[PortIn, PortOut], ...]
//| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`.""" //| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`."""
//|
//| def disable() -> None: //| def disable() -> None:
//| """Disable presenting a USB MIDI device to the host. //| """Disable presenting a USB MIDI device to the host.

View File

@ -35,6 +35,7 @@
//| """Stack information and analysis""" //| """Stack information and analysis"""
//|
#if MICROPY_MAX_STACK_USAGE #if MICROPY_MAX_STACK_USAGE
//| def max_stack_usage() -> int: //| def max_stack_usage() -> int:

View File

@ -24,7 +24,8 @@
//| :param int radius: The radius of the circle in pixels //| :param int radius: The radius of the circle in pixels
//| :param int x: Initial x position of the axis. //| :param int x: Initial x position of the axis.
//| :param int y: Initial y 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) { 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 }; enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {

View File

@ -32,7 +32,8 @@
//| :param List[Tuple[int,int]] points: Vertices for the polygon //| :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 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 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) { 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 }; enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {

View File

@ -25,7 +25,8 @@
//| :param int height: The number of pixels high //| :param int height: The number of pixels high
//| :param int x: Initial x position of the top left corner. //| :param int x: Initial x position of the top left corner.
//| :param int y: Initial y 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) { 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 }; enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {

View File

@ -49,6 +49,7 @@
//| w.timeout=2.5 # Set a timeout of 2.5 seconds //| w.timeout=2.5 # Set a timeout of 2.5 seconds
//| w.mode = WatchDogMode.RAISE //| w.mode = WatchDogMode.RAISE
//| w.feed()""" //| w.feed()"""
//|
//| class WatchDogTimeout(Exception): //| class WatchDogTimeout(Exception):
//| """Exception raised when the watchdog timer is set to //| """Exception raised when the watchdog timer is set to

View File

@ -46,6 +46,7 @@
//| The `zlib` module allows limited functionality similar to the CPython zlib library. //| The `zlib` module allows limited functionality similar to the CPython zlib library.
//| This module allows to decompress binary data compressed with DEFLATE algorithm //| This module allows to decompress binary data compressed with DEFLATE algorithm
//| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented."""
//|
//| def zlib_decompress( //| def zlib_decompress(
//| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 //| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0

View File

@ -34,6 +34,7 @@ fb.pixel(2, 2, 0x0708)
fb2.blit(fb, 0, 0) fb2.blit(fb, 0, 0)
print(bytes(fb2)) print(bytes(fb2))
# Test that blitting something that isn't a subclass fails with TypeError. # Test that blitting something that isn't a subclass fails with TypeError.
class NotAFrameBuf: class NotAFrameBuf:
pass pass

View File

@ -9,6 +9,7 @@ except ImportError:
print("SKIP") print("SKIP")
raise SystemExit raise SystemExit
# main task raising an exception # main task raising an exception
async def main(): async def main():
print("main start") print("main start")
@ -21,6 +22,7 @@ try:
except ValueError as er: except ValueError as er:
print("ValueError", er.args[0]) print("ValueError", er.args[0])
# sub-task raising an exception # sub-task raising an exception
async def task(): async def task():
print("task start") print("task start")
@ -40,6 +42,7 @@ try:
except ValueError as er: except ValueError as er:
print("ValueError", er.args[0]) print("ValueError", er.args[0])
# main task raising an exception with sub-task not yet scheduled # main task raising an exception with sub-task not yet scheduled
# TODO not currently working, task is never scheduled # TODO not currently working, task is never scheduled
async def task(): async def task():

View File

@ -13,7 +13,6 @@ except AttributeError:
class RAMFS: class RAMFS:
SEC_SIZE = 512 SEC_SIZE = 512
def __init__(self, blocks): def __init__(self, blocks):

View File

@ -13,7 +13,6 @@ except AttributeError:
class RAMFS: class RAMFS:
SEC_SIZE = 512 SEC_SIZE = 512
def __init__(self, blocks): def __init__(self, blocks):

View File

@ -12,7 +12,6 @@ except AttributeError:
class RAMFS: class RAMFS:
SEC_SIZE = 512 SEC_SIZE = 512
def __init__(self, blocks): def __init__(self, blocks):

View File

@ -13,7 +13,6 @@ except AttributeError:
class RAMFS_OLD: class RAMFS_OLD:
SEC_SIZE = 512 SEC_SIZE = 512
def __init__(self, blocks): def __init__(self, blocks):

View File

@ -13,7 +13,6 @@ except AttributeError:
class RAMFS: class RAMFS:
SEC_SIZE = 512 SEC_SIZE = 512
def __init__(self, blocks): def __init__(self, blocks):

View File

@ -14,7 +14,6 @@ except AttributeError:
class RAMBDevSparse: class RAMBDevSparse:
SEC_SIZE = 512 SEC_SIZE = 512
def __init__(self, blocks): def __init__(self, blocks):

View File

@ -8,6 +8,7 @@ try:
except AttributeError: except AttributeError:
pass pass
# define __getattr__ # define __getattr__
def __getattr__(attr): def __getattr__(attr):
if attr == "does_not_exist": if attr == "does_not_exist":

View File

@ -1,6 +1,5 @@
@micropython.asm_thumb @micropython.asm_thumb
def asm_sum_words(r0, r1): def asm_sum_words(r0, r1):
# r0 = len # r0 = len
# r1 = ptr # r1 = ptr
# r2 = sum # r2 = sum
@ -25,7 +24,6 @@ def asm_sum_words(r0, r1):
@micropython.asm_thumb @micropython.asm_thumb
def asm_sum_bytes(r0, r1): def asm_sum_bytes(r0, r1):
# r0 = len # r0 = len
# r1 = ptr # r1 = ptr
# r2 = sum # r2 = sum

View File

@ -11,6 +11,7 @@ import micropython as X
print(globals()["X"]) print(globals()["X"])
# function name that matches a constant # function name that matches a constant
def X(): def X():
print("function X", X) print("function X", X)
@ -18,6 +19,7 @@ def X():
globals()["X"]() globals()["X"]()
# arguments that match a constant # arguments that match a constant
def f(X, *Y, **Z): def f(X, *Y, **Z):
pass pass
@ -25,6 +27,7 @@ def f(X, *Y, **Z):
f(1) f(1)
# class name that matches a constant # class name that matches a constant
class X: class X:
def f(self): def f(self):
@ -33,6 +36,7 @@ class X:
globals()["X"]().f() globals()["X"]().f()
# constant within a class # constant within a class
class A: class A:
C1 = const(4) C1 = const(4)

View File

@ -2,6 +2,7 @@
import micropython import micropython
# Yielding from a function generator # Yielding from a function generator
def sub_gen(a): def sub_gen(a):
for i in range(a): for i in range(a):
@ -18,6 +19,7 @@ print(next(g))
print(next(g)) print(next(g))
micropython.heap_unlock() micropython.heap_unlock()
# Yielding from a user iterator # Yielding from a user iterator
class G: class G:
def __init__(self): def __init__(self):

View File

@ -1,5 +1,6 @@
# test native emitter can handle closures correctly # test native emitter can handle closures correctly
# basic closure # basic closure
@micropython.native @micropython.native
def f(): def f():
@ -15,6 +16,7 @@ def f():
print(f()()) print(f()())
# closing over an argument # closing over an argument
@micropython.native @micropython.native
def f(x): def f(x):
@ -28,6 +30,7 @@ def f(x):
print(f(2)()) print(f(2)())
# closing over an argument and a normal local # closing over an argument and a normal local
@micropython.native @micropython.native
def f(x): def f(x):

View File

@ -1,5 +1,6 @@
# test for native generators # test for native generators
# simple generator with yield and return # simple generator with yield and return
@micropython.native @micropython.native
def gen1(x): def gen1(x):
@ -16,6 +17,7 @@ try:
except StopIteration as e: except StopIteration as e:
print(e.args[0]) print(e.args[0])
# using yield from # using yield from
@micropython.native @micropython.native
def gen2(x): def gen2(x):

View File

@ -1,5 +1,6 @@
# tests for natively compiled functions # tests for natively compiled functions
# basic test # basic test
@micropython.native @micropython.native
def native_test(x): def native_test(x):
@ -14,6 +15,7 @@ import gc
gc.collect() gc.collect()
native_test(3) native_test(3)
# native with 2 args # native with 2 args
@micropython.native @micropython.native
def f(a, b): def f(a, b):
@ -22,6 +24,7 @@ def f(a, b):
f(1, 2) f(1, 2)
# native with 3 args # native with 3 args
@micropython.native @micropython.native
def f(a, b, c): def f(a, b, c):
@ -30,6 +33,7 @@ def f(a, b, c):
f(1, 2, 3) f(1, 2, 3)
# check not operator # check not operator
@micropython.native @micropython.native
def f(a): def f(a):

View File

@ -1,5 +1,6 @@
# test native try handling # test native try handling
# basic try-finally # basic try-finally
@micropython.native @micropython.native
def f(): def f():
@ -14,6 +15,7 @@ try:
except NameError: except NameError:
print("NameError") print("NameError")
# nested try-except with try-finally # nested try-except with try-finally
@micropython.native @micropython.native
def f(): def f():
@ -28,6 +30,7 @@ def f():
f() f()
# check that locals written to in try blocks keep their values # check that locals written to in try blocks keep their values
@micropython.native @micropython.native
def f(): def f():

View File

@ -1,5 +1,6 @@
# test native try handling # test native try handling
# deeply nested try (9 deep) # deeply nested try (9 deep)
@micropython.native @micropython.native
def f(): def f():

View File

@ -21,6 +21,7 @@ def f():
f() f()
# nested with and try-except # nested with and try-except
@micropython.native @micropython.native
def f(): def f():

View File

@ -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) f6(1, 2, 3, 4, 5, 6)
# test compiling *x, **x, * args (currently unsupported at runtime) # test compiling *x, **x, * args (currently unsupported at runtime)
@micropython.viper @micropython.viper
def f(*x, **y): def f(*x, **y):

View File

@ -10,6 +10,7 @@ def f():
f() f()
# using True as a conditional # using True as a conditional
@micropython.viper @micropython.viper
def f(): def f():
@ -20,6 +21,7 @@ def f():
f() f()
# using an int as a conditional # using an int as a conditional
@micropython.viper @micropython.viper
def g(): def g():
@ -30,6 +32,7 @@ def g():
g() g()
# using an int as a conditional that has the lower 16-bits clear # using an int as a conditional that has the lower 16-bits clear
@micropython.viper @micropython.viper
def h(): def h():

View File

@ -1,5 +1,6 @@
import micropython import micropython
# viper function taking and returning ints # viper function taking and returning ints
@micropython.viper @micropython.viper
def viper_int(x: int, y: int) -> int: 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)) print(viper_int(1, 2))
# viper function taking and returning objects # viper function taking and returning objects
@micropython.viper @micropython.viper
def viper_object(x: object, y: object) -> object: 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)) print(viper_object(1, 2))
# return None as non-object (should return 0) # return None as non-object (should return 0)
@micropython.viper @micropython.viper
def viper_ret_none() -> int: def viper_ret_none() -> int:
@ -24,6 +27,7 @@ def viper_ret_none() -> int:
print(viper_ret_none()) print(viper_ret_none())
# return Ellipsis as object # return Ellipsis as object
@micropython.viper @micropython.viper
def viper_ret_ellipsis() -> object: def viper_ret_ellipsis() -> object:
@ -32,6 +36,7 @@ def viper_ret_ellipsis() -> object:
print(viper_ret_ellipsis()) print(viper_ret_ellipsis())
# 3 args # 3 args
@micropython.viper @micropython.viper
def viper_3args(a: int, b: int, c: int) -> int: 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)) print(viper_3args(1, 2, 3))
# 4 args # 4 args
@micropython.viper @micropython.viper
def viper_4args(a: int, b: int, c: int, d: int) -> int: 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 # viper call with 4 args not yet supported
# print(viper_4args(1, 2, 3, 4)) # print(viper_4args(1, 2, 3, 4))
# a local (should have automatic type int) # a local (should have automatic type int)
@micropython.viper @micropython.viper
def viper_local(x: int) -> int: def viper_local(x: int) -> int:
@ -58,6 +65,7 @@ def viper_local(x: int) -> int:
print(viper_local(3)) print(viper_local(3))
# without type annotation, types should default to object # without type annotation, types should default to object
@micropython.viper @micropython.viper
def viper_no_annotation(x, y): def viper_no_annotation(x, y):
@ -66,6 +74,7 @@ def viper_no_annotation(x, y):
print(viper_no_annotation(4, 5)) print(viper_no_annotation(4, 5))
# a for loop # a for loop
@micropython.viper @micropython.viper
def viper_for(a: int, b: int) -> int: 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)) print(viper_for(10, 10000))
# accessing a global # accessing a global
@micropython.viper @micropython.viper
def viper_access_global(): def viper_access_global():
@ -87,6 +97,7 @@ def viper_access_global():
print(viper_access_global(), gl) print(viper_access_global(), gl)
# calling print with object and int types # calling print with object and int types
@micropython.viper @micropython.viper
def viper_print(x, y: int): def viper_print(x, y: int):
@ -95,6 +106,7 @@ def viper_print(x, y: int):
viper_print(1, 2) viper_print(1, 2)
# convert constants to objects in tuple # convert constants to objects in tuple
@micropython.viper @micropython.viper
def viper_tuple_consts(x): def viper_tuple_consts(x):
@ -103,6 +115,7 @@ def viper_tuple_consts(x):
print(viper_tuple_consts(0)) print(viper_tuple_consts(0))
# making a tuple from an object and an int # making a tuple from an object and an int
@micropython.viper @micropython.viper
def viper_tuple(x, y: int): def viper_tuple(x, y: int):
@ -111,6 +124,7 @@ def viper_tuple(x, y: int):
print(viper_tuple(1, 2)) print(viper_tuple(1, 2))
# making a list from an object and an int # making a list from an object and an int
@micropython.viper @micropython.viper
def viper_list(x, y: int): def viper_list(x, y: int):
@ -119,6 +133,7 @@ def viper_list(x, y: int):
print(viper_list(1, 2)) print(viper_list(1, 2))
# making a set from an object and an int # making a set from an object and an int
@micropython.viper @micropython.viper
def viper_set(x, y: int): def viper_set(x, y: int):
@ -127,6 +142,7 @@ def viper_set(x, y: int):
print(sorted(list(viper_set(1, 2)))) print(sorted(list(viper_set(1, 2))))
# raising an exception # raising an exception
@micropython.viper @micropython.viper
def viper_raise(x: int): def viper_raise(x: int):
@ -138,6 +154,7 @@ try:
except OSError as e: except OSError as e:
print(repr(e)) print(repr(e))
# calling GC after defining the function # calling GC after defining the function
@micropython.viper @micropython.viper
def viper_gc() -> int: def viper_gc() -> int:

View File

@ -1,5 +1,6 @@
# Miscellaneous viper tests # Miscellaneous viper tests
# Test correct use of registers in load and store # Test correct use of registers in load and store
@micropython.viper @micropython.viper
def expand(dest: ptr8, source: ptr8, length: int): def expand(dest: ptr8, source: ptr8, length: int):

View File

@ -1,5 +1,6 @@
import micropython import micropython
# unsigned ints # unsigned ints
@micropython.viper @micropython.viper
def viper_uint() -> uint: def viper_uint() -> uint:

View File

@ -1,5 +1,6 @@
# test try handling within a viper function # test try handling within a viper function
# basic try-finally # basic try-finally
@micropython.viper @micropython.viper
def f(): def f():
@ -14,6 +15,7 @@ try:
except NameError: except NameError:
print("NameError") print("NameError")
# nested try-except with try-finally # nested try-except with try-finally
@micropython.viper @micropython.viper
def f(): def f():
@ -28,6 +30,7 @@ def f():
f() f()
# check that locals written to in try blocks keep their values # check that locals written to in try blocks keep their values
@micropython.viper @micropython.viper
def f(): def f():

View File

@ -2,6 +2,7 @@
import micropython import micropython
# converting incoming arg to bool # converting incoming arg to bool
@micropython.viper @micropython.viper
def f1(x: bool): def f1(x: bool):
@ -13,6 +14,7 @@ f1(1)
f1([]) f1([])
f1([1]) f1([1])
# taking and returning a bool # taking and returning a bool
@micropython.viper @micropython.viper
def f2(x: bool) -> bool: def f2(x: bool) -> bool:
@ -22,6 +24,7 @@ def f2(x: bool) -> bool:
print(f2([])) print(f2([]))
print(f2([1])) print(f2([1]))
# converting to bool within function # converting to bool within function
@micropython.viper @micropython.viper
def f3(x) -> bool: def f3(x) -> bool:

View File

@ -21,6 +21,7 @@ def f():
f() f()
# nested with and try-except # nested with and try-except
@micropython.viper @micropython.viper
def f(): def f():

View File

@ -111,6 +111,7 @@ try:
except NotImplementedError: except NotImplementedError:
print("NotImplementedError") print("NotImplementedError")
# can't assign attributes to a function # can't assign attributes to a function
def f(): def f():
pass pass
@ -127,6 +128,7 @@ try:
except TypeError: except TypeError:
print("TypeError") print("TypeError")
# test when object explicitly listed at not-last position in parent tuple # test when object explicitly listed at not-last position in parent tuple
# this is not compliant with CPython because of illegal MRO # this is not compliant with CPython because of illegal MRO
class A: class A:
@ -140,6 +142,7 @@ class B(object, A):
B().foo() B().foo()
# can't assign property (or other special accessors) to already-subclassed class # can't assign property (or other special accessors) to already-subclassed class
class A: class A:
pass pass

View File

@ -48,11 +48,9 @@ def test_generator():
gen = make_gen() gen = make_gen()
r = 0 r = 0
try: try:
r += gen.send(None) r += gen.send(None)
while True: while True:
r += gen.send(None) r += gen.send(None)
except StopIteration as e: except StopIteration as e:

View File

@ -1,5 +1,6 @@
print("Now comes the language constructions tests.") print("Now comes the language constructions tests.")
# function # function
def test_func(): def test_func():
def test_sub_func(): def test_sub_func():

View File

@ -5,6 +5,7 @@
# author: collinwinter@google.com (Collin Winter) # author: collinwinter@google.com (Collin Winter)
# n_queens function: Copyright 2009 Raymond Hettinger # n_queens function: Copyright 2009 Raymond Hettinger
# Pure-Python implementation of itertools.permutations(). # Pure-Python implementation of itertools.permutations().
def permutations(iterable, r=None): def permutations(iterable, r=None):
"""permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)""" """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)"""

View File

@ -33,6 +33,7 @@ aes_s_box_table = bytes((
)) ))
# fmt: on # fmt: on
# multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b
def aes_gf8_mul_2(x): def aes_gf8_mul_2(x):
if x & 0x80: if x & 0x80:
@ -64,6 +65,7 @@ def aes_r_con(a):
################################################################## ##################################################################
# basic AES algorithm; see FIPS-197 # basic AES algorithm; see FIPS-197
# all inputs must be size 16 # all inputs must be size 16
def aes_add_round_key(state, w): def aes_add_round_key(state, w):
for i in range(16): for i in range(16):

View File

@ -26,7 +26,6 @@ def run_tests(pyb, test_dict):
for base_test, tests in sorted(test_dict.items()): for base_test, tests in sorted(test_dict.items()):
print(base_test + ":") print(base_test + ":")
for test_file in tests: for test_file in tests:
# run MicroPython # run MicroPython
if pyb is None: if pyb is None:
# run on PC # run on PC

View File

@ -17,6 +17,7 @@ for l in range(254, 259):
continue continue
print(var in g) print(var in g)
# calling a function with kwarg # calling a function with kwarg
def f(**k): def f(**k):
print(k) print(k)
@ -36,6 +37,7 @@ for l in range(254, 259):
except RuntimeError: except RuntimeError:
print("RuntimeError", l) print("RuntimeError", l)
# hasattr, setattr, getattr # hasattr, setattr, getattr
class A: class A:
pass pass

View File

@ -1,5 +1,6 @@
# test deeply recursive generators # test deeply recursive generators
# simple "yield from" recursion # simple "yield from" recursion
def gen(): def gen():
yield from gen() yield from gen()
@ -10,6 +11,7 @@ try:
except RuntimeError: except RuntimeError:
print("RuntimeError") print("RuntimeError")
# recursion via an iterator over a generator # recursion via an iterator over a generator
def gen2(): def gen2():
for x in gen2(): for x in gen2():

View File

@ -9,6 +9,7 @@ import _thread
# the shared bytearray # the shared bytearray
ba = bytearray() ba = bytearray()
# main thread function # main thread function
def th(n, lo, hi): def th(n, lo, hi):
for repeat in range(n): for repeat in range(n):

Some files were not shown because too many files have changed in this diff Show More