Repository navigation
docs: drop Returns sections from functions that return nothing - #6146
VenishPaneliya wants to merge 1 commit into
Conversation
Three docstrings in `deepmd` document a `Returns` section for a function annotated `-> None` that has no return statement, so numpydoc renders a Returns block on an object that never produces one. - `DescrptDPA2.__init__` in both the PyTorch and the Paddle backend carries a copy of `forward`'s Returns block (descriptor, g2, h2, rot_mat, sw). `forward` already documents those outputs itself, and in more detail, so the constructor copy is redundant as well as wrong. - `Spin.build` documents `embedded_types`; it builds TensorFlow constants inside a variable scope and returns nothing. Docstrings only; no behaviour change.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
wanghan-iapcm
left a comment
There was a problem hiding this comment.
Docs-only cleanup: the PR deletes a numpydoc Returns section from three docstrings that belong to callables producing no value — DescrptDPA2.__init__ in the PyTorch and Paddle backends (both annotated -> None; the deleted text was a stale, wrongly ordered copy of forward's five-output list) and deepmd.tf.utils.spin.Spin.build (which only creates three tf.constant nodes under spin_attr<suffix> and never returned the documented embedded_types). I verified the premise against the bodies and return annotations at head: all three deletions are correct, forward's own Returns block in pt and pd is intact, and no code or behaviour changes.
One non-blocking note on the stated rationale: with the pinned sphinx-autoapi 3.8.0 defaults (autoapi_python_class_content="class", PythonMethod._should_skip excludes __init__, and doc/conf.py sets no override), the two edited __init__ docstrings are never rendered, while the rendered DescrptDPA2 class docstring in deepmd/dpmodel still carries the identical wrong Returns block. The cleanup is correct but does not change a rendered page; removing the dpmodel class-docstring copy as well would make the fix land where it is published. Not a reason to hold the PR.
Approving.
Three docstrings in
deepmddocument aReturnssection for a function that is annotated-> Noneand has no return statement, so numpydoc renders a Returns block on an object that never produces one.DescrptDPA2.__init__in both the PyTorch and the Paddle backend carries a copy offorward's Returns block (descriptor,g2,h2,rot_mat,sw).forwardalready documents those outputs itself, and in more detail, so the constructor copy is redundant as well as wrong.Spin.builddocumentsembedded_types; it builds TensorFlow constants inside a variable scope and returns nothing.AutoAPI renders all of
deepmd/, so all three show up in the API reference today.Docstrings only, no behaviour change. A small AST check over the three functions reports 3 failures before and 0 after, and
ruff check/ruff format --checkpass on the three files.Summary by CodeRabbit
Returnssections from documentation for the DPA2 descriptor in the PyTorch and TensorFlow interfaces, and from the spin-building documentation. These sections previously described descriptor outputs, intermediate tensors, and embedded types. No public APIs or runtime behavior changed.