From 0294d2998309b3bb1cc7f0783baa80844940ee9c Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 25 Aug 2024 22:36:43 +0200 Subject: [PATCH] typehints/esp32: Fix several syntax errors in the type stubs. Signed-off-by: Jos Verlinde --- typehints/esp32/esp.pyi | 6 ++++++ typehints/esp32/esp32.pyi | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/typehints/esp32/esp.pyi b/typehints/esp32/esp.pyi index dee3aa97..29790bd9 100644 --- a/typehints/esp32/esp.pyi +++ b/typehints/esp32/esp.pyi @@ -10,15 +10,20 @@ LOG_VERBOSE: Final[int] = ... def flash_size(): """Read the total size of the flash memory.""" + ... def flash_user_start(): """Read the memory offset at which the user flash space begins.""" + ... def flash_read(byte_offset, length_or_buffer): + ... def flash_write(byte_offset, bytes): + ... def flash_erase(sector_no): + ... def osdebug(level: Optional[int]): """ @@ -33,3 +38,4 @@ def osdebug(level: Optional[int]): * ``LOG_DEBUG`` – Extra information which is not necessary for normal use (values, pointers, sizes, etc) * ``LOG_VERBOSE`` – Bigger chunks of debugging information, or frequent messages which can potentially flood the output """ + ... diff --git a/typehints/esp32/esp32.pyi b/typehints/esp32/esp32.pyi index 90d1c0b5..408ead6d 100644 --- a/typehints/esp32/esp32.pyi +++ b/typehints/esp32/esp32.pyi @@ -1,5 +1,5 @@ from machine import Pin -from typing import Optional +from typing import Optional, overload from typing import Final HEAP_DATA: Final[int] = ... @@ -105,7 +105,7 @@ class Partition: """ @classmethod - def find(self, type=TYPE_APP, subtype=0xff, label=None, block_size=4096) -> list: + def find(self, type=TYPE_APP, subtype=0xFF, label=None, block_size=4096) -> list: """ Find a partition specified by type, subtype and label. @@ -120,14 +120,14 @@ class Partition: :return: A 6-tuple ``(type, subtype, addr, size, label, encrypted)``. """ - def readblocks(self, block_num, buf): - - def readblocks(self, block_num, buf, offset): - - def writeblocks(self, block_num, buf): - - def writeblocks(self, block_num, buf, offset): - + @overload + def readblocks(self, block_num, buf): ... + @overload + def readblocks(self, block_num, buf, offset): ... + @overload + def writeblocks(self, block_num, buf): ... + @overload + def writeblocks(self, block_num, buf, offset): ... def ioctl(self, cmd, arg): """These methods implement the simple and extended block protocol defined by ``os.AbstractBlockDev``.""" @@ -227,7 +227,7 @@ class RMT: """ @staticmethod - def bitstream_channel([value]) -> int: + def bitstream_channel(value:int|None) -> int: """ Select which RMT channel is used by the ``machine.bitstream`` implementation. @@ -287,4 +287,4 @@ class NVS: """Erases a key-value pair.""" def commit(self): - """Commits changes made by set_xxx methods to flash.""" \ No newline at end of file + """Commits changes made by set_xxx methods to flash."""