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

gh-104050: Argument clinic: enable mypy's --warn-return-any setting #107405

Merged
merged 4 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4288,7 +4288,7 @@ def eval_ast_expr(
globals: dict[str, Any],
*,
filename: str = '-'
) -> FunctionType:
) -> Any:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a comment as to why Any is the correct annotation here?

Copy link
Member Author

Choose a reason for hiding this comment

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

You weren't going to make finally closing that issue easy, were you? ;)

Let me know if a5103be is too verbose...!

Copy link
Member Author

@AlexWaygood AlexWaygood Jul 28, 2023

Choose a reason for hiding this comment

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

Hmm, actually, now that I look at it again, the comment feels like it duplicates the docstring a little bit... not sure if it's worth it? I'll defer to you on whether it's helpful or not!

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, you're right. The docstring should be enough!

Copy link
Member Author

@AlexWaygood AlexWaygood Jul 29, 2023

Choose a reason for hiding this comment

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

Okay -- removed the comment again and tweaked the docstring slightly! How's it look now?

"""
Takes an ast.Expr node. Compiles and evaluates it.
Returns the result of the expression.
Expand Down
5 changes: 1 addition & 4 deletions Tools/clinic/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ pretty = True
# make sure clinic can still be run on Python 3.10
python_version = 3.10

# be strict...
# and be strict!
strict = True
strict_concatenate = True
enable_error_code = ignore-without-code,redundant-expr
warn_unreachable = True

# ...except for one extra rule we can't enable just yet
warn_return_any = False
Loading