Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docstrings/numpy: Support "ignore __init__ summary" option #44

Closed
pawamoy opened this issue Feb 18, 2022 · 0 comments
Closed

docstrings/numpy: Support "ignore __init__ summary" option #44

pawamoy opened this issue Feb 18, 2022 · 0 comments
Labels
griffe: docstrings Related to docstring parsing griffe: numpy Related to Numpydoc-style docstrings

Comments

@pawamoy
Copy link
Member

pawamoy commented Feb 18, 2022

The mkdocstrings Python handler is able to merge __init__ methods docstrings into their classes' docstrings.
This is nice, but usually __init__ methods just have a summary like "Initialize this [CLASS]." which simply breaks the flow of the merged docstring, especially since it's usually followed by a Parameters section.

This option allows to ignore the summary (while keeping the correct line number in parsing warnings).

ignore_summary = (
ignore_init_summary # noqa: WPS222
and docstring.parent is not None
and docstring.parent.name == "__init__"
and docstring.parent.is_function
and docstring.parent.parent is not None
and docstring.parent.parent.is_class
)
if ignore_summary:
offset = 2
else:
offset = 0

@pawamoy pawamoy added help wanted griffe: docstrings Related to docstring parsing griffe: numpy Related to Numpydoc-style docstrings labels Feb 18, 2022
pawamoy added a commit that referenced this issue Apr 3, 2022
@pawamoy pawamoy closed this as completed Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
griffe: docstrings Related to docstring parsing griffe: numpy Related to Numpydoc-style docstrings
Projects
None yet
Development

No branches or pull requests

1 participant