From d92dc8084a38204adb5cf0453ba789f4226039ae Mon Sep 17 00:00:00 2001 From: George Waters Date: Mon, 14 Jul 2025 11:20:32 -0400 Subject: [PATCH] Make micropython.const accept any constant type micropython.const now supports any constant type, not just int. This updates the type checking to reflect this. This also updates the name of the file so that type checkers can find it. --- src/micropython-stubs/{micropython.pyi => __init__.pyi} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/micropython-stubs/{micropython.pyi => __init__.pyi} (95%) diff --git a/src/micropython-stubs/micropython.pyi b/src/micropython-stubs/__init__.pyi similarity index 95% rename from src/micropython-stubs/micropython.pyi rename to src/micropython-stubs/__init__.pyi index 33dd6a9..5026b97 100644 --- a/src/micropython-stubs/micropython.pyi +++ b/src/micropython-stubs/__init__.pyi @@ -12,7 +12,7 @@ from typing import Callable, TypeVar, Any, NoReturn Fun = TypeVar("Fun", bound=Callable[..., Any]) -def const(x: int) -> int: +def const[T](x: T) -> T: "Emulate making a constant" def native(f: Fun) -> Fun: -- 2.49.0