]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/micropython-stubs/micropython.pyi
7ae9330ab1f77444dcf50af07870f6e0e7d9d6a2
[Adafruit_Blinka-hackapet.git] / src / micropython-stubs / micropython.pyi
1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
2 #
3 # SPDX-License-Identifier: MIT
4 """
5 `micropython` - MicroPython Specific Decorator Functions
6 ========================================================
7
8 * Author(s): cefn
9 """
10
11 from typing import Callable, TypeVar, Any, NoReturn
12
13 Fun = TypeVar("Fun", bound=Callable[..., Any])
14
15 def const(x: int) -> int:
16     "Emulate making a constant"
17     return x
18
19 def native(f: Fun) -> Fun:
20     "Emulate making a native"
21     return f
22
23 def viper(f: Fun) -> NoReturn:
24     "User is attempting to use a viper code emitter"
25     raise SyntaxError("invalid micropython decorator")
26
27 def asm_thumb(f: Fun) -> NoReturn:
28     "User is attempting to use an inline assembler"
29     raise SyntaxError("invalid micropython decorator")