Skip to content

Commit 13d81b7

Browse files
committed
Update stubs for use by MyPy, and multiple other improvements
1 parent eaab299 commit 13d81b7

File tree

993 files changed

+39028
-42482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

993 files changed

+39028
-42482
lines changed

Manual stub build chain.ipynb

Lines changed: 5729 additions & 2537 deletions
Large diffs are not rendered by default.

publish/micropython-stdlib-stubs/stdlib/io.pyi

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@ from _typeshed import Incomplete
104104
from array import array
105105
from typing_extensions import Awaitable, TypeAlias, TypeVar
106106

107-
_T = TypeVar("_T")
108-
AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True)
109-
StrOrBytesPath = TypeVar("StrOrBytesPath", str, bytes, PathLike[str], PathLike[bytes])
110-
_OpenFile = TypeVar("_OpenFile", str, bytes, PathLike[str], PathLike[bytes], int)
111-
AnyReadableBuf = TypeVar("AnyReadableBuf", bytearray, array, memoryview, bytes)
112-
AnyWritableBuf = TypeVar("AnyWritableBuf", bytearray, array, memoryview)
113-
_Self = TypeVar("_Self")
114-
115107
__all__ = [
116108
"BlockingIOError",
117109
"open",
@@ -142,6 +134,13 @@ if sys.version_info >= (3, 11):
142134
# SEEK_SET: Final = 0
143135
# SEEK_CUR: Final = 1
144136
# SEEK_END: Final = 2
137+
_T = TypeVar("_T")
138+
AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True)
139+
StrOrBytesPath = TypeVar("StrOrBytesPath", str, bytes, PathLike[str], PathLike[bytes])
140+
_OpenFile = TypeVar("_OpenFile", str, bytes, PathLike[str], PathLike[bytes], int)
141+
AnyReadableBuf = TypeVar("AnyReadableBuf", bytearray, array, memoryview, bytes)
142+
AnyWritableBuf = TypeVar("AnyWritableBuf", bytearray, array, memoryview)
143+
_Self = TypeVar("_Self")
145144

146145
class UnsupportedOperation(OSError, ValueError): ...
147146
class IOBase(_IOBase, metaclass=abc.ABCMeta): ...

publish/micropython-stdlib-stubs/stdlib/ssl.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,4 @@ if sys.version_info < (3, 9):
658658
# SOCK_STREAM: int
659659
# SOL_SOCKET: int
660660
# SO_TYPE: int
661+
MBEDTLS_VERSION: str = "Mbed TLS 3.6.0"

publish/micropython-stdlib-stubs/stdlib/sys/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ from io import TextIOWrapper
1616
from types import FrameType, ModuleType, TracebackType
1717
from typing import Callable, overload, Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final
1818
from typing_extensions import Awaitable, TypeVar, TypeAlias
19-
from _mpy_shed import IOBase_mp
19+
from _mpy_shed import IOBase_mp, _mp_implementation
2020

2121
_T = TypeVar("_T")
2222

@@ -194,7 +194,7 @@ class _hash_info(structseq[Any | int], tuple[int, int, int, int, int, str, int,
194194
@property
195195
def cutoff(self) -> int: ... # undocumented
196196

197-
implementation: _implementation
197+
implementation: _mp_implementation
198198

199199
class _implementation:
200200
name: str

publish/micropython-v1_24_1-esp32-esp32_generic-stubs/bluetooth.pyi

Lines changed: 899 additions & 23 deletions
Large diffs are not rendered by default.

publish/micropython-v1_24_1-esp32-esp32_generic-stubs/deflate.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ class DeflateIO:
8181
def readinto(self, *args, **kwargs) -> Incomplete: ...
8282
def read(self, *args, **kwargs) -> Incomplete: ...
8383
def close(self, *args, **kwargs) -> Incomplete: ...
84-
def __init__(self, *argv, **kwargs) -> None: ...
84+
def __init__(self, stream, format=AUTO, wbits=0, close=False, /) -> None: ...

publish/micropython-v1_24_1-esp32-esp32_generic-stubs/errno.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
"""
2+
System error codes.
3+
4+
MicroPython module: https://docs.micropython.org/en/v1.24.0/library/errno.html
5+
6+
CPython module: :mod:`python:errno` https://docs.python.org/3/library/errno.html .
7+
8+
This module provides access to symbolic error codes for `OSError` exception.
9+
A particular inventory of codes depends on :term:`MicroPython port`.
10+
11+
---
212
Module: 'errno' on micropython-v1.24.1-esp32-ESP32_GENERIC
313
"""
414

515
# MCU: {'family': 'micropython', 'version': '1.24.1', 'build': '', 'ver': '1.24.1', 'port': 'esp32', 'board': 'ESP32_GENERIC', 'cpu': 'ESP32', 'mpy': 'v6.3', 'arch': 'xtensawin'}
616
# Stubber: v1.24.0
717
from __future__ import annotations
818
from _typeshed import Incomplete
19+
from typing import Dict
20+
from typing_extensions import Awaitable, TypeAlias, TypeVar
921

1022
ENOBUFS: int = 105
1123
ENODEV: int = 19

publish/micropython-v1_24_1-esp32-esp32_generic-stubs/esp32.pyi

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class ULP:
130130
"""
131131
...
132132

133-
def __init__(self, *argv, **kwargs) -> None:
133+
def __init__(self) -> None:
134134
"""
135135
This class provides access to the Ultra-Low-Power co-processor.
136136
"""
@@ -190,7 +190,7 @@ class NVS:
190190
"""
191191
...
192192

193-
def __init__(self, *argv, **kwargs) -> None:
193+
def __init__(self, namespace: str, /) -> None:
194194
"""
195195
Create an object providing access to a namespace (which is automatically created if not
196196
present).
@@ -322,7 +322,7 @@ class Partition(AbstractBlockDev):
322322
"""
323323
...
324324

325-
def __init__(self, *argv, **kwargs) -> None:
325+
def __init__(self, id: str, block_size=4096, /) -> None:
326326
"""
327327
Create an object representing a partition.
328328
@@ -516,7 +516,16 @@ class RMT:
516516
"""
517517
...
518518

519-
def __init__(self, *argv, **kwargs) -> None:
519+
def __init__(
520+
self,
521+
channel: int,
522+
/,
523+
*,
524+
pin: Pin | None = None,
525+
clock_div: int = 8,
526+
idle_level: bool = False,
527+
tx_carrier: Tuple[int, int, bool] | None = None,
528+
) -> None:
520529
"""
521530
This class provides access to one of the eight RMT channels. *channel* is
522531
required and identifies which RMT channel (0-7) will be configured. *pin*,

publish/micropython-v1_24_1-esp32-esp32_generic-stubs/espnow.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ from _espnow import ESPNowBase
1515
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, overload
1616
from typing_extensions import Awaitable, TypeAlias, TypeVar
1717

18-
_MACAddress: TypeAlias = bytes
19-
_PeerInfo: TypeAlias = Tuple[_MACAddress, bytes, int, int, bool]
20-
2118
KEY_LEN: int = 16
2219
MAX_DATA_LEN: int = 250
2320
MAX_ENCRYPT_PEER_NUM: int = 6
2421
MAX_TOTAL_PEER_NUM: int = 20
2522
ADDR_LEN: int = 6
23+
_MACAddress: TypeAlias = bytes
24+
_PeerInfo: TypeAlias = Tuple[_MACAddress, bytes, int, int, bool]
2625

2726
class ESPNow(ESPNowBase, Iterator):
2827
"""
@@ -546,7 +545,7 @@ class ESPNow(ESPNowBase, Iterator):
546545
"""
547546
...
548547

549-
def __init__(self, *argv, **kwargs) -> None: ...
548+
def __init__(self) -> None: ...
550549
#
551550
@overload # force merge
552551
def __iter__(self) -> ESPNow: ...

publish/micropython-v1_24_1-esp32-esp32_generic-stubs/framebuf.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,15 @@ class FrameBuffer:
180180
...
181181

182182
def fill_rect(self, *args, **kwargs) -> Incomplete: ...
183-
def __init__(self, *argv, **kwargs) -> None:
183+
def __init__(
184+
self,
185+
buffer: AnyWritableBuf,
186+
width: int,
187+
height: int,
188+
format: int,
189+
stride: int = ...,
190+
/,
191+
) -> None:
184192
"""
185193
Construct a FrameBuffer object. The parameters are:
186194

0 commit comments

Comments
 (0)