From 4531d93b80911e2283944fa1bbbd6d569486572c Mon Sep 17 00:00:00 2001 From: Peter Corke Date: Mon, 20 Jul 2026 17:09:45 +1000 Subject: [PATCH] docs(fix): resolve stale jointset references and joints() forward-ref warning `jointset()` was renamed to `jindex_set()` back in 2022 (f3bc1392) - the tests were updated then, but arm_ets.rst's :members: list and two docstring examples inside _ETS.py (BaseETS.jindex_set/.jindices) were never updated, still calling a method that hasn't existed for three years. Also fixed BaseETS.joints()'s return type: `-> list[ET]` referenced the concrete 3D `ET` class, which _ETS.py never imports (it only imports the shared `BaseET` - correct, since this method lives on the base class shared by both ETS and ETS2). Under `from __future__ import annotations` this doesn't error at runtime, but sphinx_autodoc_typehints tries to resolve it for docs and fails, producing "name 'ET' is not defined" for both ETS.ETS.joints and ETS2.ETS2.joints (same inherited method). Corrected to `list[BaseET]`, matching the class's own actual type surface. `data()`/`__getitem__`'s @overload stubs also reference bare `ET`, but didn't warn (their `self: "ETS"` pins the concrete type in a way Sphinx apparently doesn't try to resolve the same way) - left alone rather than touching real overload signatures without a demonstrated warning to fix. Verified: full suite green (620 passed, 72 skipped); Sphinx build warnings down from 8 to 4 (KinematicCache, SensorBase, and a guarded matplotlib Color import remain - unrelated, left for another pass). Co-Authored-By: Claude Sonnet 5 --- docs/source/arm_ets.rst | 4 ++-- src/roboticstoolbox/ets/_ETS.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/arm_ets.rst b/docs/source/arm_ets.rst index 49a5b33e..f0fbc5a9 100644 --- a/docs/source/arm_ets.rst +++ b/docs/source/arm_ets.rst @@ -70,7 +70,7 @@ ETS - 3D -------- .. autoclass:: roboticstoolbox.ets.ETS.ETS - :members: __str__, __repr__, __mul__, __getitem__, n, m, structure, joints, jointset, split, inv, compile, insert, fkine, jacob0, jacobe, hessian0, hessiane + :members: __str__, __repr__, __mul__, __getitem__, n, m, structure, joints, jindex_set, split, inv, compile, insert, fkine, jacob0, jacobe, hessian0, hessiane :undoc-members: :show-inheritance: :member-order: bysource @@ -79,7 +79,7 @@ ETS - 2D -------- .. autoclass:: roboticstoolbox.ets.ETS2.ETS2 - :members: __str__, __repr__, __mul__, __getitem__, n, m, structure, joints, jointset, split, inv, compile, insert, fkine, jacob0, jacobe + :members: __str__, __repr__, __mul__, __getitem__, n, m, structure, joints, jindex_set, split, inv, compile, insert, fkine, jacob0, jacobe :undoc-members: :show-inheritance: diff --git a/src/roboticstoolbox/ets/_ETS.py b/src/roboticstoolbox/ets/_ETS.py index a6699f91..6e3acc3b 100644 --- a/src/roboticstoolbox/ets/_ETS.py +++ b/src/roboticstoolbox/ets/_ETS.py @@ -281,12 +281,12 @@ def joint_idx(self) -> list[int]: return np.where([e.isjoint for e in self])[0] # type: ignore - def joints(self) -> list[ET]: + def joints(self) -> list[BaseET]: """ Get a list of the variable ETs with this ETS :returns: list of ETs that are joints - :rtype: list[ET] + :rtype: list[BaseET] Examples -------- @@ -372,7 +372,7 @@ def jindex_set(self) -> set[int]: # >>> from roboticstoolbox import ET >>> e = ET.Rz(jindex=1) * ET.tx(jindex=2) * ET.Rz(jindex=1) * ET.tx(1) - >>> e.jointset() + >>> e.jindex_set() """ @@ -393,7 +393,7 @@ def jindices(self) -> NDArray: >>> from roboticstoolbox import ET >>> e = ET.Rz(jindex=1) * ET.tx(jindex=2) * ET.Rz(jindex=1) * ET.tx(1) - >>> e.jointset() + >>> e.jindices """