This repository was archived by the owner on Nov 5, 2023. It is now read-only.
This repository was archived by the owner on Nov 5, 2023. It is now read-only.
[BUG]: Type hints in .pyi
don't resolve all units #29
Closed
Description
Problem description
When type hints are generated, units are not properly resolved:
From robotpy-pathplannerlib:
class PathPlannerTrajectory():
class PathPlannerState():
def __init__(self) -> None: ...
def interpolate(self, endVal: PathPlannerTrajectory.PathPlannerState, t: float) -> PathPlannerTrajectory.PathPlannerState: ...
@property
def acceleration(self) -> meters_per_second_squared:
"""
:type: meters_per_second_squared
"""
@property
def angularAccel(self) -> units::unit_t<units::unit<std::__1::ratio<1l, 1l>, units::base_unit<std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<-2l, 1l>, std::__1::ratio<1l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l> >, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l> >, double, units::linear_scale>:
"""
:type: units::unit_t<units::unit<std::__1::ratio<1l, 1l>, units::base_unit<std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<-2l, 1l>, std::__1::ratio<1l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l> >, std::__1::ratio<0l, 1l>, std::__1::ratio<0l, 1l> >, double, units::linear_scale>
"""
@property
def angularVel(self) -> radians_per_second:
"""
:type: radians_per_second
"""
@property
def curveRadius(self) -> meters:
"""
:type: meters
"""
Some types are left in C++ syntax (units::unit_t<units::unit<std::__1::ratio<1l, 1l>...
) and others are simplified but not imported so they are not valid (meters
).
robotpy-photonvision has the same issue.
Operating System
MacOS
Installed Python Packages
No response
Reproducible example code
No response
Metadata
Metadata
Assignees
Labels
No labels