fix context managers that return bool | None incorrectly being treated as if they can never suppress exceptions#111
Draft
DetachHead wants to merge 4 commits intomainfrom
Draft
fix context managers that return bool | None incorrectly being treated as if they can never suppress exceptions#111DetachHead wants to merge 4 commits intomainfrom
bool | None incorrectly being treated as if they can never suppress exceptions#111DetachHead wants to merge 4 commits intomainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Owner
Author
|
follow-up issue: #114 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dff9c2d to
7272176
Compare
This comment has been minimized.
This comment has been minimized.
7272176 to
75f969a
Compare
This comment has been minimized.
This comment has been minimized.
75f969a to
1b1174c
Compare
1b1174c to
cbdd6d3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
DetachHead
commented
Dec 21, 2024
|
|
||
| ## the solution | ||
|
|
||
| basedpyright introduces a new setting, `strictContextManagerExitTypes` to address this issue. when enabled, context managers where the `__exit__` dunder returns `bool | None` are treated the same way as context managers that return `bool` or `Literal[True]`. put simply, if `True` is assignable to the return type, then it's treated as if it can suppress exceptions. |
Owner
Author
There was a problem hiding this comment.
add this to the playground
ccbd0fd to
b176dd1
Compare
This comment has been minimized.
This comment has been minimized.
…ted as if they can never suppress exceptions
…e` and `True | None`
b176dd1 to
0a8dda6
Compare
This comment has been minimized.
This comment has been minimized.
0a8dda6 to
5c23134
Compare
KotlinIsland
approved these changes
Dec 25, 2024
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: kornia (https://github.com/kornia/kornia)
+ /tmp/mypy_primer/projects/kornia/kornia/nerf/nerf_model.py:211:21 - error: "rgb_model" is possibly unbound (reportPossiblyUnboundVariable)
- 6236 errors, 46950 warnings, 0 notes
+ 6237 errors, 46950 warnings, 0 notes
paasta (https://github.com/yelp/paasta)
+ /tmp/mypy_primer/projects/paasta/paasta_tools/paasta_execute_docker_command.py:111:19 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/paasta/paasta_tools/kubernetes/bin/paasta_secrets_sync.py:550:54 - error: "secret_data" is possibly unbound (reportPossiblyUnboundVariable)
- 1535 errors, 23719 warnings, 0 notes
+ 1537 errors, 23719 warnings, 0 notes
pytest (https://github.com/pytest-dev/pytest)
+ /tmp/mypy_primer/projects/pytest/testing/test_assertrewrite.py:1165:16 - error: Operator "+" not supported for types "Unbound | str" and "Literal['.pyc']"
+ Operator "+" not supported for types "Unbound" and "Literal['.pyc']" (reportOperatorIssue)
+ /tmp/mypy_primer/projects/pytest/testing/test_assertrewrite.py:1165:16 - error: "tagged" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1085:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1086:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1093:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1094:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1105:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1112:16 - error: "capture_result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1113:16 - error: "capture_result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1119:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1126:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1127:20 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1140:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1141:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1152:16 - error: "out1" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1153:16 - error: "out2" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1160:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1161:20 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1168:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1169:20 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1175:16 - error: "newstdin" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1198:16 - error: "out1" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1199:16 - error: "out2" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1234:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1235:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_collection.py:711:32 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_collection.py:720:37 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_collection.py:1351:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1079:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1080:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1081:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1084:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1084:34 - error: "inipath" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1085:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1086:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_config.py:1361:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_pathlib.py:569:20 - error: "module" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:248:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:250:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:251:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:279:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:281:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:282:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:310:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:312:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:313:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:341:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:345:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:346:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/_py/test_local.py:242:16 - error: "x" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/_py/test_local.py:285:16 - error: "contents" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/_py/test_local.py:291:16 - error: "contents" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/code/test_excinfo.py:912:16 - error: "lines" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/code/test_excinfo.py:914:16 - error: "last_lines" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/code/test_excinfo.py:915:16 - error: "last_lines" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pytest/testing/python/approx.py:69:32 - error: "e" is possibly unbound (reportPossiblyUnboundVariable)
- 1156 errors, 17298 warnings, 0 notes
+ 1212 errors, 17298 warnings, 0 notes
ibis (https://github.com/ibis-project/ibis)
- /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:201:16 - warning: Return type is Any (reportAny)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:201:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:209:12 - error: "results" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:241:12 - error: "results" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:48:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:48:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:48:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:54:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:54:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:54:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:302:16 - error: "version_info" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:404:21 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:404:35 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:405:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:405:16 - warning: Return type, "bool | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:405:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:586:12 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:589:40 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:604:16 - error: "rows" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:44:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:44:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:44:16 - error: "version" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:140:30 - error: "row" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:166:21 - error: "tables" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:239:70 - error: "tables" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:83:16 - warning: Return type is Any (reportAny)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:83:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:89:16 - warning: Return type is Any (reportAny)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:89:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:324:9 - warning: Type of "dbs" is Any (reportAny)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:324:9 - warning: Type of "dbs" is partially unknown
+ Type of "dbs" is "Unknown | Any" (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:324:15 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Type of "to_pylist" is Any (reportAny)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Type of "to_pylist" is partially unknown
+ Type of "to_pylist" is "Unknown | Any" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Argument type is Any
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Argument type is partially unknown
- Argument corresponds to parameter "values" in function "_filter_with_like" (reportAny)
+ Argument corresponds to parameter "values" in function "_filter_with_like"
+ Argument type is "Unknown | Any" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Type of "to_pylist" is Any (reportAny)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Type of "to_pylist" is partially unknown
+ Type of "to_pylist" is "Unknown | Any" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Argument type is Any
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Argument type is partially unknown
- Argument corresponds to parameter "values" in function "_filter_with_like" (reportAny)
+ Argument corresponds to parameter "values" in function "_filter_with_like"
+ Argument type is "Unknown | Any" (reportUnknownArgumentType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:1564:16 - error: "rows" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:97:5 - error: "expected_df" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:97:27 - error: "result_df" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:99:44 - error: "expected_df" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:101:25 - error: "result_df" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:56:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:56:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:56:16 - error: "version" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:255:54 - error: Function with declared return type "Schema" must return value on all code paths
+ "None" is not assignable to "Schema" (reportReturnType)
- /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:423:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:423:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:423:16 - error: "schema" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:475:56 - error: "databases" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:198:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:198:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:198:16 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:203:39 - error: "databases" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:228:39 - error: "tables" is possibly unbound (reportPossiblyUnboundVariable)
- /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:284:16 - warning: Return type is unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:284:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:284:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
- Type of "udfs" is "list[Unknown]" (reportUnknownVariableType)
+ Type of "udfs" is "list[Unknown] | None" (reportUnknownVariableType)
- Type of "list_udfs" is "(database: Unknown | None = None, like: Unknown | None = None) -> list[Unknown]" (reportUnknownMemberType)
... (truncated 185 lines) ...
openlibrary (https://github.com/internetarchive/openlibrary)
+ /tmp/mypy_primer/projects/openlibrary/openlibrary/plugins/upstream/account.py:929:52 - error: "lists" is possibly unbound (reportPossiblyUnboundVariable)
- 1902 errors, 33566 warnings, 0 notes
+ 1903 errors, 33566 warnings, 0 notes
psycopg (https://github.com/psycopg/psycopg)
+ /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_typeinfo.py:109:40 - error: "recs" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_typeinfo.py:127:40 - error: "recs" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common.py:287:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common.py:288:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common.py:289:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common_async.py:287:19 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common_async.py:288:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common_async.py:289:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_pipeline.py:596:50 - error: "cursors" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/test_pipeline_async.py:605:58 - error: "cursors" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:457:5 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:459:9 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:460:16 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:485:5 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:487:9 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:488:21 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:489:16 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
- 2014 errors, 38603 warnings, 0 notes
+ 2031 errors, 38603 warnings, 0 notes
pyodide (https://github.com/pyodide/pyodide)
+ /tmp/mypy_primer/projects/pyodide/src/tests/test_cmdline_runner.py:220:62 - error: "msgs" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/pypabuild.py:141:6 - error: Function with declared return type "str" must return value on all code paths
+ "None" is not assignable to "str" (reportReturnType)
+ /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/pypabuild.py:304:6 - error: Function with declared return type "str" must return value on all code paths
+ "None" is not assignable to "str" (reportReturnType)
+ /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/xbuildenv_releases.py:242:53 - error: "data" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/out_of_tree/build.py:43:23 - error: "built_wheel" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/out_of_tree/pypi.py:119:27 - error: "wheel_path" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/tests/test_cli_xbuildenv.py:71:27 - error: "archive_name" is possibly unbound (reportPossiblyUnboundVariable)
- 965 errors, 9987 warnings, 0 notes
+ 972 errors, 9987 warnings, 0 notes
mkosi (https://github.com/systemd/mkosi)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3131:30 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3133:51 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3436:30 - error: "j" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3439:51 - error: "j" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3699:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3699:25 - error: "kver" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3699:34 - error: "kimg" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3700:45 - error: "microcode" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3702:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3702:25 - error: "kver" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3702:34 - error: "kimg" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3703:45 - error: "microcode" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3706:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/archive.py:136:51 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/config.py:1586:16 - error: "args" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/config.py:1936:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:34:18 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:42:18 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:47:9 - error: Operator "-=" not supported for types "Unbound | set[Path]" and "set[Unknown]"
+ Operator "-" not supported for types "Unbound" and "set[Unknown]" (reportOperatorIssue)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:47:9 - warning: Type of "modules" is partially unknown
+ Type of "modules" is "Unknown | set[Path]" (reportUnknownVariableType)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:47:9 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:49:19 - warning: Argument type is partially unknown
+ Argument corresponds to parameter "iterable" in function "sorted"
+ Argument type is "Unknown | set[Path]" (reportUnknownArgumentType)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:49:19 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:77:54 - error: "allmodules" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:187:26 - error: Operator "|" not supported for types "set[Path] | Unbound" and "set[Path] | set[Unknown]"
+ Operator "|" not supported for types "Unbound" and "set[Path]"
+ Operator "|" not supported for types "Unbound" and "set[Unknown]" (reportOperatorIssue)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:187:26 - error: "mods" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:190:13 - error: "mods" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:197:16 - error: "mods" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:226:18 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:236:19 - error: "firmware" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:772:13 - error: "p" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:1434:12 - error: "state" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:1442:15 - error: "state" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:1448:31 - error: "state" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/run.py:167:58 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/run.py:167:63 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/conftest.py:50:17 - error: "release" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:121:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:122:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:123:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:124:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:125:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:138:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:139:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:140:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:141:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:155:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:156:28 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/tests/test_config.py:157:29 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
... (truncated 2287 lines) ...``` |
DetachHead
commented
Jan 2, 2025
Owner
Author
There was a problem hiding this comment.
maybe something like this instead
@contextmanager
def f() -> Generator[None, BaseException, True]:
error = yield
return True
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #10