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

Include AssertionError in Raises section #215

Merged
merged 13 commits into from
Feb 16, 2025

Conversation

pechersky
Copy link
Contributor

Should the language of DOC5* be modified to include assert? Should it be a new DOC rule?

Closes #213.

Should the language of DOC5* be modified to include assert?
Should it be a new DOC rule?

Closes jsh9#213.
@@ -114,8 +114,8 @@ def getRaisedExceptions(node: FuncOrAsyncFuncDef) -> list[str]:

def _getRaisedExceptions(
node: FuncOrAsyncFuncDef,
) -> Generator[str, None, None]:
"""Yield the raised exceptions in a function node"""
) -> Iterator[str, None, None]:
Copy link
Owner

Choose a reason for hiding this comment

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

Hi @pechersky , using Generator[str, None, None] is preferred here. You can read more here: https://jsh9.github.io/pydoclint/notes_generator_vs_iterator.html

@@ -189,7 +192,7 @@ def _getRaisedExceptions(

def _extractExceptionsFromExcept(
node: ast.ExceptHandler,
) -> Generator[str, None, None]:
) -> Iterator[str]:
Copy link
Owner

Choose a reason for hiding this comment

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

Iterator[str] is sort of a shorthand for Generator[str, None, None]. (And in Python 3.14, Generator[str] is finally recognized as a shorthand for Generator[str, None, None].)

But to be consistent with existing functions in this file, I'll revert back to using Generator[str, None, None].

@jsh9 jsh9 merged commit 4a16088 into jsh9:main Feb 16, 2025
16 checks passed
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.

DOC502 Raises section in response to assert
2 participants