Skip to content

Add a note on variable annotation within unchecked function - #13851

Merged
ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:annot-note
Oct 9, 2022
Merged

Add a note on variable annotation within unchecked function#13851
ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:annot-note

Conversation

@ilevkivskyi

Copy link
Copy Markdown
Member

Closes#3948

This however gives a note instead of an error, so that type checking result will be success. I also added an error code for the note so that people can opt-out if they want to.

@github-actions

Copy link
Copy Markdown
Contributor

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

aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/contrib/media.py:308: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/aiortc/contrib/media.py:309: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/aiortc/contrib/media.py:312: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/aiortc/contrib/media.py:315: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/aiortc/contrib/media.py:316: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
kornia (https://github.com/kornia/kornia)
+ kornia/feature/defmo.py:221: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/utils/helpers.py:37: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/geometry/linalg.py:100: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/geometry/linalg.py:101: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/geometry/linalg.py:104: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/geometry/linalg.py:105: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/geometry/linalg.py:108: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:145: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:148: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:150: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:151: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:153: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:154: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:156: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:158: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:159: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:160: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:161: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:163: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:295: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:297: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:298: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:299: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:300: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:301: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:303: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:304: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:305: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:306: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ kornia/feature/siftdesc.py:308: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
pyinstrument (https://github.com/joerick/pyinstrument)
+ pyinstrument/frame.py:368: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
operator (https://github.com/canonical/operator)
+ ops/framework.py:995: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ ops/framework.py:1126: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ ops/framework.py:1127: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ ops/testing.py:2257: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/middleware.py:26: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ scrapy/core/scraper.py:79: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
discord.py (https://github.com/Rapptz/discord.py)
+ discord/opus.py:384: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/member.py:174: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/member.py:176: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/member.py:177: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/member.py:178: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/webhook/sync.py:110: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/webhook/async_.py:122: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/ui/item.py:62: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/ui/item.py:63: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/ui/item.py:64: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ discord/ui/item.py:71: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/task_runners.py:233: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/prefect/task_runners.py:234: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/prefect/task_runners.py:235: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/prefect/task_runners.py:236: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ src/prefect/cli/root.py:101: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
Expression (https://github.com/cognitedata/Expression)
+ expression/system/cancellation.py:59: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_disposable.py:9: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_disposable.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_disposable.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_disposable.py:42: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_disposable.py:57: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_disposable.py:75: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_cancellation.py:66: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_cancellation.py:77: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_cancellation.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_union.py:127: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_typing.py:90: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_typing.py:101: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_try.py:17: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_try.py:25: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_try.py:34: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_seq.py:115: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_seq.py:291: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_parser.py:25: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_parser.py:39: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_parser.py:53: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_parser.py:54: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option_effect.py:11: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:107: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:121: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:140: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:141: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:151: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:152: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:225: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:348: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:362: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:404: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:415: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:431: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:462: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:463: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:474: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_option.py:475: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_map.py:11: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_map.py:18: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_map.py:108: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_mailbox.py:53: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_mailbox.py:56: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_choice.py:5: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_choice.py:18: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_block.py:22: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:45: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:55: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:65: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:75: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:85: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:95: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_array.py:130: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:16: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:42: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:58: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:75: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:249: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:283: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:297: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:332: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:333: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:344: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:345: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ tests/test_result.py:346: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
jax (https://github.com/google/jax)
+ jax/_src/lax/slicing.py:1545: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/core.py:2602: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/core.py:2618: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/core.py:2619: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/pxla.py:1934: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/pxla.py:3403: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/partial_eval.py:459: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/partial_eval.py:1572: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/partial_eval.py:1573: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/partial_eval.py:1613: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/partial_eval.py:1614: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/interpreters/partial_eval.py:1615: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/_src/lax/control_flow/conditionals.py:465: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/_src/lax/control_flow/conditionals.py:474: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/_src/lax/control_flow/conditionals.py:475: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/_src/lax/control_flow/conditionals.py:476: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/_src/api.py:2226: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/experimental/jax2tf/jax2tf.py:175: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/experimental/jax2tf/jax2tf.py:1118: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/experimental/jax2tf/tests/jax_primitives_coverage_test.py:91: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/experimental/jax2tf/tests/jax_primitives_coverage_test.py:97: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/experimental/jax2tf/tests/shape_poly_test.py:1975: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ jax/experimental/jax2tf/tests/primitives_test.py:183: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
sublime_debugger (https://github.com/daveleroy/sublime_debugger)
+ modules/settings.py:199: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/ui/input.py:112: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/util.py:15: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/util.py:16: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/watch.py:30: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/watch.py:31: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/watch.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/breakpoint.py:13: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/breakpoint.py:14: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/source_breakpoints.py:136: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/source_breakpoints.py:162: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/source_breakpoints.py:163: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/source_breakpoints.py:164: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/source_breakpoints.py:173: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/function_breakpoints.py:58: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/function_breakpoints.py:59: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/function_breakpoints.py:60: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/data_breakpoints.py:51: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/data_breakpoints.py:52: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/breakpoints/data_breakpoints.py:53: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/dap/session.py:773: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/project.py:189: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/project.py:195: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/project.py:196: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/project.py:197: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/project.py:229: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/input_list_view.py:12: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/variable.py:17: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/variable.py:18: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/sources.py:36: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/modules.py:52: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/modules.py:71: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/debugger_output_panel.py:29: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/terminal_task.py:139: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/terminal_task.py:141: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/terminal_task.py:166: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/terminal_task.py:169: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/callstack.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/debugger_console_panel.py:256: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/debugger.py:780: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/debugger.py:781: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/debugger.py:849: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/debugger.py:850: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ modules/views/diagnostics.py:87: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
spack (https://github.com/spack/spack)
+ lib/spack/llnl/util/lock.py:83: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ lib/spack/llnl/util/lang.py:1048: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ lib/spack/spack/bootstrap.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
sympy (https://github.com/sympy/sympy)
+ sympy/utilities/lambdify.py:779: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/utilities/lambdify.py:852: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/utilities/lambdify.py:884: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/printing/codeprinter.py:160: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/printing/latex.py:1707: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/tensor.py:2248: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/tensor.py:2256: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/tensor.py:2550: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/tensor.py:2551: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:782: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:1157: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:1158: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:1705: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:1710: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:1850: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/array_expressions.py:1851: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/from_array_to_matrix.py:84: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/from_array_to_matrix.py:811: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/array/expressions/from_array_to_indexed.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/toperators.py:245: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/tensor/toperators.py:246: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs+ sympy/stats/tests/test_symbolic_multivariate.py:91: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
... (truncated 368 lines) ...

@ilevkivskyi

Copy link
Copy Markdown
MemberAuthor

The fallout is quite big, but it is expected (also this will not break CI). I went through some of the notes, they all look correct.

@AlexWaygoodAlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great. I think it's going to help a lot of people. Haven't checked through mypy_primer, but I trust you've done a thorough review :)

@ilevkivskyi
ilevkivskyi merged commit fe1e571 into python:masterOct 9, 2022
@ilevkivskyi
ilevkivskyi deleted the annot-note branch October 9, 2022 23:48
@cdce8p

cdce8p commented Oct 11, 2022

Copy link
Copy Markdown
Collaborator

The fallout is quite big, but it is expected (also this will not break CI).

Just so you're aware, this will break CI. With just a note, mypy will exit with code 1.
Of course disabling the error does work: disable_error_code = annotation-unchecked.

mypy/mypy/main.py

Lines 112 to 114 in 1eaf4c7

code=0
ifmessages:
code=2ifblockerselse1

deffunc():
var: list[str] = []
$ mypy test.py
test.py:2: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
Success: no issues found in 1 source file
$ echo$?
1

@ilevkivskyi

Copy link
Copy Markdown
MemberAuthor

Hm, I think we may need to change this. Returning 1 after showing Success message is especially weird.

@ilevkivskyi

Copy link
Copy Markdown
MemberAuthor

@cdce8p FYI #13879

JukkaL pushed a commit that referenced this pull request Oct 13, 2022
This will hint people affected by #13851 what to do to silence this. I
am not doing it for all notes as this will cause too much noise
(especially for some nicely formatted multi-line notes like possible
overloads, incompatible overrides, or protocol mismatches), instead we
can select specific codes that we want to show.
ilevkivskyi added a commit that referenced this pull request Oct 14, 2022
Fixes#10013
See #13851 (comment)
for motivation, also this sounds generally reasonable.
Sign up for freeto 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.

Give an error if there is a variable annotation within a function but no signature

4 participants

@ilevkivskyi@cdce8p@JelleZijlstra@AlexWaygood