Running ruff check --select DOC201 --preview --isolated on
class Foo:
def __new__(cls, x: int) -> "Foo":
"""A very helpful docstring.
Args:
x: An integer.
"""
... # Do something with x.
return super().__new__(cls)
reports a docstring-missing-returns (DOC201) diagnostic.
The expected behaviour is that the return value of a __new__ method is not expected to be documented as it simply returns an instance of the class.
Related to #8085
Search terms: DOC201, docstring-missing-returns, __new__
Running
ruff check --select DOC201 --preview --isolatedonreports a docstring-missing-returns (DOC201) diagnostic.
The expected behaviour is that the return value of a
__new__method is not expected to be documented as it simply returns an instance of the class.Related to #8085
Search terms: DOC201, docstring-missing-returns,
__new__