]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/micropython-stubs/micropython.pyi
Provide stubs for micropython module
[Adafruit_Blinka-hackapet.git] / src / micropython-stubs / micropython.pyi
diff --git a/src/micropython-stubs/micropython.pyi b/src/micropython-stubs/micropython.pyi
new file mode 100644 (file)
index 0000000..7ae9330
--- /dev/null
@@ -0,0 +1,29 @@
+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+"""
+`micropython` - MicroPython Specific Decorator Functions
+========================================================
+
+* Author(s): cefn
+"""
+
+from typing import Callable, TypeVar, Any, NoReturn
+
+Fun = TypeVar("Fun", bound=Callable[..., Any])
+
+def const(x: int) -> int:
+    "Emulate making a constant"
+    return x
+
+def native(f: Fun) -> Fun:
+    "Emulate making a native"
+    return f
+
+def viper(f: Fun) -> NoReturn:
+    "User is attempting to use a viper code emitter"
+    raise SyntaxError("invalid micropython decorator")
+
+def asm_thumb(f: Fun) -> NoReturn:
+    "User is attempting to use an inline assembler"
+    raise SyntaxError("invalid micropython decorator")