Skip to content

Fix docstrings that name parameters the operator methods do not have - #1125

Open
VenishPaneliya wants to merge 1 commit into
has2k1:mainfrom
VenishPaneliya:operator-docstring-params
Open

VenishPaneliya wants to merge 1 commit into
has2k1:mainfrom
VenishPaneliya:operator-docstring-params

Conversation

@VenishPaneliya

Copy link
Copy Markdown

Four of the + operator methods document a parameter name their signature doesn't use, so following the docs and passing that keyword raises TypeError.

file method signature documented
ggplot.py ggplot.__add__ rhs other
geoms/geom.py geom.__radd__ other plot
guides/guides.py guides.__radd__ other plot
stats/stat.py stat.__radd__ other gg

other is the established name here. Of the 24 __radd__ methods in the package, the two that document their parameter at all — ggplot.__radd__ and composition/_types.py — both use other; the remaining 19 have no Parameters section.

ggplot.py makes the case on its own: its __radd__ documents other correctly, while a few lines away __add__ also says other for a parameter that is actually called rhs.

I left stat.__radd__'s out : entry alone — that's the name under Returns, which is valid numpydoc, not a mistake.

Docs only, no behaviour change. ruff check and ruff format --check are clean on all four files.

Four of plotnine's `+` operator methods document a parameter name their
signature does not use, so following the docs and passing that keyword
raises TypeError:

  ggplot.__add__(rhs)      documented as `other`
  geom.__radd__(other)     documented as `plot`
  guides.__radd__(other)   documented as `plot`
  stat.__radd__(other)     documented as `gg`

`other` is the established name: of the 24 `__radd__` methods, the two
that document their parameter at all use `other` (ggplot and
composition/_types). ggplot.py is the clearest case - its `__radd__`
documents `other` correctly while its `__add__` documents `other` for a
parameter actually called `rhs`.

Docs only, no behaviour change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant