Repository navigation
Drop docstring parameters that are not in the signature - #20205
Conversation
Eight Parameters entries name something the function does not take: `self` under an old free-function name, locals produced inside the body, a tag copied from a parent class, and one plural typo. Docstrings only.
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
If you mean this, might as well fix it here also. It is hidden function, so the doc is not rendered but no harm fixing. Thanks. astropy/astropy/modeling/separable.py Line 296 in 1d2de44 |
|
Yes, that's the one. Fixed in the latest commit — the heading is now |
|
Thank you for being forthcoming in your AI usage. As for the remaining issues you are unsure how to fix, please open an issue per problem, especially if they are in different subpackages, if you so desire. |
|
Opened three, one per problem:
The two |
|
Thanks! |
…nature (#20209) Co-authored-by: Dmitry <[email protected]>
…205-on-v8.0.x Backport PR #20205 on branch v8.0.x (Drop docstring parameters that are not in the signature)
…-in-signature Drop docstring parameters that are not in the signature
AI assistance
Per the astropy AI policy: the mismatches were surfaced by a sweep comparing
numpydoc parameter names against the actual signatures, run with Claude in
Claude Code, which also wrote the patch. I read every finding against its
signature and body before changing it, checked the neighbouring blocks that the
sweep also flagged and left the correct ones alone, and the four I could not
call unambiguous are listed above rather than edited.
Description
Eight
Parametersentries across four subpackages document a name the function does not accept. Each was read against its signature and body before changing.astropy/wcs/wcs.py:3421WCS.dropaxiswcsself; the only parameter isdropaxastropy/wcs/wcs.py:3446WCS.swapaxeswcsself; the parameters areax0,ax1astropy/modeling/bounding_box.py:497_BoundingDomain._evaluatevalid_inputs,valid_indexself.prepare_inputs(...)on the first line of the body; the real parameterinputswas undocumentedastropy/modeling/bounding_box.py:557_BoundingDomain.evaluatevalid_inputs,valid_indexinputsagain undocumentedastropy/io/fits/diff.py:723HeaderDiff.__init__numdiffsFITSDiff.__init__does take it and documents it correctlyastropy/modeling/_fitting_parallel.py:385parallel_fit_daskdata_unitsdata_unit, as is the name the@support_nddatadecorator maps to and the name used throughout the bodyThe two in
bounding_box.pyhave a visible cause:_evaluate_modeldirectly above really does takevalid_inputsandvalid_index, and its docstring is correct. The block was copied down to two functions whose signature takesinputsinstead. I replaced those two entries withinputsrather than only deleting them, so the sections now match their signatures.wcsin the twoWCSmethods reads as a leftover from a free-function form,dropaxis(wcs, dropax).Docstrings only — no signature, call site, or behaviour is touched.
Left alone deliberately
The same sweep raised four more that I did not change, because they are not defects or not mine to decide:
astropy/modeling/fitting.py:522and:1341,__call__documentingequivalencies. The@fitter_unit_supportdecorator doeskwargs.pop("equivalencies", None), so the parameter is genuinely accepted and the docstring is right.astropy/cosmology/_src/flrw/base.py:944,angular_diameter_distanceheading its sectionz1, z2while the signature readsz, z2. The prose underneath explains that convention on purpose, so changing the heading may lose meaning.astropy/modeling/separable.py:287,_separable— the section heading is writtenReturns :instead ofReturnswith an underline, sois_separableis parsed as a parameter. That is a real rendering bug, but a different change from this one; happy to send it separately.Changelog
Not added: this changes docstrings only. Per
development_details.rstthe fragment needs the PR number, so if you would like one I will adddocs/changes/<subpackage>/<this PR>.other.rston request — or theno-changelog-entry-neededlabel, whichever you prefer.