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

Unify docstring detection #4095

Merged
merged 4 commits into from Dec 28, 2023
Merged

Unify docstring detection #4095

merged 4 commits into from Dec 28, 2023

Conversation

JelleZijlstra
Copy link
Collaborator

Fixes #4094.

We had two slightly different ways to detect docstrings. This preview feature unifies the two.

There are at least two concrete behavior changes:

  • Module docstrings are now correctly recognized and formatted.
  • We now remove blank lines before class docstrings that do not use triple quotes; we already did that before class docstrings that do use triple quotes.

@@ -63,6 +63,8 @@ def lines_with_leading_tabs_expanded(s: str) -> List[str]:
)
else:
lines.append(line)
if s.endswith("\n"):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary so that we don't remove the newline at the end of a module docstring.

@hauntsaninja hauntsaninja merged commit db9c592 into psf:main Dec 28, 2023
38 of 39 checks passed
@JelleZijlstra JelleZijlstra deleted the unifydocs branch January 1, 2024 23:44
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.

Docstring formatting does not apply to module docstrings
2 participants