Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Always allow returning Any from lambda#15413

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hauntsaninja merged 2 commits intopython:masterfromilevkivskyi:fix-ret-lambda
Jun 11, 2023

Conversation

@ilevkivskyi
Copy link
Member

Fixes#9656

Although it is not clear this is actually a bug, it is kind of inconsistent to say "Returning Any from function declared to return ..." for lambdas, that never have annotations, their types are always inferred, not declared. Also it is a surprisingly popular issue that is a one line fix, so I think we should do it.

@ilevkivskyiilevkivskyi changed the titleAllways allow returning Any form lambdaAllways allow returning Any from lambdaJun 11, 2023
Copy link
Member

@AlexWaygoodAlexWaygood left a comment

Choose a reason for hiding this comment

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

Makes sense!

@github-actions

This comment has been minimized.

@ikonst
Copy link
Contributor

Always* 😄

@ilevkivskyiilevkivskyi changed the titleAllways allow returning Any from lambdaAlways allow returning Any from lambdaJun 11, 2023
Copy link
Collaborator

@hauntsaninjahauntsaninja left a comment

Choose a reason for hiding this comment

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

Looks good!--warn-return-any isn't fully sound as it is, I think this is a reasonable place to relax and primer gets rid of a number of ignored errors

AlexWaygood reacted with thumbs up emoji
@github-actions
Copy link
Contributor

Diff frommypy_primer, showing the effect of this PR on open source code:

poetry (https://github.com/python-poetry/poetry)+ src/poetry/json/__init__.py:27: error: Unused "type: ignore" comment  [unused-ignore]- src/poetry/packages/locker.py:366: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]+ src/poetry/packages/locker.py:435: error: Unused "type: ignore" comment  [unused-ignore]- src/poetry/puzzle/provider.py:129: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/repositories/test_pypi_repository.py:277: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/repositories/test_pypi_repository.py:305: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/repositories/test_legacy_repository.py:189: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/repositories/test_legacy_repository.py:202: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/repositories/test_legacy_repository.py:375: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- src/poetry/console/commands/show.py:435: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- src/poetry/console/commands/show.py:484: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:418: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:421: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:449: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:452: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:479: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:482: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:510: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:513: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:540: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:543: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:571: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]- tests/puzzle/test_provider.py:574: error: Returning Any from function declared to return "SupportsDunderLT[Any] | SupportsDunderGT[Any]"  [no-any-return]werkzeug (https://github.com/pallets/werkzeug)+ src/werkzeug/testapp.py:136: error: Unused "type: ignore" comment  [unused-ignore]pylint (https://github.com/pycqa/pylint)+ pylint/pyreverse/diagrams.py:152: error: Unused "type: ignore" comment  [unused-ignore]+ pylint/pyreverse/writer.py:82: error: Unused "type: ignore" comment  [unused-ignore]+ pylint/checkers/similar.py:608: error: Unused "type: ignore" comment  [unused-ignore]+ pylint/checkers/variables.py:300: error: Unused "type: ignore" comment  [unused-ignore]+ pylint/checkers/base/name_checker/checker.py:348: error: Unused "type: ignore" comment  [unused-ignore]Auto-Split (https://github.com/Avasam/Auto-Split)- src/AutoSplit.py:107: error: Returning Any from function declared to return "None"  [no-any-return]- src/AutoSplit.py:195: error: Returning Any from function declared to return "None"  [no-any-return]- src/AutoSplit.py:198: error: Returning Any from function declared to return "None"  [no-any-return]isort (https://github.com/pycqa/isort)+ isort/settings.py:863: error: Unused "type: ignore" comment  [unused-ignore]+ isort/literal.py:89: error: Unused "type: ignore" comment  [unused-ignore]aiohttp (https://github.com/aio-libs/aiohttp)+ aiohttp/streams.py:70: error: Unused "type: ignore[no-any-return]" comment  [unused-ignore]bandersnatch (https://github.com/pypa/bandersnatch)+ src/bandersnatch/simple.py:186: error: Unused "type: ignore" comment  [unused-ignore]+ src/bandersnatch/simple.py:222: error: Unused "type: ignore" comment  [unused-ignore]streamlit (https://github.com/streamlit/streamlit) got 1.10x faster (69.0s -> 62.6s)+ lib/streamlit/runtime/legacy_caching/hashing.py:554: error: Unused "type: ignore" comment  [unused-ignore]- lib/tests/streamlit/watcher/local_sources_watcher_test.py: note: In function "sort_args_list":- lib/tests/streamlit/watcher/local_sources_watcher_test.py:372:47: error: Returning Any from function declared to return "Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]"  [no-any-return]- lib/tests/streamlit/elements/element_utils_test.py:52:46: error: Returning Any from function declared to return "None"  [no-any-return]- lib/tests/streamlit/elements/element_utils_test.py:63:50: error: Returning Any from function declared to return "None"  [no-any-return]- lib/tests/streamlit/form_test.py: note: In member "test_exception_for_callbacks_on_widgets" of class "FormStateInteractionTest":- lib/tests/streamlit/form_test.py:341:75: error: Returning Any from function declared to return "None"  [no-any-return]- lib/tests/streamlit/form_test.py: note: In member "test_no_exception_for_callbacks_on_submit_button" of class "FormStateInteractionTest":- lib/tests/streamlit/form_test.py:347:54: error: Returning Any from function declared to return "None"  [no-any-return]

@hauntsaninjahauntsaninja merged commit9e7bc38 intopython:masterJun 11, 2023
@ilevkivskyiilevkivskyi deleted the fix-ret-lambda branchJune 11, 2023 20:45
@cdce8pcdce8p mentioned this pull requestJun 12, 2023
jhance pushed a commit that referenced this pull requestJun 14, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hauntsaninjahauntsaninjahauntsaninja approved these changes

@JelleZijlstraJelleZijlstraAwaiting requested review from JelleZijlstra

@JukkaLJukkaLAwaiting requested review from JukkaL

+1 more reviewer

@AlexWaygoodAlexWaygoodAlexWaygood approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Warn Return Any now applies to small lambdas

4 participants

@ilevkivskyi@ikonst@hauntsaninja@AlexWaygood

[8]ページ先頭

©2009-2025 Movatter.jp