Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typehints/esp32: Fix several syntax errors in the type stubs. #322

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions typehints/esp32/esp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
"""
Expand All @@ -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
"""
...
24 changes: 12 additions & 12 deletions typehints/esp32/esp32.pyi
Original file line number Diff line number Diff line change
@@ -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] = ...
Expand Down Expand Up @@ -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.

Expand All @@ -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``."""

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -287,4 +287,4 @@ class NVS:
"""Erases a key-value pair."""

def commit(self):
"""Commits changes made by set_xxx methods to flash."""
"""Commits changes made by set_xxx methods to flash."""