Fix docstrings that name parameters the functions do not have - #3485
Open
VenishPaneliya wants to merge 1 commit into
Open
VenishPaneliya wants to merge 1 commit into
VenishPaneliya wants to merge 1 commit into
Conversation
Nine Sphinx field entries name an argument that is not in the signature, so Sphinx renders a parameter that does not exist while the real one is undocumented: - `pyro.ops.jit.trace`: `ignore_warnins` is a typo for `ignore_warnings`. - `get_provenance` / `detach_provenance`: both document `tensor` for a parameter named `x`. `extract_provenance` directly above them, with the same signature, already documents `x` correctly, so its wording is reused for `get_provenance`, whose summary describes a data structure rather than a tensor. - `initialize_model`: documents `ignore_jit_warnings`; the argument is `skip_jit_warnings`. `pyro.util.ignore_jit_warnings` is a separate context manager, which is probably where the name came from. - `Reparam.apply`: documents `name`; the argument is `msg`, and the entry already describes a message rather than a name. - `CoalescentRateLikelihood.__call__`: documents `time`; the argument is `t`, which the `:type t:` line below already refers to. - `contrib.funsor` `queue`: documents `q`; the argument is `queue`. - `CompartmentalModel.compute_flows`: documents `state`, which is copied verbatim from `transition` above it, where `state` is a real argument and is updated in place. `compute_flows` instead takes `prev` and `curr` and returns a new dict, so the entry is replaced by one for each and the in-place note is dropped. - `CompartmentalModel.generate`: `:pram` is a typo for `:param`, the only one in the package. Docstrings only, no behaviour change.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nine Sphinx field entries name an argument the function does not take. Sphinx renders each as a parameter that does not exist, while the real argument gets no entry at all.
ops/jit.pytraceignore_warninsignore_warningsops/provenance.pyget_provenancetensorxops/provenance.pydetach_provenancetensorxinfer/mcmc/util.pyinitialize_modelignore_jit_warningsskip_jit_warningsinfer/reparam/reparam.pyReparam.applynamemsgdistributions/coalescent.py__call__timetcontrib/funsor/.../enum_messenger.pyqueueqqueuecontrib/epidemiology/compartmental.pycompute_flowsstateprev,currcontrib/epidemiology/compartmental.pygenerate:pram:paramSeveral of these are self-evident from their surroundings:
ignore_warninsis simply missing a letter.:pram dict fixed:is the only:pramin the package — every other field inpyro/is a correct:param.get_provenance/detach_provenancesit directly belowextract_provenance, which has the same(x)signature and already documents:param x:correctly. I reused its exact wording forget_provenance, since that function's own summary says it reads "a recursive datastructure possibly containingtorch.Tensors" rather than a tensor;detach_provenancekeeps thetorch.Tensortype, matching itsx: _Tensorannotation.Reparam.applydocumentsname, but the entry itself describes "A simplified Pyro message with fields…", i.e.msg.CoalescentRateLikelihood.__call__documentstimewhile the:type t: int or sliceline just below already refers tot.initialize_modeldocumentsignore_jit_warnings;pyro.util.ignore_jit_warningsis a separate context manager, which is likely where the name came from.compute_flows— the one that needed more than a renamecompute_flows(self, prev, curr, t)carried this entry:That text is copied verbatim from
transition(self, params, state, t)earlier in the same file, wherestateis a real argument and is updated in place.compute_flowstakes two dicts and returns a new one — neitherprevnorcurris mutated, in the base implementation or in either override inmodels.py. So the entry is replaced with one per argument and the in-place note dropped.transition's own entry is left untouched.Deliberately not touched
contrib/mue/models.pyandcontrib/mue/missingdatahmm.pyhave the same class of mismatch, but nothing in the package importscontrib.mue.models, so I left that area alone rather than patching docs there speculatively.distribution.sample,importance.py, andops/einsumlook like hits to a naive scan, but they document genuine**kwargskeys (e.g.cache_pathis read viakwargs.pop("cache_path", True)), which is correct as written.Docstrings only, no behaviour change.
ruff checkandruff format --checkpass on all seven files, and every name above was confirmed againstinspect.signatureon the built package.