mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 09:37:25 +00:00
micropython: Drop TConst type.
TConst does not exist, so adding it makes it a bit harder to read than needed. The const() "function" will take int or float, and the return value can be used as such, even if it is optimized out. This is described in the docstring, so we can leave out the additional type. Also adds autofunctions in place of one auto module so we can move things around as needed. Also fix cross links with usys to get the build to pass before we update that module.
This commit is contained in:
@@ -9,15 +9,10 @@
|
||||
Access and control MicroPython internals.
|
||||
"""
|
||||
|
||||
from typing import Any, Literal, TypeVar, overload
|
||||
|
||||
TConst = TypeVar("TConst", int, float)
|
||||
"""
|
||||
Allowable types for :meth:`const`.
|
||||
"""
|
||||
from typing import Any, Literal, Union, overload
|
||||
|
||||
|
||||
def const(expr: TConst) -> TConst:
|
||||
def const(expression: Union[int, float]) -> Union[int, float]:
|
||||
"""
|
||||
Used to declare that the expression is a constant so that the compile can
|
||||
optimise it. The use of this function should be as follows::
|
||||
|
||||
Reference in New Issue
Block a user