Remove blink and animate, which aren't implemented. These weren't displayed in the docs, so this is not a real change; it just makes typing more correct.
Also remove pybricks.common.Light which isn't used anywhere.
pupdevices.Light is a standalone light that does not support animations or blinks, so don't inherit from this nonexistent class.
Also remove the ColorLight.reset() method which was never implemented.
This formats return types so they don't look like tuples:
int: deg
If we can figure out how these nodes work, we can create proper links
and maybe use italics for the units or a slightly different font color.
Previously, arguments had "types" like ":ref:`speed`", which would be rendered by Sphinx as a hyperlink and displayed as "rotational speed: deg/s".
This worked well enough but it had a few shortcomings:
- It looks bad on autocomplete, which doesn't know how to render RST with cross references.
- No real type information: int, float, ... ?
- Some units are very long, making the docs less concise.
- The unified approach doesn't always work. Some method arguments can be either deg/s or mm/s, depending on the application. This gets even lengthier.
- It's hard to maintain if you don't know what to link to.
In the new approach, the unit is just added to the type as plain text. Instead of giving the physical signal name, we give the real data type, which is more standard. The physical signal name is usually apparent from the docstring anyway, and can be inferred from the unit as well. This also solves all of the above problems.
Since most Pybricks methods allow both int and float for numeric inputs, we document these as a Number type, which is the union of int and float. Since the type is no longer directly tied to the type, we can still document the return type correctly, since this is never a union.
Instead of having complicated hacks in Sphinx to make this work (I have tried many), it turns out we can conveniently suppress broken references and still display the units. The only downside is that units will no longer have hyperlinks to the signal pages, at least for the moment. We should be able to make on_missing_reference a bit smarter to format the units as we see fit if needed.
The approach here is exemplified in the Motor.run_until_stalled method. Subsequent commits will apply it everywhere. Also clarify the behavior for duty_limit=None while we are updating this code anyway.
Fixes https://github.com/pybricks/pybricks-api/issues/94
For Move Hub, this is a breaking change since Move Hub IMU support
was already released. For the other hubs, the IMU API has not been
released yet, so we can do this silently.
This was previously dropped in a2583944d9
but it was added in again in c666009511.
Since this module was never included in a release (it was hidden),
it is OK to do this.
The Microsoft Python extension for VS code doesn't include imports in
type hints, so the Motor type wasn't working properly. We can fix this
by wrapping the import type in a new, empty class definition.
The DCMotor class was also missing from ev3devices and the typing for
the overloaded reset_angle method in pupdevices was missing. These are
fixed as well.
Override typed docstrings in order to hide types like SupportsFloat and SupportsComplex.
Avoid use of ``real`` and ``imag``, since both ``a`` and ``b`` can be
either.
Also reduce number of overloads by letting ``b`` default to 0, which is true in practice.
See also https://github.com/pybricks/pybricks-api/issues/84