Skip to content

Commit 1c19926

Browse files
authored
Merge pull request #10485 from dunkmann00/static-stubs
Add a static stubs directory
2 parents 707e621 + b4a8d45 commit 1c19926

File tree

5 files changed

+23
-158
lines changed

5 files changed

+23
-158
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ stubs:
280280
sed -e "s,__version__,`python -msetuptools_scm`," < setup.py-stubs > circuitpython-stubs/setup.py
281281
cp README.rst-stubs circuitpython-stubs/README.rst
282282
cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in
283+
cp -r stubs/* circuitpython-stubs
283284
$(PYTHON) tools/board_stubs/build_board_specific_stubs/board_stub_builder.py
284285
cp -r tools/board_stubs/circuitpython_setboard circuitpython-stubs/circuitpython_setboard
285286
$(PYTHON) -m build circuitpython-stubs

docs/library/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ the following libraries.
5454
.. toctree::
5555
:maxdepth: 1
5656

57-
micropython.rst
57+
../../shared-bindings/micropython/index.rst

docs/library/micropython.rst

Lines changed: 0 additions & 157 deletions
This file was deleted.

docs/redirects.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
index.rst README.html
2+
docs/library/micropython.rst shared-bindings/micropython
23
shared-bindings//__init__.rst shared-bindings//
34
shared-bindings/_bleio/Adapter.rst shared-bindings/_bleio/#_bleio.Adapter
45
shared-bindings/_bleio/Address.rst shared-bindings/_bleio/#_bleio.Address

stubs/micropython/__init__.pyi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""Access and control MicroPython internals"""
2+
3+
def const[T](expr: T) -> T:
4+
"""Used to declare that the expression is a constant so that the compiler
5+
can optimise it. The use of this function should be as follows::
6+
7+
from micropython import const
8+
9+
CONST_X = const(123)
10+
CONST_Y = const(2 * CONST_X + 1)
11+
12+
Constants declared this way are still accessible as global variables from
13+
outside the module they are declared in. On the other hand, if a constant
14+
begins with an underscore then it is hidden, it is not available as a global
15+
variable, and does not take up any memory during execution.
16+
17+
This `const` function is recognised directly by the MicroPython parser and is
18+
provided as part of the :mod:`micropython` module mainly so that scripts can be
19+
written which run under both CPython and MicroPython, by following the above
20+
pattern."""

0 commit comments

Comments
 (0)