Skip to content

Commit 32f974e

Browse files
authored
Robotics.py: Fix issue with the type stub for DriveBase.angle() (#165)
The type was changed from `int` to `float` in pybricks/pybricks-micropython@4d457a1. Technically, it is still `int` on BOOST Move hub (any system without floating point support). But most platforms use `float` so makes sense to have that in the type hints.
1 parent 0efcfd4 commit 32f974e

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## Unreleased
66

7+
### Fixed
8+
9+
- Fixed `DriveBase.angle` reporting an incorrect return type.
10+
711
## 3.6.1 - 2025-05-01
812

913
### Fixed

jedi/tests/test_get_signature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ def _get_method_signature(module: str, type: str, method: str) -> SignatureHelp:
10201020
pytest.param("pybricks.robotics", "DriveBase", "stop", [([], "None")]),
10211021
pytest.param("pybricks.robotics", "DriveBase", "brake", [([], "None")]),
10221022
pytest.param("pybricks.robotics", "DriveBase", "distance", [([], "int")]),
1023-
pytest.param("pybricks.robotics", "DriveBase", "angle", [([], "int")]),
1023+
pytest.param("pybricks.robotics", "DriveBase", "angle", [([], "float")]),
10241024
pytest.param(
10251025
"pybricks.robotics", "DriveBase", "state", [([], "Tuple[int, int, int, int]")]
10261026
),

src/pybricks/robotics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def distance(self) -> int:
101101
Driven distance since last reset.
102102
"""
103103

104-
def angle(self) -> int:
105-
"""angle() -> int: deg
104+
def angle(self) -> float:
105+
"""angle() -> float: deg
106106
107107
Gets the estimated rotation angle of the drive base.
108108

0 commit comments

Comments
 (0)