-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
Hi 👋
The following throws a
164: DOC405: Function `yields` has both "return" and "yield" statements. Please use Generator[YieldType, SendType, ReturnType] as the return type annotation, and put your yield type in YieldType and return type in ReturnType. More details in https://jsh9.github.io/pydoclint/notes_generator_vs_iterator.html
false positive. Interestingly, when I remove the Args
section from the docstring, the false positive is no longer thrown.
from contextlib import contextmanager
@contextmanager
def yields(db: Optional[int]) -> Iterator[int]:
"""Test a function.
Args:
db: the database
Yields:
Some stuff.
"""
if db is not None:
yield db
return
db = ...
yield db
Metadata
Metadata
Assignees
Labels
No labels