docstring-extraneous-yields (DOC403)
Derived from the pydoclint linter.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does
Checks for function docstrings that have a "yields" section without needing one.
Why is this bad?
Functions which don't yield anything should not have a yields section in their docstrings.
This rule is not enforced for stub functions.
Example
def say_hello(n: int) -> None:
"""Says hello to the user.
Args:
n: Number of times to say hello.
Yields:
Doesn't yield anything.
"""
for _ in range(n):
print("Hello!")
Use instead: