-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat: warn about annotations in unannotated functions #10748
feat: warn about annotations in unannotated functions #10748
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: dedupe (https://github.com/dedupeio/dedupe.git)
+ dedupe/labeler.py:97: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ dedupe/labeler.py:203: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
jax (https://github.com/google/jax.git)
+ jax/interpreters/pxla.py:1194: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ jax/_src/api.py:422: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
- jax/experimental/maps.py:204: error: Invalid self argument "ResourceEnv" to attribute function "with_extra_loop" with type "Callable[[ResourceEnv, _Loop], Any]" [misc]
- jax/experimental/maps.py:237: error: Invalid self argument "ResourceEnv" to attribute function "with_mesh" with type "Callable[[ResourceEnv, Mesh], Any]" [misc]
+ jax/_src/api.py:1781: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ jax/experimental/maps.py:204: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
- jax/_src/numpy/lax_numpy.py:1840: error: Argument 1 to "_wraps" has incompatible type "Optional[Any]"; expected "Callable[..., Any]" [arg-type]
- jax/experimental/host_callback.py:1705: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
scrapy (https://github.com/scrapy/scrapy.git)
+ scrapy/middleware.py:24: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ scrapy/core/scraper.py:72: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
freqtrade (https://github.com/freqtrade/freqtrade.git)
+ freqtrade/edge/edge_positioning.py:390: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ freqtrade/edge/edge_positioning.py:410: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ freqtrade/freqtradebot.py:271: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ freqtrade/freqtradebot.py:282: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
sockeye (https://github.com/awslabs/sockeye.git)
+ sockeye/encoder.py:158: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sockeye/encoder.py:159: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sockeye/encoder.py:160: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
manticore (https://github.com/trailofbits/manticore.git)
+ manticore/core/smtlib/solver.py:1032: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/core/smtlib/solver.py:1033: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/core/smtlib/solver.py:1034: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/core/smtlib/solver.py:1035: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/core/smtlib/solver.py:1036: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/core/smtlib/solver.py:1038: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1064: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1071: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1084: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1097: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1110: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1123: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1128: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1139: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1152: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1165: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1178: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1191: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1199: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1437: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1442: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1447: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1452: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1457: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1467: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1474: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1481: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1488: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1495: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1502: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/executor.py:1510: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:292: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:293: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:294: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:295: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:296: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:297: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:298: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:299: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:302: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:303: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:304: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/wasm/structure.py:305: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/evm.py:2431: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/evm.py:2434: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/evm.py:2435: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/evm.py:2437: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/ethereum/manticore.py:419: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/ethereum/manticore.py:423: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/ethereum/manticore.py:424: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ tests/ethereum/test_general.py:1332: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ tests/ethereum/test_general.py:1366: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ tests/ethereum/test_general.py:1503: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ tests/ethereum/test_general.py:1562: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ tests/ethereum/test_general.py:2003: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ tests/ethereum/test_general.py:2062: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/utils/emulate.py:95: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/native/state.py:26: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/native/state.py:27: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/native/state.py:28: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/native/state.py:29: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/linux.py:220: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/linux.py:2723: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/linux.py:2724: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/platforms/linux.py:2928: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ manticore/native/manticore.py:47: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/contrib/media.py:239: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ src/aiortc/contrib/media.py:240: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ src/aiortc/contrib/media.py:243: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ src/aiortc/contrib/media.py:245: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ src/aiortc/contrib/media.py:246: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/tests/test_register_accessor.py:15: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
paasta (https://github.com/yelp/paasta.git)
+ paasta_tools/cli/cli.py:180: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ paasta_tools/frameworks/task_store.py:127: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ paasta_tools/cli/utils.py:360: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ paasta_tools/cli/utils.py:520: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ paasta_tools/api/views/instance.py:641: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ paasta_tools/api/views/instance.py:899: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
sympy (https://github.com/sympy/sympy.git)
+ sympy/printing/codeprinter.py:108: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/array_expressions.py:944: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/array_expressions.py:945: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/array_expressions.py:1294: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/array_expressions.py:1361: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/array_expressions.py:1366: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/array_expressions.py:1434: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/tensor.py:2181: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/tensor.py:2189: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/tensor.py:2475: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/tensor.py:2476: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/array/expressions/conv_array_to_matrix.py:72: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/toperators.py:182: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/tensor/toperators.py:183: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
+ sympy/stats/tests/test_symbolic_multivariate.py:87: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
arviz (https://github.com/arviz-devs/arviz.git)
- version: 0.920+dev.7576f659d42ee271c78e69d7481b9d49517a49f6
+ version: 0.920+dev.48ba5cae78a6070584a26f918090cfe05781cb47
+ arviz/rcparams.py:319: note: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs"
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/__main__.py", line 11, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/__main__.py", line 11, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/main.py", line 87, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/main.py", line 87, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/main.py", line 165, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/main.py", line 165, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 179, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 179, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 254, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 254, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 2707, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 2707, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 3031, in process_graph
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 3031, in process_graph
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 3129, in process_stale_scc
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 3129, in process_stale_scc
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 2175, in type_check_first_pass
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 2175, in type_check_first_pass
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 295, in check_first_pass
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 295, in check_first_pass
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 530, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 530, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 435, in visit_overloaded_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 435, in visit_overloaded_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 457, in _visit_overloaded_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 457, in _visit_overloaded_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 696, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 696, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 734, in visit_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 734, in visit_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 738, in _visit_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 738, in _visit_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 800, in check_func_item
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 800, in check_func_item
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 983, in check_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 983, in check_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1024, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1024, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 1996, in visit_block
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 1996, in visit_block
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1216, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1220, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 3313, in visit_if_stmt
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 3316, in visit_if_stmt
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1024, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1024, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 1996, in visit_block
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 1996, in visit_block
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 402, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1216, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1220, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 3303, in visit_if_stmt
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checker.py", line 3306, in visit_if_stmt
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 3910, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 3910, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1663, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1667, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 2873, in visit_unary_expr
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 2873, in visit_unary_expr
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 3910, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 3910, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1600, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 1604, in accept
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 277, in visit_call_expr
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 277, in visit_call_expr
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 366, in visit_call_expr_inner
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 366, in visit_call_expr_inner
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 873, in check_call_expr_with_callee_type
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 873, in check_call_expr_with_callee_type
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 933, in check_call
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 933, in check_call
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 1030, in check_callable_call
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 1030, in check_callable_call
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 1493, in check_argument_types
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 1493, in check_argument_types
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 1523, in check_arg
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/checkexpr.py", line 1523, in check_arg
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/subtypes.py", line 93, in is_subtype
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/subtypes.py", line 93, in is_subtype
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/subtypes.py", line 147, in _is_subtype
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/subtypes.py", line 147, in _is_subtype
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.8/site-packages/mypy/types.py", line 1747, in accept
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/types.py", line 1747, in accept
- File "/tmp/m``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atakiar Are you still interested in working on this? There are some merge conflicts now. Also I have few comments.
@@ -2067,6 +2067,9 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None: | |||
and self.scope.active_class() is not None): | |||
self.fail(message_registry.DEPENDENT_FINAL_IN_CLASS_BODY, s) | |||
|
|||
if s.was_annotated and not self.in_checked_function(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to just use s.unanalyzed_type is not None
instead of adding the new attribute?
@@ -1088,7 +1088,7 @@ reveal_type(Foo().Meta.name) # N: Revealed type is "builtins.str" | |||
|
|||
class A: | |||
def __init__(self): | |||
self.x = None # type: int | |||
self.x = None # type: int # N: By default the bodies of functions without signature annotations are not type checked, consider using "--check-untyped-defs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a special case, mypy does use type annotations in unannotated __init__()
. So I would propose to not show this note in __init__()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there still may be type errors like self.x: int = "no"
, so withdraw this comment.
|
||
[case testUnannotatedFunctionWithNewSyntaxAnnotatedStatementsAndFlag] | ||
# flags: --check-untyped-defs | ||
def foo() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this test? I think you maybe wanted to check that the note is not shown if --check-untyped-defs
is used, but then you need to remove -> None
here.
|
||
[case testUnannotatedFunctionWithAnnotatedStatementsAndFlag] | ||
# flags: --check-untyped-defs | ||
def foo() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here, you probably need to remove -> None
here.
I am assuming you don't have time anymore (or not interested). So I am going to make a PR myself (I want this to be included in 0.990). |
Description
Closes #3948. @JukkaL realized this was assigned to you, so feel free to take over, close this PR, etc.
Provides a warning for all annotations in unannotated functions if
--check-untyped-defs
is not used. Example:Test Plan
Updated the affected test cases and added several to test various situations with annotated assignment statements (see check-statements.test)