X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/ad1ec71a68caa20e59fd41227df5c995e6c546a4..c468ab77793c856024a966cf5230d4da019bd7a6:/src/micropython/__init__.py diff --git a/src/micropython/__init__.py b/src/micropython/__init__.py new file mode 100755 index 0000000..5f6d73f --- /dev/null +++ b/src/micropython/__init__.py @@ -0,0 +1,33 @@ +# 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 + +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) -> None: + "User is attempting to use a viper code emitter" + raise SyntaxError("invalid micropython decorator") + + +def asm_thumb(f: Fun) -> None: + "User is attempting to use an inline assembler" + raise SyntaxError("invalid micropython decorator")