Skip to content

Commit 0895576

Browse files
committed
update stubs
1 parent e07f5cb commit 0895576

5,985 files changed

Lines changed: 315542 additions & 48833 deletions

File tree

Some content is hidden

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

all_modules.json

Lines changed: 30697 additions & 7637 deletions
Large diffs are not rendered by default.

publish/micropython-v1_20_0-rp2-pimoroni_picolipo_16mb-stubs/LICENSE.md renamed to publish/micropython-latest-esp32-esp32_generic-stubs/LICENSE.md

File renamed without changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# micropython-esp32-esp32_generic-stubs
2+
3+
4+
This is a stub-only package for MicroPython.
5+
It is intended to be installed in a projects virtual environment to allow static type checkers and intellisense features to be used while writing Micropython code.
6+
7+
The version of this package is alligned the the version of the MicroPython firmware.
8+
- Major, Minor and Patch levels are alligned to the same version as the firmware.
9+
- The post release level is used to publish new releases of the stubs.
10+
11+
For `Micropython 1.17` the stubs are published as `1.17.post1` ... `1.17.post2`
12+
for `Micropython 1.18` the stubs are published as `1.18.post1` ... `1.18.post2`
13+
14+
To install the latest stubs:
15+
`pip install -I micropython-<port>-stubs` where port is the port of the MicroPython firmware.
16+
17+
To install the stubs for an older version, such as MicroPython 1.17:
18+
`pip install micropython-stm32-stubs==1.17.*` which will install the last post release of the stubs for MicroPython 1.17.
19+
20+
21+
As the creation of the stubs, and merging of the different types is still going though improvements, the stub packages are marked as Beta.
22+
To upgrade stubs to the latest stubs for a specific version use `pip install micropython-stm32-stubs==1.17.* --upgrade`
23+
24+
If you have suggestions or find any issues with the stubs, please report them in the [MicroPython-stubs Discussions](https://github.com/Josverl/micropython-stubs/discussions)
25+
26+
For an overview of Micropython Stubs please see: https://micropython-stubs.readthedocs.io/en/main/
27+
* List of all stubs : https://micropython-stubs.readthedocs.io/en/main/firmware_grp.html
28+
29+
Included stubs:
30+
* Merged stubs from `stubs/micropython-latest-esp32-ESP32_GENERIC-merged`
31+
* Frozen stubs from `stubs/micropython-latest-frozen/esp32/GENERIC`
32+
* Core stubs from `stubs/micropython-core`
33+
34+
35+
origin | Family | Port | Board | Version
36+
-------|--------|------|-------|--------
37+
Documentation | micropython | - | - | latest
38+
Core | micropython | esp32 | - | latest
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Allows for type checking of Micropython specific builtins by pyright and pylance.
2+
"""
3+
4+
from typing import Tuple, TypeVar
5+
6+
Const_T = TypeVar("Const_T", int, float, str, bytes, Tuple) # constant
7+
8+
def const(expr: Const_T) -> Const_T:
9+
"""
10+
Used to declare that the expression is a constant so that the compiler can
11+
optimise it. The use of this function should be as follows::
12+
13+
from micropython import const
14+
15+
CONST_X = const(123)
16+
CONST_Y = const(2 * CONST_X + 1)
17+
18+
Constants declared this way are still accessible as global variables from
19+
outside the module they are declared in. On the other hand, if a constant
20+
begins with an underscore then it is hidden, it is not available as a global
21+
variable, and does not take up any memory during execution.
22+
23+
This `const` function is recognised directly by the MicroPython parser and is
24+
provided as part of the :mod:`micropython` module mainly so that scripts can be
25+
written which run under both CPython and MicroPython, by following the above
26+
pattern.
27+
"""
28+
...
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""
2+
Asynchronous I/O scheduler for writing concurrent code.
3+
4+
MicroPython module: https://docs.micropython.org/en/latest/library/asyncio.html
5+
6+
CPython module:
7+
`asyncio `<https://docs.python.org/3.8/library/asyncio.html>
8+
9+
Example::
10+
11+
import asyncio
12+
13+
async def blink(led, period_ms):
14+
while True:
15+
led.on()
16+
await asyncio.sleep_ms(5)
17+
led.off()
18+
await asyncio.sleep_ms(period_ms)
19+
20+
async def main(led1, led2):
21+
asyncio.create_task(blink(led1, 700))
22+
asyncio.create_task(blink(led2, 400))
23+
await asyncio.sleep_ms(10_000)
24+
25+
# Running on a pyboard
26+
from pyb import LED
27+
asyncio.run(main(LED(1), LED(2)))
28+
29+
# Running on a generic board
30+
from machine import Pin
31+
asyncio.run(main(Pin(1), Pin(2)))
32+
33+
Core functions
34+
--------------
35+
"""
36+
from _typeshed import Incomplete, Incomplete as Incomplete
37+
from typing import Any, Coroutine, List, Tuple
38+
39+
class TaskQueue:
40+
def push(self, *args, **kwargs) -> Incomplete: ...
41+
def peek(self, *args, **kwargs) -> Incomplete: ...
42+
def remove(self, *args, **kwargs) -> Incomplete: ...
43+
def pop(self, *args, **kwargs) -> Incomplete: ...
44+
def __init__(self, *argv, **kwargs) -> None: ...
45+
46+
class Task:
47+
"""
48+
This object wraps a coroutine into a running task. Tasks can be waited on
49+
using ``await task``, which will wait for the task to complete and return
50+
the return value of the task.
51+
52+
Tasks should not be created directly, rather use `create_task` to create them.
53+
"""
54+
55+
def __init__(self) -> None: ...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from _typeshed import Incomplete
2+
3+
vfs: Incomplete
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
ESP-NOW :doc:`asyncio` support.
3+
4+
MicroPython module: https://docs.micropython.org/en/latest/library/aioespnow.html
5+
"""
6+
from _typeshed import Incomplete, Incomplete as Incomplete
7+
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
8+
9+
MAX_DATA_LEN: int
10+
MAX_TOTAL_PEER_NUM: int
11+
MAX_ENCRYPT_PEER_NUM: int
12+
ADDR_LEN: int
13+
KEY_LEN: int
14+
15+
class ESPNowBase:
16+
def irq(self, *args, **kwargs) -> Incomplete: ...
17+
def mod_peer(self, *args, **kwargs) -> Incomplete: ...
18+
def get_peers(self, *args, **kwargs) -> Incomplete: ...
19+
def stats(self, *args, **kwargs) -> Incomplete: ...
20+
def set_pmk(self, *args, **kwargs) -> Incomplete: ...
21+
def peer_count(self, *args, **kwargs) -> Incomplete: ...
22+
def recvinto(self, *args, **kwargs) -> Incomplete: ...
23+
def send(self, *args, **kwargs) -> Incomplete: ...
24+
def active(self, *args, **kwargs) -> Incomplete: ...
25+
def any(self, *args, **kwargs) -> Incomplete: ...
26+
def get_peer(self, *args, **kwargs) -> Incomplete: ...
27+
def del_peer(self, *args, **kwargs) -> Incomplete: ...
28+
def add_peer(self, *args, **kwargs) -> Incomplete: ...
29+
def config(self, *args, **kwargs) -> Incomplete: ...
30+
def __init__(self, *argv, **kwargs) -> None: ...
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from _typeshed import Incomplete as Incomplete
2+
3+
def reset(*args, **kwargs) -> Incomplete: ...
4+
def writebyte(*args, **kwargs) -> Incomplete: ...
5+
def writebit(*args, **kwargs) -> Incomplete: ...
6+
def crc8(*args, **kwargs) -> Incomplete: ...
7+
def readbyte(*args, **kwargs) -> Incomplete: ...
8+
def readbit(*args, **kwargs) -> Incomplete: ...
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
Multithreading support.
3+
4+
MicroPython module: https://docs.micropython.org/en/latest/library/_thread.html
5+
6+
CPython module: :mod:`python:_thread` https://docs.python.org/3/library/_thread.html .
7+
8+
This module implements multithreading support.
9+
10+
This module is highly experimental and its API is not yet fully settled
11+
and not yet described in this documentation.
12+
"""
13+
from _typeshed import Incomplete, Incomplete as Incomplete
14+
15+
def get_ident(*args, **kwargs) -> Incomplete: ...
16+
def start_new_thread(*args, **kwargs) -> Incomplete: ...
17+
def stack_size(*args, **kwargs) -> Incomplete: ...
18+
def exit(*args, **kwargs) -> Incomplete: ...
19+
def allocate_lock(*args, **kwargs) -> Incomplete: ...
20+
21+
class LockType:
22+
def locked(self, *args, **kwargs) -> Incomplete: ...
23+
def release(self, *args, **kwargs) -> Incomplete: ...
24+
def acquire(self, *args, **kwargs) -> Incomplete: ...
25+
def __init__(self, *argv, **kwargs) -> None: ...
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import espnow
2+
from _typeshed import Incomplete
3+
from collections.abc import Generator
4+
5+
class AIOESPNow(espnow.ESPNow):
6+
async def arecv(self) -> Generator[Incomplete, None, Incomplete]: ...
7+
async def airecv(self) -> Generator[Incomplete, None, Incomplete]: ...
8+
async def asend(self, mac, msg: Incomplete | None = ..., sync: Incomplete | None = ...) -> Generator[Incomplete, None, Incomplete]: ...
9+
def __aiter__(self): ...
10+
async def __anext__(self): ...

0 commit comments

Comments
 (0)