Add pre-commit changes (black 24.11) formattings changes
This commit is contained in:
parent
bd8ae23d96
commit
2490303a23
71 changed files with 115 additions and 26 deletions
|
|
@ -342,6 +342,7 @@ STATIC const mp_stream_p_t espnow_stream_p = {
|
|||
//| This is an easy way to check if the buffer is empty.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
//| def __len__(self) -> int:
|
||||
//| """Return the number of `bytes` available to read. Used to implement ``len()``."""
|
||||
//| ...
|
||||
|
|
|
|||
|
|
@ -99,12 +99,14 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
|
|||
//| :return: Data read
|
||||
//| :rtype: bytes or None"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
|
||||
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
||||
//|
|
||||
//| :return: number of bytes read and stored into ``buf``
|
||||
//| :rtype: int or None (on a non-blocking error)"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readline(self) -> bytes:
|
||||
//| """Read a line, ending in a newline character.
|
||||
//|
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
|
|||
//| Connections may also be made when another device initiates a connection. To use a Connection
|
||||
//| created by a peer, read the `Adapter.connections` property."""
|
||||
//| ...
|
||||
//|
|
||||
//| def disconnect(self) -> None:
|
||||
//| """Disconnects from the remote peripheral. Does nothing if already disconnected."""
|
||||
//| ...
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
//| and attached to a Characteristic by calling `add_to_characteristic()`.
|
||||
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
|
||||
//| as part of remote Characteristics in the remote Services that are discovered."""
|
||||
//|
|
||||
//| @classmethod
|
||||
//| def add_to_characteristic(
|
||||
//| cls,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
//| def __init__(self) -> None:
|
||||
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
||||
//| ...
|
||||
//|
|
||||
//| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool:
|
||||
//| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter
|
||||
//| than the scan filtering which accepts any advertisements that match any of the prefixes
|
||||
|
|
|
|||
|
|
@ -49,9 +49,11 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
|
|||
//| def __init__(self) -> None:
|
||||
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
||||
//| ...
|
||||
//|
|
||||
//| def __iter__(self) -> Iterator[ScanEntry]:
|
||||
//| """Returns itself since it is the iterator."""
|
||||
//| ...
|
||||
//|
|
||||
//| 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.
|
||||
|
|
|
|||
|
|
@ -161,10 +161,12 @@ MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_indices_obj, pixelmap_pixelmap_indic
|
|||
//| def __getitem__(self, index: slice) -> PixelReturnSequence:
|
||||
//| """Retrieve the value of the underlying pixels."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __getitem__(self, index: int) -> PixelReturnType:
|
||||
//| """Retrieve the value of one of the underlying pixels at 'index'."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
|
||||
//| @overload
|
||||
|
|
|
|||
|
|
@ -269,12 +269,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_f
|
|||
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
|
||||
//| intensity from 0-1.0."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __getitem__(self, index: int) -> PixelReturnType:
|
||||
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
|
||||
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
|
||||
//| intensity from 0-1.0."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
|
||||
//| @overload
|
||||
|
|
|
|||
|
|
@ -55,11 +55,13 @@
|
|||
//| def __init__(self) -> None:
|
||||
//| """Not used. Access the sole instance through `alarm.sleep_memory`."""
|
||||
//| ...
|
||||
//|
|
||||
//| def __bool__(self) -> bool:
|
||||
//| """``sleep_memory`` is ``True`` if its length is greater than zero.
|
||||
//| This is an easy way to check for its existence.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
//| def __len__(self) -> int:
|
||||
//| """Return the length. This is used by (`len`)"""
|
||||
//| ...
|
||||
|
|
@ -87,6 +89,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_l
|
|||
//| def __getitem__(self, index: int) -> int:
|
||||
//| """Returns the value at the given index."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
|
||||
//| @overload
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_in_waiting_obj, canio_listener_i
|
|||
//| This method exists so that `Listener` can be used as an
|
||||
//| iterable"""
|
||||
//| ...
|
||||
//|
|
||||
//| def __next__(self) -> Union[RemoteTransmissionRequest, Message]:
|
||||
//| """Reads a message, after waiting up to self.timeout seconds
|
||||
//|
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ MP_PROPERTY_GETTER(displayio_bitmap_height_obj,
|
|||
//|
|
||||
//| print(bitmap[0,1])"""
|
||||
//| ...
|
||||
//|
|
||||
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
|
||||
//| """Sets the value at the given index. The index can either be an x,y tuple or an int equal
|
||||
//| to ``y * width + x``.
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||
//|
|
||||
//| print(group[0])"""
|
||||
//| ...
|
||||
//|
|
||||
//| def __setitem__(
|
||||
//| self,
|
||||
//| index: int,
|
||||
|
|
@ -294,6 +295,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||
//|
|
||||
//| group[0] = sprite"""
|
||||
//| ...
|
||||
//|
|
||||
//| def __delitem__(self, index: int) -> None:
|
||||
//| """Deletes the value at the given index.
|
||||
//|
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||
//| def __getitem__(self, index: int) -> Optional[int]:
|
||||
//| r"""Return the pixel color at the given index as an integer."""
|
||||
//| ...
|
||||
//|
|
||||
//| def __setitem__(
|
||||
//| self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]]
|
||||
//| ) -> None:
|
||||
|
|
|
|||
|
|
@ -434,6 +434,7 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj,
|
|||
//|
|
||||
//| print(grid[0])"""
|
||||
//| ...
|
||||
//|
|
||||
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
|
||||
//| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal
|
||||
//| to ``y * width + x``.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
//| The two element version is ``(width, height)``, in which
|
||||
//| ``x_offset`` and ``y_offset`` are assumed to be zero."""
|
||||
//| pass
|
||||
//|
|
||||
//| def get_glyph(self, codepoint: int) -> Optional[Glyph]:
|
||||
//| """Retrieve the Glyph for a given code point
|
||||
//|
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_eventqueue_clear_obj, keypad_eventqueue_clear);
|
|||
//| This is an easy way to check if the queue is empty.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
//| def __len__(self) -> int:
|
||||
//| """Return the number of events currently in the queue. Used to implement ``len()``."""
|
||||
//| ...
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
//| rtc_slow_mem = memorymap.AddressRange(start=0x50000000, length=0x2000)
|
||||
//| rtc_slow_mem[0:3] = b"\xcc\x10\x00"
|
||||
//| """
|
||||
//|
|
||||
|
||||
//| def __init__(self, *, start, length) -> None:
|
||||
//| """Constructs an address range starting at ``start`` and ending at
|
||||
|
|
@ -108,6 +109,7 @@ STATIC MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addres
|
|||
//| 1, 2, 4 and 8 byte aligned reads will be done in one transaction.
|
||||
//| All others may use multiple transactions."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
|
||||
//| @overload
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
//| import microcontroller
|
||||
//| microcontroller.nvm[0:3] = b"\xcc\x10\x00"
|
||||
//| """
|
||||
//|
|
||||
|
||||
//| def __init__(self) -> None:
|
||||
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`."""
|
||||
|
|
@ -76,6 +77,7 @@ STATIC MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict
|
|||
//| def __getitem__(self, index: int) -> int:
|
||||
//| """Returns the value at the given index."""
|
||||
//| ...
|
||||
//|
|
||||
//| @overload
|
||||
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
|
||||
//| @overload
|
||||
|
|
|
|||
|
|
@ -276,30 +276,38 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = {
|
|||
//| larger filesystems, but you will need to format the filesystem on another device.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
//| def open(self, path: str, mode: str) -> None:
|
||||
//| """Like builtin ``open()``"""
|
||||
//| ...
|
||||
//|
|
||||
//| def ilistdir(
|
||||
//| self, path: str
|
||||
//| ) -> Iterator[Union[Tuple[AnyStr, int, int, int], Tuple[AnyStr, int, int]]]:
|
||||
//| """Return an iterator whose values describe files and folders within
|
||||
//| ``path``"""
|
||||
//| ...
|
||||
//|
|
||||
//| def mkdir(self, path: str) -> None:
|
||||
//| """Like `os.mkdir`"""
|
||||
//| ...
|
||||
//|
|
||||
//| def rmdir(self, path: str) -> None:
|
||||
//| """Like `os.rmdir`"""
|
||||
//| ...
|
||||
//|
|
||||
//| def stat(self, path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
|
||||
//| """Like `os.stat`"""
|
||||
//| ...
|
||||
//|
|
||||
//| def statvfs(self, path: int) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
|
||||
//| """Like `os.statvfs`"""
|
||||
//| ...
|
||||
//|
|
||||
//| def mount(self, readonly: bool, mkfs: VfsFat) -> None:
|
||||
//| """Don't call this directly, call `storage.mount`."""
|
||||
//| ...
|
||||
//|
|
||||
//| def umount(self) -> None:
|
||||
//| """Don't call this directly, call `storage.umount`."""
|
||||
//| ...
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
//| """You cannot create an instance of `usb_cdc.Serial`.
|
||||
//| The available instances are in the ``usb_cdc.serials`` tuple."""
|
||||
//| ...
|
||||
//|
|
||||
//| def read(self, size: int = 1) -> bytes:
|
||||
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size
|
||||
//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``,
|
||||
|
|
@ -51,6 +52,7 @@
|
|||
//| :return: Data read
|
||||
//| :rtype: bytes"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readinto(self, buf: WriteableBuffer) -> int:
|
||||
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. If `timeout`
|
||||
//| is > 0 or ``None``, keep waiting until the timeout expires or ``len(buf)``
|
||||
|
|
@ -59,6 +61,7 @@
|
|||
//| :return: number of bytes read and stored into ``buf``
|
||||
//| :rtype: int"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readline(self, size: int = -1) -> Optional[bytes]:
|
||||
//| r"""Read a line ending in a newline character ("\\n"), including the newline.
|
||||
//| Return everything readable if no newline is found and ``timeout`` is 0.
|
||||
|
|
@ -71,6 +74,7 @@
|
|||
//| :return: the line read
|
||||
//| :rtype: bytes or None"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readlines(self) -> List[Optional[bytes]]:
|
||||
//| """Read multiple lines as a list, using `readline()`.
|
||||
//|
|
||||
|
|
@ -80,12 +84,14 @@
|
|||
//| :return: a list of the line read
|
||||
//| :rtype: list"""
|
||||
//| ...
|
||||
//|
|
||||
//| def write(self, buf: ReadableBuffer) -> int:
|
||||
//| """Write as many bytes as possible from the buffer of bytes.
|
||||
//|
|
||||
//| :return: the number of bytes written
|
||||
//| :rtype: int"""
|
||||
//| ...
|
||||
//|
|
||||
//| def flush(self) -> None:
|
||||
//| """Force out any unwritten bytes, waiting until they are written."""
|
||||
//| ...
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
//| :return: Data read
|
||||
//| :rtype: bytes or None"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[bytes]:
|
||||
//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
|
||||
//| that many bytes. Otherwise, read at most ``len(buf)`` bytes.
|
||||
|
|
|
|||
|
|
@ -50,9 +50,11 @@ STATIC mp_obj_t scannednetworks_iternext(mp_obj_t self_in) {
|
|||
//| def __init__(self) -> None:
|
||||
//| """Cannot be instantiated directly. Use `wifi.Radio.start_scanning_networks`."""
|
||||
//| ...
|
||||
//|
|
||||
//| def __iter__(self) -> Iterator[Network]:
|
||||
//| """Returns itself since it is the iterator."""
|
||||
//| ...
|
||||
//|
|
||||
//| def __next__(self) -> Network:
|
||||
//| """Returns the next `wifi.Network`.
|
||||
//| Raises `StopIteration` if scanning is finished and no other results are available."""
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ workaround: Instead of ``val = next(it, deflt)`` use::
|
|||
except StopIteration:
|
||||
val = deflt
|
||||
"""
|
||||
|
||||
print(next(iter(range(0)), 42))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Special method __del__ not implemented for user-defined classes
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import gc
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Error messages for methods may display unexpected argument counts
|
|||
cause: MicroPython counts "self" as an argument.
|
||||
workaround: Interpret error messages with the information above in mind.
|
||||
"""
|
||||
|
||||
try:
|
||||
[].append()
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: __all__ is unsupported in __init__.py in MicroPython.
|
|||
cause: Not implemented.
|
||||
workaround: Manually import the sub-modules directly in __init__.py using ``from . import foo, bar``.
|
||||
"""
|
||||
|
||||
from modules3 import *
|
||||
|
||||
foo.hello()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: __path__ attribute of a package has a different type (single string
|
|||
cause: MicroPython doesn't support namespace packages split across filesystem. Beyond that, MicroPython's import system is highly optimized for minimal memory usage.
|
||||
workaround: Details of import handling is inherently implementation dependent. Don't rely on such details in portable applications.
|
||||
"""
|
||||
|
||||
import modules
|
||||
|
||||
print(modules.__path__)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Failed to load modules are still registered as loaded
|
|||
cause: To make module handling more efficient, it's not wrapped with exception handling.
|
||||
workaround: Test modules before production use; during development, use ``del sys.modules["name"]``, or just soft or hard reset the board.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: MicroPython doesn't support namespace packages split across filesys
|
|||
cause: MicroPython's import system is highly optimized for simplicity, minimal memory usage, and minimal filesystem search overhead.
|
||||
workaround: Don't install modules belonging to the same namespace package in different directories. For MicroPython, it's recommended to have at most 3-component module search paths: for your current application, per-user (writable), system-wide (non-writable).
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.append(sys.path[1] + "/modules")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Code running in eval() function doesn't have access to local variab
|
|||
cause: MicroPython doesn't maintain symbolic local environment, it is optimized to an array of slots. Thus, local variables can't be accessed by a name. Effectively, ``eval(expr)`` in MicroPython is equivalent to ``eval(expr, globals(), globals())``.
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
val = 1
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Comparison between different typecodes not supported
|
|||
cause: Code size
|
||||
workaround: Compare individual elements
|
||||
"""
|
||||
|
||||
import array
|
||||
|
||||
array.array("b", [1, 2]) == array.array("i", [1, 2])
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Overflow checking is not implemented
|
|||
cause: MicroPython implements implicit truncation in order to reduce code size and execution time
|
||||
workaround: If CPython compatibility is needed then mask the value explicitly
|
||||
"""
|
||||
|
||||
import array
|
||||
|
||||
a = array.array("b", [257])
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Looking for integer not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import array
|
||||
|
||||
print(1 in array.array("B", b"12"))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Array deletion not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import array
|
||||
|
||||
a = array.array("b", (1, 2, 3))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Subscript with step != 1 is not yet implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import array
|
||||
|
||||
a = array.array("b", (1, 2, 3))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Deque not implemented
|
|||
cause: Unknown
|
||||
workaround: Use regular lists. micropython-lib has implementation of collections.deque.
|
||||
"""
|
||||
|
||||
import collections
|
||||
|
||||
D = collections.deque()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: JSON module does not throw exception when object is not serialisabl
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
a = bytes(x for x in range(256))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: ``environ`` attribute is not implemented
|
|||
cause: Unknown
|
||||
workaround: Use ``getenv``, ``putenv`` and ``unsetenv``
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: ``getenv`` returns actual value instead of cached value
|
|||
cause: The ``environ`` attribute is not implemented
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
print(os.getenv("NEW_VARIABLE"))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: ``getenv`` only allows one argument
|
|||
cause: Unknown
|
||||
workaround: Test that the return value is ``None``
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Struct pack with too few args, not checked by uPy
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import struct
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Struct pack with too many args, not checked by uPy
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import struct
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Struct pack with whitespace in format, whitespace ignored by CPytho
|
|||
cause: MicroPython is optimised for code size.
|
||||
workaround: Don't use spaces in format strings.
|
||||
"""
|
||||
|
||||
import struct
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Overriding sys.stdin, sys.stdout and sys.stderr not possible
|
|||
cause: They are stored in read-only memory.
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
sys.stdin = None
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: MicroPython allows using := to assign to the variable of a comprehe
|
|||
cause: MicroPython is optimised for code size and doesn't check this case.
|
||||
workaround: Do not rely on this behaviour if writing CPython compatible code.
|
||||
"""
|
||||
|
||||
print([i := -1 for i in range(4)])
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: uPy requires spaces between literal numbers and keywords, CPy doesn
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
try:
|
||||
print(eval("1and 0"))
|
||||
except SyntaxError:
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Unicode name escapes are not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print("\N{LATIN SMALL LETTER A}")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Array slice assignment with unsupported RHS
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
b = bytearray(4)
|
||||
b[0:1] = [1, 2]
|
||||
print(b)
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: bytes objects support .format() method
|
|||
cause: MicroPython strives to be a more regular implementation, so if both `str` and `bytes` support ``__mod__()`` (the % operator), it makes sense to support ``format()`` for both too. Support for ``__mod__`` can also be compiled out, which leaves only ``format()`` for bytes formatting.
|
||||
workaround: If you are interested in CPython compatibility, don't use ``.format()`` on bytes objects.
|
||||
"""
|
||||
|
||||
print(b"{}".format(1))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: bytes() with keywords not implemented
|
|||
cause: Unknown
|
||||
workaround: Pass the encoding as a positional parameter, e.g. ``print(bytes('abc', 'utf-8'))``
|
||||
"""
|
||||
|
||||
print(bytes("abc", encoding="utf8"))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Bytes subscription with step != 1 not implemented
|
|||
cause: MicroPython is highly optimized for memory usage.
|
||||
workaround: Use explicit loop for this very rare operation.
|
||||
"""
|
||||
|
||||
print(b"123"[0:3:2])
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Dictionary keys view does not behave as a set.
|
|||
cause: Not implemented.
|
||||
workaround: Explicitly convert keys to a set before using set operations.
|
||||
"""
|
||||
|
||||
print({1: 2, 3: 4}.keys() & {1})
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: All exceptions have readable ``value`` and ``errno`` attributes, no
|
|||
cause: MicroPython is optimised to reduce code size.
|
||||
workaround: Only use ``value`` on ``StopIteration`` exceptions, and ``errno`` on ``OSError`` exceptions. Do not use or rely on these attributes on other exceptions.
|
||||
"""
|
||||
|
||||
e = Exception(1)
|
||||
print(e.value)
|
||||
print(e.errno)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Exception chaining not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
try:
|
||||
raise TypeError
|
||||
except TypeError:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: User-defined attributes for builtin exceptions are not supported
|
|||
cause: MicroPython is highly optimized for memory usage.
|
||||
workaround: Use user-defined exception subclasses.
|
||||
"""
|
||||
|
||||
e = Exception()
|
||||
e.x = 0
|
||||
print(e.x)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: Exception in while loop condition may have unexpected line number
|
|||
cause: Condition checks are optimized to happen at the end of loop body, and that line number is reported.
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
l = ["-foo", "-bar"]
|
||||
|
||||
i = 0
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: uPy and CPython outputs formats may differ
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print("%.1g" % -9.9)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: List delete with step != 1 not implemented
|
|||
cause: Unknown
|
||||
workaround: Use explicit loop for this rare operation.
|
||||
"""
|
||||
|
||||
l = [1, 2, 3, 4]
|
||||
del l[0:4:2]
|
||||
print(l)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: List slice-store with non-iterable on RHS is not implemented
|
|||
cause: RHS is restricted to be a tuple or list
|
||||
workaround: Use ``list(<iter>)`` on RHS to convert the iterable to a list
|
||||
"""
|
||||
|
||||
l = [10, 20]
|
||||
l[0:1] = range(4)
|
||||
print(l)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ description: List store with step != 1 not implemented
|
|||
cause: Unknown
|
||||
workaround: Use explicit loop for this rare operation.
|
||||
"""
|
||||
|
||||
l = [1, 2, 3, 4]
|
||||
l[0:4:2] = [5, 6]
|
||||
print(l)
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Start/end indices such as str.endswith(s, start) not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print("abc".endswith("c", 1))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Attributes/subscr not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print("{a[0]}".format(a=[1, 2]))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: str(...) with keywords not implemented
|
|||
cause: Unknown
|
||||
workaround: Input the encoding format directly. eg ``print(bytes('abc', 'utf-8'))``
|
||||
"""
|
||||
|
||||
print(str(b"abc", encoding="utf8"))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: str.ljust() and str.rjust() not implemented
|
|||
cause: MicroPython is highly optimized for memory usage. Easy workarounds available.
|
||||
workaround: Instead of ``s.ljust(10)`` use ``"%-10s" % s``, instead of ``s.rjust(10)`` use ``"% 10s" % s``. Alternatively, ``"{:<10}".format(s)`` or ``"{:>10}".format(s)``.
|
||||
"""
|
||||
|
||||
print("abc".ljust(10))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: None as first argument for rsplit such as str.rsplit(None, n) not i
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print("a a a".rsplit(None, 1))
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Subscript with step != 1 is not yet implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print("abcdefghi"[0:9:2])
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ description: Tuple load with step != 1 not implemented
|
|||
cause: Unknown
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
print((1, 2, 3, 4)[0:4:2])
|
||||
|
|
|
|||
|
|
@ -136,6 +136,4 @@ def singleTraj(system, trajStart, h=0.02, tend=1.0):
|
|||
# phaseDiagram(sysSM, (lambda i, j: [0.354, 0.654, 1.278, 0.8 + 0.2 * i, 0.1 + 0.1 * j]), (lambda a: (a[4], a[5])), h=0.1, tend=math.log(10**17))
|
||||
|
||||
# initial conditions at M_Z
|
||||
singleTraj(
|
||||
sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)
|
||||
) # true values
|
||||
singleTraj(sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)) # true values
|
||||
|
|
|
|||
|
|
@ -270,9 +270,9 @@ def do_all_the_things(
|
|||
manual_symbol_map["0x200015e0"] = "mp_state_ctx.vm.dict_main"
|
||||
|
||||
for i in range(READLINE_HIST_SIZE):
|
||||
manual_symbol_map[
|
||||
"mp_state_ctx+{}".format(148 + i * 4)
|
||||
] = "mp_state_ctx.vm.readline_hist[{}]".format(i)
|
||||
manual_symbol_map["mp_state_ctx+{}".format(148 + i * 4)] = (
|
||||
"mp_state_ctx.vm.readline_hist[{}]".format(i)
|
||||
)
|
||||
|
||||
tuple_type = symbols["mp_type_tuple"][0]
|
||||
type_type = symbols["mp_type_type"][0]
|
||||
|
|
@ -541,10 +541,10 @@ def do_all_the_things(
|
|||
)
|
||||
node.attr["shape"] = "plaintext"
|
||||
node.attr["style"] = "invisible"
|
||||
node.attr[
|
||||
"label"
|
||||
] = '<<table bgcolor="gold" border="1" cellpadding="0" cellspacing="0"><tr><td colspan="2">0x{:08x}</td></tr>{}</table>>'.format(
|
||||
block, rows
|
||||
node.attr["label"] = (
|
||||
'<<table bgcolor="gold" border="1" cellpadding="0" cellspacing="0"><tr><td colspan="2">0x{:08x}</td></tr>{}</table>>'.format(
|
||||
block, rows
|
||||
)
|
||||
)
|
||||
|
||||
for node, degree in ownership_graph.in_degree_iter():
|
||||
|
|
@ -623,10 +623,10 @@ def do_all_the_things(
|
|||
remaining_bytecode -= 16
|
||||
for i in range(remaining_bytecode // 16):
|
||||
rows += '<tr><td colspan="16" bgcolor="seagreen" height="18" width="80"></td></tr>'
|
||||
node.attr[
|
||||
"label"
|
||||
] = '<<table border="1" cellspacing="0"><tr><td colspan="16" bgcolor="lightseagreen" height="18" width="80">0x{:08x}</td></tr>{}</table>>'.format(
|
||||
block, rows
|
||||
node.attr["label"] = (
|
||||
'<<table border="1" cellspacing="0"><tr><td colspan="16" bgcolor="lightseagreen" height="18" width="80">0x{:08x}</td></tr>{}</table>>'.format(
|
||||
block, rows
|
||||
)
|
||||
)
|
||||
|
||||
for block in qstr_chunks:
|
||||
|
|
@ -660,10 +660,10 @@ def do_all_the_things(
|
|||
for i in range(0, len(printable_qstrs), 16):
|
||||
wrapped.append(html.escape(printable_qstrs[i : i + 16]))
|
||||
node = ownership_graph.get_node(block)
|
||||
node.attr[
|
||||
"label"
|
||||
] = '<<table border="1" cellspacing="0" bgcolor="lightsalmon" width="80"><tr><td height="18" >0x{:08x}</td></tr><tr><td height="{}" >{}</td></tr></table>>'.format(
|
||||
block, 18 * (len(wrapped) - 1), "<br/>".join(wrapped)
|
||||
node.attr["label"] = (
|
||||
'<<table border="1" cellspacing="0" bgcolor="lightsalmon" width="80"><tr><td height="18" >0x{:08x}</td></tr><tr><td height="{}" >{}</td></tr></table>>'.format(
|
||||
block, 18 * (len(wrapped) - 1), "<br/>".join(wrapped)
|
||||
)
|
||||
)
|
||||
node.attr["fontname"] = "FiraCode-Bold"
|
||||
if block >= long_lived_start:
|
||||
|
|
@ -744,10 +744,10 @@ def do_all_the_things(
|
|||
rows += '<tr><td port="{}" height="18" width="40">{}</td><td port="{}" height="18" width="40">{}</td></tr>'.format(
|
||||
cells[2 * i][0], cells[2 * i][1], cells[2 * i + 1][0], cells[2 * i + 1][1]
|
||||
)
|
||||
node.attr[
|
||||
"label"
|
||||
] = '<<table bgcolor="gold" border="1" cellpadding="0" cellspacing="0">{}</table>>'.format(
|
||||
rows
|
||||
node.attr["label"] = (
|
||||
'<<table bgcolor="gold" border="1" cellpadding="0" cellspacing="0">{}</table>>'.format(
|
||||
rows
|
||||
)
|
||||
)
|
||||
|
||||
ownership_graph.add_node(
|
||||
|
|
|
|||
|
|
@ -158,9 +158,11 @@ def get_commit_depth_and_check_suite(query_commits):
|
|||
if check_suite["workflowRun"]["workflow"]["name"] == "Build CI":
|
||||
return [
|
||||
{"sha": commit_sha, "depth": commit_depth},
|
||||
check_suite["id"]
|
||||
if check_suite["conclusion"] != "SUCCESS"
|
||||
else None,
|
||||
(
|
||||
check_suite["id"]
|
||||
if check_suite["conclusion"] != "SUCCESS"
|
||||
else None
|
||||
),
|
||||
]
|
||||
if not query_commits.paginate(commits["pageInfo"], "beforeCommit"):
|
||||
return [None, None]
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ PORT_DEPS = {
|
|||
"data/nvm.toml/",
|
||||
],
|
||||
"silabs": ["extmod/ulab/", "data/nvm.toml/"],
|
||||
"stm": ["extmod/ulab/", "lib/mp3/", "lib/protomatter/", "lib/tinyusb/", "data/nvm.toml/"]
|
||||
"stm": ["extmod/ulab/", "lib/mp3/", "lib/protomatter/", "lib/tinyusb/", "data/nvm.toml/"],
|
||||
# omit unix which is part of the "test" target below
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue