run updated pre-commit

This commit is contained in:
MicroDev 2023-02-01 13:38:41 +05:30
parent 9ab0733a28
commit d9d94eacca
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
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/>`_.
//|
//| """
//|
//| class GrabMode:
//| """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
//| that could be implemented by other frameworks. It should only include ESP-IDF specific
//| things."""
//|
//| def heap_caps_get_total_size() -> int:
//| """Return the total size of the ESP-IDF, which includes the CircuitPython heap."""
@ -72,7 +73,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he
//| """Erase all data in the non-volatile storage (nvs), including data stored by with `microcontroller.nvm`
//|
//| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the
//| layout of data in nvs has changed. The old data will be lost when you perform this operation."""
//| layout of data in nvs has changed. The old data will be lost when you perform this operation.
//| """
//|
STATIC mp_obj_t espidf_erase_nvs(void) {
ESP_ERROR_CHECK(nvs_flash_deinit());

View File

@ -94,7 +94,6 @@
//| wrap_target: int = 0,
//| wrap: int = -1,
//| ) -> None:
//|
//| """Construct a StateMachine object on the given pins with the given program.
//|
//| :param ReadableBuffer program: the program to run with the state machine
@ -659,7 +658,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach
//| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]``
//| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)``
//| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written)
//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)"""
//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)
//| """
//| ...
STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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.
//|
//| :param bool notify: True if Characteristic should receive notifications of remote writes
//| :param float indicate: True if Characteristic should receive indications of remote writes"""
//| :param float indicate: True if Characteristic should receive indications of remote writes
//| """
//| ...
STATIC mp_obj_t bleio_characteristic_set_cccd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);

View File

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

View File

@ -54,7 +54,8 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
//| ...
//| def __next__(self) -> ScanEntry:
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
//| active. Raises `StopIteration` if scanning is finished and no other results are available."""
//| active. Raises `StopIteration` if scanning is finished and no other results are available.
//| """
//| ...
//|

View File

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

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 ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -109,7 +110,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc);
//|
//| :param int prim: graphics primitive.
//|
//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``."""
//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.
//| """
//| ...
STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) {
@ -137,7 +139,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat);
//|
//| :param int handle: bitmap handle. Range 0-31. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) {
@ -218,7 +221,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize);
//| def BitmapSource(self, addr: int) -> None:
//| """Set the source address for bitmap graphics
//|
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215"""
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215
//| """
//| ...
STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) {
@ -255,7 +259,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz
//|
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -274,7 +279,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
//|
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -290,7 +296,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
//|
//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
@ -308,7 +315,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
//|
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -327,7 +335,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
//|
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -343,7 +352,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
//|
//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
@ -359,7 +369,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
//| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2)
//| :param int dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4)
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -388,7 +399,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call);
//|
//| :param int cell: bitmap cell number. Range 0-127. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) {
@ -403,7 +415,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell);
//|
//| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) {
@ -420,7 +433,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora);
//| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0
//| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) {
@ -454,7 +468,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear);
//|
//| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) {
@ -469,7 +484,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil);
//|
//| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
uint32_t s = mp_obj_get_int_truncated(a0);
@ -483,7 +499,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag);
//|
//| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) {
@ -501,7 +518,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora);
//| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1
//| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) {
@ -521,7 +539,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask);
//| :param int green: green for the current color. Range 0-255. The initial value is 255
//| :param int blue: blue for the current color. Range 0-255. The initial value is 255
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
@ -547,7 +566,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
//| def End(self) -> None:
//| """End drawing a graphics primitive
//|
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`."""
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.
//| """
//| ...
STATIC mp_obj_t _end(mp_obj_t self) {
@ -599,7 +619,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop);
//|
//| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) {
@ -648,7 +669,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext);
//| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
//| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -665,7 +687,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize);
//| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
//| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -683,7 +706,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy);
//| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0
//| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) {
@ -700,7 +724,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc);
//|
//| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) {
@ -716,7 +741,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask);
//| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1)
//| :param int spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1)
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -732,7 +758,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop);
//|
//| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) {
@ -747,7 +774,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask);
//|
//| :param int s: tag value. Range 0-255. The initial value is 255
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) {
@ -857,7 +885,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f);
//|
//| :param float width: line width in pixels. Range 0-511. The initial value is 1
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) {
@ -872,7 +901,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth);
//|
//| :param float size: point diameter in pixels. Range 0-1023. The initial value is 1
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
@ -887,7 +917,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
//|
//| :param float x: signed x-coordinate in pixels. Range ±4095. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) {
@ -902,7 +933,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex);
//|
//| :param float y: signed y-coordinate in pixels. Range ±4095. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
@ -918,7 +950,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey);
//|
//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| """
//| ...
// }

View File

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

View File

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

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 bool auto_write: Whether to automatically write pixels (Default False)
//| :param ~circuitpython_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values.
//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values."""
//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values.
//| """
//| ...
STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer };

View File

@ -73,6 +73,7 @@
//| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep.
//| If no alarm occured since the last hard reset or soft restart, value is ``None``.
//| """
//|
// wake_alarm is implemented as a dictionary entry, so there's no code here.

View File

@ -37,11 +37,11 @@
//| |see_cpython_module| :mod:`cpython:atexit`.
//| """
//| ...
//|
//| def register(
//| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any]
//| ) -> Callable[..., Any]:
//|
//| """Register func as a function to be executed at termination.
//|
//| Any optional arguments that are to be passed to func must be passed as arguments to `register()`.
@ -65,7 +65,6 @@ STATIC mp_obj_t atexit_register(size_t n_args, const mp_obj_t *pos_args, mp_map_
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register);
//| def unregister(func: Callable[..., Any]) -> None:
//|
//| """Remove func from the list of functions to be run at termination.
//|
//| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once,

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`.
//|
//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor."""
//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.
//| """
//| ...
STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_sample, ARG_loop };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,6 +41,7 @@
//| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"]
//| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`"""
//|
//| class Display:
//| """Manage updating a display over a display bus
@ -282,7 +283,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show
//|
//| :param Optional[int] target_frames_per_second: The target frame rate that :py:func:`refresh` should try to
//| achieve. Set to `None` for immediate refresh.
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second."""
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.
//| """
//| ...
STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second };
@ -445,7 +447,8 @@ MP_PROPERTY_GETSET(displayio_display_root_group_obj,
//| """Extract the pixels from a single row
//|
//| :param int y: The top edge of the area
//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data"""
//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data
//| """
//| ...
//|
STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -117,7 +117,8 @@
//| :param float seconds_per_frame: Minimum number of seconds between screen refreshes
//| :param bool always_toggle_chip_select: When True, chip select is toggled every byte
//| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale
//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length"""
//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length
//| """
//| ...
STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height,

View File

@ -59,7 +59,8 @@
//|
//| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines
//| :param int device_address: The I2C address of the device
//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used"""
//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used
//| """
//| ...
STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_i2c_bus, ARG_device_address, ARG_reset };

View File

@ -65,6 +65,7 @@
//| dualbank.switch()
//| """
//| ...
//|
#if CIRCUITPY_STORAGE_EXTEND
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 bool auto_refresh: Automatically refresh the screen
//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)"""
//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
//| """
//| ...
STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS };
@ -134,7 +135,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebuffer
//| without calls to this.)
//|
//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second."""
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.
//| """
//| ...
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second };
@ -263,7 +265,8 @@ MP_PROPERTY_GETTER(framebufferio_framebufferframebuffer_obj,
//| """Extract the pixels from a single row
//|
//| :param int y: The top edge of the area
//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data"""
//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data
//| """
//| ...
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_y, ARG_buffer };

View File

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

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:
//| """Update the hash with the given bytes.
//|
//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer"""
//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer
//| """
//| ...
mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) {
mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type));

View File

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

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.
//|
//| :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) {

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:
//| """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) {

View File

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

View File

@ -34,6 +34,7 @@
#include "shared-bindings/memorymonitor/AllocationSize.h"
//| """Memory monitoring helpers"""
//|
//| class AllocationError(Exception):
//| """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``
//| (clock frequency) on chips with more than 1 cpu. The index selects which cpu.
//| This object is an instance of `microcontroller.Processor`."""
//|
//| def delay_us(delay: int) -> None:
//| """Dedicated delay method used for very short delays. **Do not** do long delays

View File

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

View File

@ -33,7 +33,8 @@
//|
//| def colorwheel(n: float) -> int:
//| """C implementation of the common colorwheel() function found in many examples.
//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar)."""
//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar).
//| """
//| ...
//|
STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) {

View File

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

View File

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

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:
//|
//| """Read one or more blocks from the card
//|
//| :param int start_block: The block to start reading from
@ -166,7 +165,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_sync_obj, sdcardio_sdcard_sync);
//| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None:
//|
//| """Write one or more blocks to the card
//|
//| :param int start_block: The block to start writing from

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

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:
//| """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) {

View File

@ -52,6 +52,7 @@
//| returned by :py:attr:`wifi.radio`
//| """
//| ...
//|
STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);

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:
//| """Set the timeout value for this socket.
//|
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.
//| """
//| ...
STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -36,6 +36,7 @@
//|
//| |see_cpython_module| :mod:`cpython:ssl`.
//| """
//|
//| def create_default_context() -> ssl.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*,
//| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support)."""
//|
//| 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 last exception name and location, and firmware version information.
//| This object is the sole instance of `supervisor.StatusBar`."""
//|
//| def reload() -> None:
//| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL)."""

View File

@ -37,6 +37,7 @@
//| |see_cpython_module| :mod:`cpython:traceback`.
//| """
//| ...
//|
STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *print, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_exc, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain };

View File

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

View File

@ -40,6 +40,7 @@
//|
//| This is a subset of the PyUSB core module.
//| """
//|
//| class USBError(OSError):
//| """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
//| the host.
//| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled."""
//|
//| def disable() -> None:
//| """Do not present any USB CDC device to the host.

View File

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

View File

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

View File

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

View File

@ -24,7 +24,8 @@
//| :param int radius: The radius of the circle in pixels
//| :param int x: Initial x position of the axis.
//| :param int y: Initial y position of the axis.
//| :param int color_index: Initial color_index to use when selecting color from the palette."""
//| :param int color_index: Initial color_index to use when selecting color from the palette.
//| """
static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index };
static const mp_arg_t allowed_args[] = {

View File

@ -32,7 +32,8 @@
//| :param List[Tuple[int,int]] points: Vertices for the polygon
//| :param int x: Initial screen x position of the 0,0 origin in the points list.
//| :param int y: Initial screen y position of the 0,0 origin in the points list.
//| :param int color_index: Initial color_index to use when selecting color from the palette."""
//| :param int color_index: Initial color_index to use when selecting color from the palette.
//| """
static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index };
static const mp_arg_t allowed_args[] = {

View File

@ -25,7 +25,8 @@
//| :param int height: The number of pixels high
//| :param int x: Initial x position of the top left corner.
//| :param int y: Initial y position of the top left corner.
//| :param int color_index: Initial color_index to use when selecting color from the palette."""
//| :param int color_index: Initial color_index to use when selecting color from the palette.
//| """
static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index };
static const mp_arg_t allowed_args[] = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ def f():
f()
# nested with and try-except
@micropython.native
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)
# test compiling *x, **x, * args (currently unsupported at runtime)
@micropython.viper
def f(*x, **y):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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