Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix context managers that return bool | None incorrectly being treated as if they can never suppress exceptions #111

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DetachHead
Copy link
Owner

fixes #10

…ted as if they can never suppress exceptions

This comment has been minimized.

This comment has been minimized.

@DetachHead
Copy link
Owner Author

DetachHead commented Feb 25, 2024

contextmanager is incorrectly typed so it now treats some stuff as reachable when it's not. but that's nowhere near as bad as marking stuff as unreachable when it actually is reachable

follow-up issue: #114

This comment has been minimized.

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from dff9c2d to 7272176 Compare February 25, 2024 06:18

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from 7272176 to 75f969a Compare February 25, 2024 07:35
@DetachHead DetachHead marked this pull request as draft February 25, 2024 07:41
Copy link
Contributor

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

alectryon (https://github.com/cpitclaudel/alectryon)
+   /tmp/mypy_primer/projects/alectryon/alectryon/pygments.py:190:20 - error: No overloads for "join" match the provided arguments (reportCallIssue)
+   /tmp/mypy_primer/projects/alectryon/alectryon/pygments.py:190:28 - error: Argument of type "tuple[str | Any, Unknown, str | Any] | None" cannot be assigned to parameter "__iterable" of type "Iterable[str]" in function "join"
+     Type "tuple[str | Any, Unknown, str | Any] | None" cannot be assigned to type "Iterable[str]"
+       "None" is incompatible with protocol "Iterable[str]"
+         "__iter__" is not present (reportArgumentType)
+   /tmp/mypy_primer/projects/alectryon/alectryon/pygments.py:203:26 - error: "None" is not iterable
+     "__iter__" method not defined (reportGeneralTypeIssues)
- 27 errors, 37 warnings, 0 notes 
+ 30 errors, 37 warnings, 0 notes 

pyinstrument (https://github.com/joerick/pyinstrument)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_ipython_magic.py:41:16 - error: "captured" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_ipython_magic.py:42:14 - error: "captured" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_ipython_magic.py:58:16 - error: "captured" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_ipython_magic.py:59:14 - error: "captured" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:161:12 - error: "profiler" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:162:13 - error: "profiler" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:174:19 - error: "profiler" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler.py:191:19 - error: "profiler" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:47:16 - error: "session" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:49:18 - error: "session" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:189:18 - error: "session" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_profiler_async.py:216:18 - error: "session" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyinstrument/test/test_pstats_renderer.py:123:12 - error: "profiler_session" is possibly unbound (reportPossiblyUnboundVariable)
- 40 errors, 5 warnings, 0 notes 
+ 53 errors, 5 warnings, 0 notes 

operator (https://github.com/canonical/operator)
+ /tmp/mypy_primer/projects/operator/ops/testing.py
+   /tmp/mypy_primer/projects/operator/ops/testing.py:1240:16 - error: "values_have_changed" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/operator/test/test_framework.py
+   /tmp/mypy_primer/projects/operator/test/test_framework.py:51:31 - error: "framework" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/operator/test/test_model.py:307:13 - error: "data_repr" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/operator/test/test_model.py:3644:31 - error: "ports_set" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/operator/test/test_model.py:3645:24 - error: "ports_set" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/operator/test/test_pebble.py:3343:26 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/operator/test/test_pebble.py:3344:26 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
- 47 errors, 0 warnings, 0 notes 
+ 54 errors, 0 warnings, 0 notes 

pydantic (https://github.com/samuelcolvin/pydantic)
+   /tmp/mypy_primer/projects/pydantic/pydantic/json_schema.py:1229:53 - error: "json_schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/json_schema.py:1232:17 - error: "json_schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/json_schema.py:1234:17 - error: "json_schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/json_schema.py:1236:16 - error: "json_schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/json_schema.py:1363:49 - error: "json_schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/json_schema.py:1527:49 - error: "json_schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/main.py:700:16 - error: "submodel" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1119:45 - error: "schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1214:42 - error: "schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1379:42 - error: "schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_generate_schema.py:1381:66 - error: "schema" is possibly unbound (reportPossiblyUnboundVariable)
- 75 errors, 0 warnings, 0 notes 
+ 86 errors, 0 warnings, 0 notes 

mkosi (https://github.com/systemd/mkosi)
+ /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:2820:30 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:2822:51 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3198:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3198:25 - error: "kver" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3198:34 - error: "kimg" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3201:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3201:25 - error: "kver" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3201:34 - error: "kimg" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/config.py:1128:16 - error: "args" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/config.py:1362:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/mkosi/mkosi/run.py
+   /tmp/mypy_primer/projects/mkosi/mkosi/run.py:144:6 - error: Function with declared return type "CompletedProcess" must return value on all code paths
+     "None" is incompatible with "CompletedProcess" (reportReturnType)
+ /tmp/mypy_primer/projects/mkosi/mkosi/installer/apt.py
+   /tmp/mypy_primer/projects/mkosi/mkosi/installer/apt.py:178:10 - error: Function with declared return type "CompletedProcess" must return value on all code paths
+     "None" is incompatible with "CompletedProcess" (reportReturnType)
+ /tmp/mypy_primer/projects/mkosi/mkosi/installer/dnf.py
+   /tmp/mypy_primer/projects/mkosi/mkosi/installer/dnf.py:162:10 - error: Function with declared return type "CompletedProcess" must return value on all code paths
+     "None" is incompatible with "CompletedProcess" (reportReturnType)
+ /tmp/mypy_primer/projects/mkosi/mkosi/installer/pacman.py
+   /tmp/mypy_primer/projects/mkosi/mkosi/installer/pacman.py:153:10 - error: Function with declared return type "CompletedProcess" must return value on all code paths
+     "None" is incompatible with "CompletedProcess" (reportReturnType)
+ /tmp/mypy_primer/projects/mkosi/mkosi/installer/zypper.py
+   /tmp/mypy_primer/projects/mkosi/mkosi/installer/zypper.py:124:10 - error: Function with declared return type "CompletedProcess" must return value on all code paths
+     "None" is incompatible with "CompletedProcess" (reportReturnType)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:115:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:116:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:117:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:118:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:119: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:152:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:154:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:156:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:157:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:158:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:159:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:177:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:178:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:180:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:188:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:256:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:258:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:259:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:275:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:291:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:303:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:618:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:900:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
- 9 errors, 0 warnings, 0 notes 
+ 48 errors, 0 warnings, 0 notes 

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+   /tmp/mypy_primer/projects/Tanjun/tanjun/dependencies/data.py:160:10 - error: Function with declared return type "_T@make_lc_resolver" must return value on all code paths
+     Type "None" cannot be assigned to type "_T@make_lc_resolver" (reportReturnType)
-   /tmp/mypy_primer/projects/Tanjun/tests/dependencies/test_limiters.py:146:26 - error: Cannot access member "assert_awaited_once_with" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/Tanjun/tests/dependencies/test_limiters.py:147:22 - error: Cannot access member "assert_awaited_once_with" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/Tanjun/tests/dependencies/test_limiters.py:148:29 - error: Cannot access member "assert_not_called" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/Tanjun/tests/dependencies/test_limiters.py:328:26 - error: Cannot access member "assert_awaited_once_with" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/Tanjun/tests/dependencies/test_limiters.py:329:22 - error: Cannot access member "assert_awaited_once_with" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/Tanjun/tests/dependencies/test_limiters.py:330:29 - error: Cannot access member "assert_not_called" for type "Unbound" (reportAttributeAccessIssue)
- 2382 errors, 6693 warnings, 0 notes 
+ 2377 errors, 6693 warnings, 0 notes 

steam.py (https://github.com/Gobot1234/steam.py)
+   /tmp/mypy_primer/projects/steam.py/steam/models.py:184:44 - error: Function with declared return type "bytes" must return value on all code paths
+     "None" is incompatible with "bytes" (reportReturnType)
- 8469 errors, 26 warnings, 0 notes 
+ 8470 errors, 26 warnings, 0 notes 

spack (https://github.com/spack/spack)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/ci.py:1643:20 - error: "git_log" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/compiler.py:378:54 - error: Argument of type "str | Any | None" cannot be assigned to parameter "string" of type "str | int" in function "Version" (reportArgumentType)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/concretize.py:777:12 - error: "concrete_specs" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/fetch_strategy.py:411:29 - error: "headers" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/fetch_strategy.py:1334:12 - error: "content_type" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/fetch_strategy.py:1381:12 - error: "content_type" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/installer.py:463:6 - error: Function with declared return type "bool" must return value on all code paths
+     "None" is incompatible with "bool" (reportReturnType)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/installer.py:490:55 - error: "download_result" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/spack/lib/spack/spack/installer.py:522:51 - error: Argument of type "list[Unknown] | dict[Unknown, Unknown]" cannot be assigned to parameter "mirrors_for_spec" of type "list[Unknown] | None" in function "_process_binary_cache_tarball" (reportArgumentType)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/installer.py:522:51 - error: Argument of type "Unbound | list[Unknown] | dict[Unknown, Unknown]" cannot be assigned to parameter "mirrors_for_spec" of type "list[Unknown] | None" in function "_process_binary_cache_tarball" (reportArgumentType)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/installer.py:522:51 - error: "matches" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/installer.py:2455:81 - error: Function with declared return type "bool" must return value on all code paths
+     "None" is incompatible with "bool" (reportReturnType)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/repo.py:214:58 - error: "strip" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/repo.py:220:47 - error: "split" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/repo.py:262:76 - error: "strip" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/bootstrap/core.py:312:13 - error: "concrete_spec" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/bootstrap/core.py:314:54 - error: "concrete_spec" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/bootstrap/status.py:175:17 - error: "missing_software" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/blame.py:156:17 - error: "lines" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/unit_test.py:221:23 - error: "main" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/unit_test.py:238:23 - error: "main" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/container/images.py:138:55 - error: Argument of type "Unknown | Literal['develop'] | None" cannot be assigned to parameter "s" of type "str" in function "quote"
+     Type "Unknown | Literal['develop'] | None" cannot be assigned to type "str"
+       "None" is incompatible with "str" (reportArgumentType)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/detection/common.py:360:69 - error: "keys" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/detection/common.py:362:92 - error: "value" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/detection/common.py:374:61 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/detection/common.py:378:25 - error: "get_value" is not a known member of "None" (reportOptionalMemberAccess)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/detection/test.py:71:21 - error: "specs" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/operating_systems/cray_frontend.py:95:21 - error: "search_paths" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/operating_systems/cray_frontend.py:104:51 - error: "search_paths" is possibly unbound (reportPossiblyUnboundVariable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/solver/core.py
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/solver/core.py:201:12 - error: "clingo_mod" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/bindist.py:368:31 - error: "fpr" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1507:16 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1508:16 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1618:16 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1633:35 - error: "new_root" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1652:20 - error: "new_root" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1665:16 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1684:20 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1771:21 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1836:25 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1889:16 - error: "external2" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1894:16 - error: "external3" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:1957:18 - error: "spec" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:2199:16 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:2251:16 - error: "with_reuse" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:2251:41 - error: "without_reuse" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:2277:20 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/concretize.py:2278:20 - error: "s" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/conftest.py:90:25 - error: "git_log_out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/conftest.py:214:32 - error: "commits" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/git_fetch.py:275:20 - error: "nbranches" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/git_fetch.py:276:20 - error: "ncommits" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/git_fetch.py:278:20 - error: "nbranches" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/git_fetch.py:279:20 - error: "ncommits" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/repo.py:97:15 - error: "zlib_cls_inner" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/sbang.py:374:15 - error: "exc_info" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/test_suite.py:305:34 - error: Cannot access member "tester" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/test_suite.py:335:34 - error: Cannot access member "tester" for type "Unbound" (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/cmd/blame.py:41:29 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/cmd/blame.py:42:24 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/spack/lib/spack/spack/test/cmd/blame.py:43:23 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)

... (truncated 39 lines) ...

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+   /tmp/mypy_primer/projects/pytest-robotframework/tests/fixtures/test_python/test_keyword_decorator_context_manager_that_doesnt_suppress.py:28:40 - error: Unnecessary "# pyright: ignore" rule: "reportUnreachable"
+   /tmp/mypy_primer/projects/pytest-robotframework/tests/fixtures/test_python/test_keyword_decorator_context_manager_that_raises_in_body_and_exit.py:27:40 - error: Unnecessary "# pyright: ignore" rule: "reportUnreachable"
- 2050 errors, 0 warnings, 0 notes 
+ 2052 errors, 0 warnings, 0 notes 

trio (https://github.com/python-trio/trio)
+   /tmp/mypy_primer/projects/trio/src/trio/_highlevel_open_tcp_stream.py:197:6 - error: Function with declared return type "SocketStream" must return value on all code paths
+     "None" is incompatible with "SocketStream" (reportReturnType)
+   /tmp/mypy_primer/projects/trio/src/trio/_highlevel_socket.py:135:67 - error: Function with declared return type "bytes" must return value on all code paths
+     "None" is incompatible with "bytes" (reportReturnType)
+   /tmp/mypy_primer/projects/trio/src/trio/_threads.py:275:6 - error: Function with declared return type "RetT@to_thread_run_sync" must return value on all code paths
+     Type "None" cannot be assigned to type "RetT@to_thread_run_sync" (reportReturnType)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_run.py:1267:16 - error: "task_status" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_run.py:1269:20 - error: "task_status" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:47:43 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:51:13 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:64:5 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:65:5 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:66:5 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:72:43 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:74:9 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:79:9 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_parking_lot.py:84:9 - error: "lot" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_run.py:1788:39 - error: "t0" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_core/_tests/test_run.py:2727:56 - error: "excinfo" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_tcp_stream.py:54:13 - error: Type of "add" is unknown (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_tcp_stream.py:54:22 - error: Cannot access member "add" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_tcp_stream.py:55:13 - error: Type of "add" is unknown (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_tcp_stream.py:55:22 - error: Cannot access member "add" for type "Unbound" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_unix_stream.py:34:12 - error: Type of "closed" is unknown (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_open_unix_stream.py:34:14 - error: Cannot access member "closed" for type "Unbound" (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_highlevel_socket.py:185:23 - error: "server_stream" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:158:9 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:173:9 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:188:12 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:202:12 - error: "excinfo" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:217:12 - error: "got" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:486:14 - error: Object of type "Unbound" cannot be used with "with" because it does not implement __enter__ (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:486:14 - error: Object of type "Unbound" cannot be used with "with" because it does not implement __exit__ (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:486:14 - error: "server" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:487:20 - error: "client_addr" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:487:35 - error: "server" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/test_socket.py:488:19 - error: "server" is possibly unbound (reportPossiblyUnboundVariable)

... (truncated 162 lines) ...```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant