Building the Sphinx docs (sphinx-build -b html docs/source ...) currently emits 22 warnings like:
src/bdsim/components.py:39: WARNING: Cannot handle as a local function: "bdsim.Block.__add__" (use @functools.wraps) [sphinx_autodoc_typehints.local_function]
src/bdsim/connect.py:19: WARNING: Cannot handle as a local function: "bdsim.Plug.__add__" (use @functools.wraps) [sphinx_autodoc_typehints.local_function]
— one for every operator dunder method on Block (block.py) and Plug (connect.py) that's wrapped by the local oodebug decorator (__add__, __radd__, __sub__, __rsub__, __mul__, __rmul__, __truediv__, __rtruediv__, __pow__, __neg__, __rshift__ — 11 methods × 2 classes = 22).
Root cause: oodebug is defined twice (connect.py:18, near-identically in components.py:38 — the latter's comment says it's "kept local to avoid an import cycle with components.py"), and neither wrapper uses functools.wraps:
def oodebug(func: _F) -> _F:
def wrapper(*args: Any, **kwargs: Any) -> Any:
ret = func(*args, **kwargs)
return ret
return wrapper # type: ignore[return-value]
Without functools.wraps(func) on wrapper, sphinx_autodoc_typehints (and anything else that introspects __wrapped__/__signature__, eg. inspect.signature) sees wrapper(*args, **kwargs) instead of the real operator signature — so these 22 methods render without proper type hints in the rendered API docs at https://petercorke.github.io/bdsim/.
Suggested fix: add @functools.wraps(func) to wrapper in both oodebug definitions. Low risk — oodebug is a no-op passthrough already (the debug print is commented out), so this only affects introspection, not runtime behavior.
Found while auditing the Sphinx docs build for warnings — not fixed here since it touches block/plug operator-overload source rather than documentation.
Building the Sphinx docs (
sphinx-build -b html docs/source ...) currently emits 22 warnings like:— one for every operator dunder method on
Block(block.py) andPlug(connect.py) that's wrapped by the localoodebugdecorator (__add__,__radd__,__sub__,__rsub__,__mul__,__rmul__,__truediv__,__rtruediv__,__pow__,__neg__,__rshift__— 11 methods × 2 classes = 22).Root cause:
oodebugis defined twice (connect.py:18, near-identically incomponents.py:38— the latter's comment says it's "kept local to avoid an import cycle with components.py"), and neither wrapper usesfunctools.wraps:Without
functools.wraps(func)onwrapper,sphinx_autodoc_typehints(and anything else that introspects__wrapped__/__signature__, eg.inspect.signature) seeswrapper(*args, **kwargs)instead of the real operator signature — so these 22 methods render without proper type hints in the rendered API docs at https://petercorke.github.io/bdsim/.Suggested fix: add
@functools.wraps(func)towrapperin bothoodebugdefinitions. Low risk —oodebugis a no-op passthrough already (the debug print is commented out), so this only affects introspection, not runtime behavior.Found while auditing the Sphinx docs build for warnings — not fixed here since it touches block/plug operator-overload source rather than documentation.