typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Make `ExitStack` generic in return type of `__exit__`

Open Daverball opened this issue 2 years ago • 4 comments

See https://discuss.python.org/t/add-an-else-clause-to-with-statements-to-detect-early-termination/38031 for related discussion.

Daverball avatar Nov 20 '23 22:11 Daverball

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

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/net/ephemeral.py:365: error: Need type annotation for "stack"  [var-annotated]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_vendor/fastapi/middleware/asyncexitstack.py:14: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/_vendor/fastapi/dependencies/utils.py:569: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Any, Any]"  [arg-type]
+ src/prefect/_vendor/fastapi/dependencies/utils.py:569: note: "_AsyncGeneratorContextManager" is missing following "_AbstractAsyncContextManager" protocol member:
+ src/prefect/_vendor/fastapi/dependencies/utils.py:569: note:     __exit__
+ src/prefect/server/utilities/server.py:99: error: Need type annotation for "stack"  [var-annotated]
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
+ src/prefect/_internal/concurrency/api.py:178: error: Need type annotation for "stack"  [var-annotated]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
+ src/prefect/_internal/concurrency/api.py:239: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/client/orchestration.py:212: error: Need type annotation for "_exit_stack"  [var-annotated]
+ src/prefect/task_runners.py:182: error: Need type annotation for "exit_stack"  [var-annotated]
+ src/prefect/engine.py:490: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:672: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:1523: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:490: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:492: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]
+ src/prefect/engine.py:672: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:674: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]
+ src/prefect/engine.py:1523: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:1543: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]
+ src/prefect/server/database/dependencies.py:231: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/server/models/task_runs.py:411: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/server/models/flow_runs.py:494: error: Need type annotation for "stack"  [var-annotated]

pylint (https://github.com/pycqa/pylint)
+ pylint/lint/pylinter.py:424: error: Need type annotation for "stack"  [var-annotated]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/sql.py:1581: error: Need type annotation for "exit_stack"  [var-annotated]

anyio (https://github.com/agronholm/anyio)
+ src/anyio/abc/_sockets.py:143: error: Need type annotation for "stack"  [var-annotated]
+ src/anyio/abc/_sockets.py:145: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "TaskGroup"; expected "_AbstractAsyncContextManager[TaskGroup | None, Any]"  [arg-type]
+ src/anyio/abc/_sockets.py:145: note: "TaskGroup" is missing following "_AbstractAsyncContextManager" protocol member:
+ src/anyio/abc/_sockets.py:145: note:     __exit__
+ src/anyio/abc/_sockets.py:149: error: Item "None" of "TaskGroup | None" has no attribute "start_soon"  [union-attr]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]
+ src/werkzeug/debug/__init__.py:376: error: Need type annotation for "exit_stack"  [var-annotated]

boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/request.py:57: error: Need type annotation for "stack"  [var-annotated]
+ boostedblob/request.py:59: error: Need type annotation for "resp"  [var-annotated]
+ boostedblob/request.py:59: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[ClientResponse]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]

starlette (https://github.com/encode/starlette)
+ starlette/testclient.py:87: error: Need type annotation for "exit_stack"  [var-annotated]
+ starlette/testclient.py:732: error: Need type annotation for "stack"  [var-annotated]
+ tests/middleware/test_base.py:352: error: Need type annotation for "stack"  [var-annotated]

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch_storage_plugins/swift.py: note: In member "walk" of class "SwiftStorage":
+ src/bandersnatch_storage_plugins/swift.py:632: error: Need type annotation for "stack"  [var-annotated]

jax (https://github.com/google/jax)
+ jax/_src/config.py:1297: error: Need type annotation for "stack"  [var-annotated]
+ jax/experimental/jax2tf/tests/shape_poly_test.py:598: error: Need type annotation for "stack"  [var-annotated]
+ jax/experimental/jax2tf/tests/shape_poly_test.py:1057: error: Need type annotation for "stack"  [var-annotated]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/mounts.py:73:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/qemu.py:511:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:93:51: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:311:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:327:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:408:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2180:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2352:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2398:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2677:10: error: Need type annotation for "stack"  [var-annotated]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/cli/command_context.py:11: error: Need type annotation for "_main_context"  [var-annotated]
+ src/pip/_internal/utils/temp_dir.py:36: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ src/pip/_internal/utils/temp_dir.py:42: error: Need type annotation for "stack"  [var-annotated]
+ src/pip/_internal/operations/build/build_tracker.py:44: error: Need type annotation for "ctx"  [var-annotated]

zetta_utils (https://github.com/ZettaAI/zetta_utils)
+ zetta_utils/mazepa/execution.py:166: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/mazepa_addons/configurations/worker_pool.py:91: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/mazepa_addons/configurations/execute_locally.py:40: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/training/lightning/train.py:262: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/mazepa_layer_processing/common/volumetric_callable_operation.py:91: error: Need type annotation for "semaphore_stack"  [var-annotated]
+ zetta_utils/mazepa_addons/configurations/execute_on_gcp_with_sqs.py:187: error: Need type annotation for "stack"  [var-annotated]

schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/specs/openapi/schemas.py: note: In function "in_scopes":
+ src/schemathesis/specs/openapi/schemas.py:691: error: Need type annotation for "stack"  [var-annotated]

sockeye (https://github.com/awslabs/sockeye)
+ sockeye/data_io.py:377: error: Need type annotation for "exit_stack"  [var-annotated]
+ sockeye/checkpoint_decoder.py:90: error: Need type annotation for "exit_stack"  [var-annotated]
+ sockeye/checkpoint_decoder.py:159: error: Need type annotation for "exit_stack"  [var-annotated]
+ sockeye/translate.py:188: error: Need type annotation for "exit_stack"  [var-annotated]

urllib3 (https://github.com/urllib3/urllib3)
+ dummyserver/testcase.py:174: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ dummyserver/testcase.py:178: error: Need type annotation for "stack"  [var-annotated]
+ dummyserver/testcase.py:242: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ dummyserver/testcase.py:246: error: Need type annotation for "stack"  [var-annotated]
+ dummyserver/testcase.py:306: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ dummyserver/testcase.py:310: error: Need type annotation for "stack"  [var-annotated]

streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/web/server/server_test.py: note: In member "test_missing_file" of class "SslServerTest":
+ lib/tests/streamlit/web/server/server_test.py:373:14: error: Need type annotation for "exit_stack"  [var-annotated]
+ lib/tests/streamlit/web/server/server_test.py: note: In member "test_invalid_file_content" of class "SslServerTest":
+ lib/tests/streamlit/web/server/server_test.py:406:14: error: Need type annotation for "exit_stack"  [var-annotated]
+ lib/tests/streamlit/web/cli_test.py: note: In member "test_ssl" of class "HTTPServerIntegrationTest":
+ lib/tests/streamlit/web/cli_test.py:450:14: error: Need type annotation for "exit_stack"  [var-annotated]

github-actions[bot] avatar Nov 20 '23 22:11 github-actions[bot]

Quite a few mypy primer hits here. This change probably does not make sense until after PEP696 support.

Daverball avatar Nov 20 '23 22:11 Daverball

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

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/net/ephemeral.py:365: error: Need type annotation for "stack"  [var-annotated]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_vendor/fastapi/middleware/asyncexitstack.py:14: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/_vendor/fastapi/dependencies/utils.py:569: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Any, Any]"  [arg-type]
+ src/prefect/_vendor/fastapi/dependencies/utils.py:569: note: "_AsyncGeneratorContextManager" is missing following "_AbstractAsyncContextManager" protocol member:
+ src/prefect/_vendor/fastapi/dependencies/utils.py:569: note:     __exit__
+ src/prefect/server/utilities/server.py:99: error: Need type annotation for "stack"  [var-annotated]
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
+ src/prefect/_internal/concurrency/api.py:178: error: Need type annotation for "stack"  [var-annotated]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
+ src/prefect/_internal/concurrency/api.py:239: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/client/orchestration.py:212: error: Need type annotation for "_exit_stack"  [var-annotated]
+ src/prefect/task_runners.py:182: error: Need type annotation for "exit_stack"  [var-annotated]
+ src/prefect/engine.py:490: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:672: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:1523: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:490: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:492: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]
+ src/prefect/engine.py:672: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:674: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]
+ src/prefect/engine.py:1523: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/engine.py:1543: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]
+ src/prefect/server/database/dependencies.py:231: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/server/models/task_runs.py:411: error: Need type annotation for "stack"  [var-annotated]
+ src/prefect/server/models/flow_runs.py:494: error: Need type annotation for "stack"  [var-annotated]

pylint (https://github.com/pycqa/pylint)
+ pylint/lint/pylinter.py:424: error: Need type annotation for "stack"  [var-annotated]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/sql.py:1581: error: Need type annotation for "exit_stack"  [var-annotated]

anyio (https://github.com/agronholm/anyio)
+ src/anyio/abc/_sockets.py:143: error: Need type annotation for "stack"  [var-annotated]
+ src/anyio/abc/_sockets.py:145: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "TaskGroup"; expected "_AbstractAsyncContextManager[TaskGroup | None, Any]"  [arg-type]
+ src/anyio/abc/_sockets.py:145: note: "TaskGroup" is missing following "_AbstractAsyncContextManager" protocol member:
+ src/anyio/abc/_sockets.py:145: note:     __exit__
+ src/anyio/abc/_sockets.py:149: error: Item "None" of "TaskGroup | None" has no attribute "start_soon"  [union-attr]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]
+ src/werkzeug/debug/__init__.py:376: error: Need type annotation for "exit_stack"  [var-annotated]

boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/request.py:57: error: Need type annotation for "stack"  [var-annotated]
+ boostedblob/request.py:59: error: Need type annotation for "resp"  [var-annotated]
+ boostedblob/request.py:59: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[ClientResponse]"; expected "_AbstractAsyncContextManager[Never, Any]"  [arg-type]

starlette (https://github.com/encode/starlette)
+ starlette/testclient.py:87: error: Need type annotation for "exit_stack"  [var-annotated]
+ starlette/testclient.py:732: error: Need type annotation for "stack"  [var-annotated]
+ tests/middleware/test_base.py:352: error: Need type annotation for "stack"  [var-annotated]

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch_storage_plugins/swift.py: note: In member "walk" of class "SwiftStorage":
+ src/bandersnatch_storage_plugins/swift.py:632: error: Need type annotation for "stack"  [var-annotated]

jax (https://github.com/google/jax)
+ jax/_src/config.py:1297: error: Need type annotation for "stack"  [var-annotated]
+ jax/experimental/jax2tf/tests/shape_poly_test.py:598: error: Need type annotation for "stack"  [var-annotated]
+ jax/experimental/jax2tf/tests/shape_poly_test.py:1057: error: Need type annotation for "stack"  [var-annotated]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/mounts.py:73:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/qemu.py:511:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:93:51: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:311:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:327:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:408:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2180:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2352:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2398:10: error: Need type annotation for "stack"  [var-annotated]
+ mkosi/__init__.py:2677:10: error: Need type annotation for "stack"  [var-annotated]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/cli/command_context.py:11: error: Need type annotation for "_main_context"  [var-annotated]
+ src/pip/_internal/utils/temp_dir.py:36: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ src/pip/_internal/utils/temp_dir.py:42: error: Need type annotation for "stack"  [var-annotated]
+ src/pip/_internal/operations/build/build_tracker.py:44: error: Need type annotation for "ctx"  [var-annotated]

zetta_utils (https://github.com/ZettaAI/zetta_utils)
+ zetta_utils/mazepa/execution.py:166: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/mazepa_addons/configurations/worker_pool.py:91: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/mazepa_addons/configurations/execute_locally.py:40: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/training/lightning/train.py:262: error: Need type annotation for "stack"  [var-annotated]
+ zetta_utils/mazepa_layer_processing/common/volumetric_callable_operation.py:91: error: Need type annotation for "semaphore_stack"  [var-annotated]
+ zetta_utils/mazepa_addons/configurations/execute_on_gcp_with_sqs.py:187: error: Need type annotation for "stack"  [var-annotated]

schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/specs/openapi/schemas.py: note: In function "in_scopes":
+ src/schemathesis/specs/openapi/schemas.py:691: error: Need type annotation for "stack"  [var-annotated]

urllib3 (https://github.com/urllib3/urllib3)
+ dummyserver/testcase.py:174: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ dummyserver/testcase.py:178: error: Need type annotation for "stack"  [var-annotated]
+ dummyserver/testcase.py:242: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ dummyserver/testcase.py:246: error: Need type annotation for "stack"  [var-annotated]
+ dummyserver/testcase.py:306: error: Missing type parameters for generic type "ExitStack"  [type-arg]
+ dummyserver/testcase.py:310: error: Need type annotation for "stack"  [var-annotated]

sockeye (https://github.com/awslabs/sockeye)
+ sockeye/data_io.py:377: error: Need type annotation for "exit_stack"  [var-annotated]
+ sockeye/checkpoint_decoder.py:90: error: Need type annotation for "exit_stack"  [var-annotated]
+ sockeye/checkpoint_decoder.py:159: error: Need type annotation for "exit_stack"  [var-annotated]
+ sockeye/translate.py:188: error: Need type annotation for "exit_stack"  [var-annotated]

streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/web/server/server_test.py: note: In member "test_missing_file" of class "SslServerTest":
+ lib/tests/streamlit/web/server/server_test.py:373:14: error: Need type annotation for "exit_stack"  [var-annotated]
+ lib/tests/streamlit/web/server/server_test.py: note: In member "test_invalid_file_content" of class "SslServerTest":
+ lib/tests/streamlit/web/server/server_test.py:406:14: error: Need type annotation for "exit_stack"  [var-annotated]
+ lib/tests/streamlit/web/cli_test.py: note: In member "test_ssl" of class "HTTPServerIntegrationTest":
+ lib/tests/streamlit/web/cli_test.py:450:14: error: Need type annotation for "exit_stack"  [var-annotated]

github-actions[bot] avatar Nov 20 '23 22:11 github-actions[bot]

See #11422 for the type var generics feature tracker.

srittau avatar Feb 14 '24 14:02 srittau

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

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_vendor/fastapi/dependencies/utils.py:574: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Any, bool | None]"  [arg-type]
+ src/prefect/_vendor/fastapi/dependencies/utils.py:574: note: "_AsyncGeneratorContextManager" is missing following "_AbstractAsyncContextManager" protocol member:
+ src/prefect/_vendor/fastapi/dependencies/utils.py:574: note:     __exit__
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
+ src/prefect/engine.py:516: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, bool | None]"  [arg-type]
+ src/prefect/engine.py:698: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, bool | None]"  [arg-type]
+ src/prefect/engine.py:1841: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[Any]"; expected "_AbstractAsyncContextManager[Never, bool | None]"  [arg-type]

typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
+ src/typeshed_stats/gather.py:625: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "ClientSession"; expected "_AbstractAsyncContextManager[ClientSession | None, bool | None]"  [arg-type]
+ src/typeshed_stats/gather.py:625: note: Following member(s) of "ClientSession" have conflicts:
+ src/typeshed_stats/gather.py:625: note:     Expected:
+ src/typeshed_stats/gather.py:625: note:         def __exit__(self, type[BaseException] | None, BaseException | None, TracebackType | None, /) -> Coroutine[Any, Any, bool | None]
+ src/typeshed_stats/gather.py:625: note:     Got:
+ src/typeshed_stats/gather.py:625: note:         def __exit__(self, type[BaseException] | None, BaseException | None, TracebackType | None, /) -> None
+ src/typeshed_stats/gather.py:626: error: Item "None" of "ClientSession | None" has no attribute "get"  [union-attr]

anyio (https://github.com/agronholm/anyio)
+ src/anyio/abc/_sockets.py:145: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "TaskGroup"; expected "_AbstractAsyncContextManager[TaskGroup | None, bool | None]"  [arg-type]
+ src/anyio/abc/_sockets.py:145: note: "TaskGroup" is missing following "_AbstractAsyncContextManager" protocol member:
+ src/anyio/abc/_sockets.py:145: note:     __exit__
+ src/anyio/abc/_sockets.py:149: error: Item "None" of "TaskGroup | None" has no attribute "start_soon"  [union-attr]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/request.py:131: error: Need type annotation for "resp"  [var-annotated]
+ boostedblob/request.py:131: error: Argument 1 to "enter_async_context" of "AsyncExitStack" has incompatible type "_AsyncGeneratorContextManager[ClientResponse]"; expected "_AbstractAsyncContextManager[Never, Optional[bool]]"  [arg-type]

github-actions[bot] avatar Mar 15 '24 21:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

github-actions[bot] avatar Mar 15 '24 21:03 github-actions[bot]

This is really encouraging, PEP-696 truly shines here. I'll check if there are any other places in typeshed that use AbstractContextManager/AbstractAsyncContextManager that should have their second parameter specified.


I fixed the obvious ones, the other ones are probably fine using the default as a fallback for now (or maybe we should just set them all to bool | None, so type checkers without full PEP-696 support still have a good UX).

Daverball avatar Mar 15 '24 21:03 Daverball

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

github-actions[bot] avatar Mar 15 '24 21:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

github-actions[bot] avatar Mar 15 '24 22:03 github-actions[bot]

TypeVar defaults are now available in typeshed.

srittau avatar Mar 20 '24 03:03 srittau

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

github-actions[bot] avatar Mar 20 '24 03:03 github-actions[bot]

One of the mypy_primer hits is irrelevant, since it is the same unrelated error with different types and the other one looks like an improvement to me.

There are a couple of caveats to this change however:

  • Right now I'm explicitly specifying the second parameter in subclasses to AbstractContextManager/AbstractAsyncContextManager in the sdlib as long as they override __exit__ with a different value than the default for clarity. Technically this shouldn't be necessary and we could keep the surface area of the change smaller. Or we could go the opposite way and make sure we always specify the second parameter everywhere in the stdlib. Either of those options would probably be more manageable for maintainers of type checkers that don't yet support PEP-696, compared to the mish mash we have now.
  • typing.ContextManager and typing.AsyncContextManager are just aliases for the ABCs that changed, but this means the Python docs are no longer accurate. Technically it is a harmless mismatch, since you can omit the parameter, that is missing from the docs, but we should probably still consider updating the docs, if we accept this change.

Daverball avatar Mar 20 '24 07:03 Daverball

https://discuss.python.org/t/passing-only-one-typevar-of-two-when-using-defaults/49134 clued me into an issue, since at runtime typing.ContextManager/typing.AsyncContextManager inherit from Generic/Protocol they will emit runtime errors if you try to use the second argument, this is in contrast to any __class_getitem__ methods added to builtins and ABC, which don't validate the number of arguments.

Daverball avatar Mar 21 '24 16:03 Daverball

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

pyp (https://github.com/hauntsaninja/pyp)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

vision (https://github.com/pytorch/vision)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
- torchvision/models/quantization/utils.py:29: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/quantization/utils.py:34: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/quantization/utils.py:39: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_tv_tensor.py:106: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_tv_tensor.py:111: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_tv_tensor.py:116: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_tv_tensor.py:121: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_tv_tensor.py:132: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_video.py:36: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_bounding_boxes.py:52: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/tv_tensors/_bounding_boxes.py:102: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/prototype/tv_tensors/_label.py:51: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/_api.py:178: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/_functional_pil.py:178: error: Argument "border" to "expand" has incompatible type "int | tuple[int, ...]"; expected "int | tuple[int, int] | tuple[int, int, int, int]"  [arg-type]
- torchvision/transforms/_functional_pil.py:179: error: Argument 1 to "putpalette" of "Image" has incompatible type "list[int] | None"; expected "ImagePalette | bytes | Iterable[int] | SupportsBytes"  [arg-type]
- torchvision/transforms/_functional_pil.py:182: error: Argument "border" to "expand" has incompatible type "int | tuple[int, ...]"; expected "int | tuple[int, int] | tuple[int, int, int, int]"  [arg-type]
- torchvision/transforms/_functional_pil.py:209: error: Argument 1 to "putpalette" of "Image" has incompatible type "list[int] | None"; expected "ImagePalette | bytes | Iterable[int] | SupportsBytes"  [arg-type]
- torchvision/transforms/_functional_pil.py:214: error: "Image" has no attribute "shape"  [attr-defined]
- torchvision/transforms/_functional_pil.py:217: error: "Image" has no attribute "shape"  [attr-defined]
- torchvision/transforms/_functional_pil.py:250: error: Argument 1 to "resize" of "Image" has incompatible type "tuple[int, ...]"; expected "tuple[int, int]"  [arg-type]
- torchvision/transforms/_functional_pil.py:250: error: Argument 2 to "resize" of "Image" has incompatible type "int"; expected "Resampling | Literal[0, 1, 2, 3, 4, 5] | None"  [arg-type]
- torchvision/transforms/_functional_pil.py:297: error: Argument 4 to "transform" of "Image" has incompatible type "int"; expected "Resampling | Literal[0, 1, 2, 3, 4, 5]"  [arg-type]
- torchvision/transforms/_functional_pil.py:314: error: Argument 2 to "rotate" of "Image" has incompatible type "int"; expected "Resampling | Literal[0, 1, 2, 3, 4, 5]"  [arg-type]
- torchvision/transforms/_functional_pil.py:330: error: Argument 4 to "transform" of "Image" has incompatible type "int"; expected "Resampling | Literal[0, 1, 2, 3, 4, 5]"  [arg-type]
- torchvision/models/_utils.py:174: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/datasets/utils.py:133: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/utils.py:119: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/utils.py:227: error: Incompatible types in assignment (expression has type "FreeTypeFont", variable has type "ImageFont")  [assignment]
- torchvision/utils.py:608: error: Item "int" of "tuple[int, int, int] | tuple[int, int, int, int] | Any | int" has no attribute "__iter__" (not iterable)  [union-attr]
- torchvision/utils.py:609: error: Incompatible return value type (got "list[tuple[int, int, int] | tuple[int, int, int, int] | Any | int]", expected "list[tuple[int, int, int]]")  [return-value]
- torchvision/tv_tensors/_image.py:52: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/detection/generalized_rcnn.py:106: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/datasets/widerface.py:95: error: Argument 1 to "open" has incompatible type "str | dict[str, Any]"; expected "str | bytes | Path | SupportsRead[bytes]"  [arg-type]
- torchvision/datasets/voc.py:10: error: Incompatible import of "ET_parse" (imported name has type "Callable[[int | str | bytes | PathLike[str] | PathLike[bytes] | SupportsRead[bytes] | SupportsRead[str], XMLParser | None], ElementTree]", local name has type "Callable[[Any, DefusedXMLParser | None, bool, bool, bool], ElementTree]")  [assignment]
- torchvision/datasets/folder.py:78: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/datasets/cityscapes.py:191: error: Incompatible types in assignment (expression has type "Image", variable has type "dict[str, Any]")  [assignment]
- torchvision/datasets/_stereo_matching.py:565: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/datasets/video_utils.py:146: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/datasets/video_utils.py:386: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/functional/_geometry.py:116: error: Module "PIL.Image" is not valid as a type  [valid-type]
- torchvision/transforms/v2/functional/_geometry.py:116: note: Perhaps you meant to use a protocol matching the module structure?
- torchvision/transforms/v2/functional/_geometry.py:297: error: Argument "resample" to "resize" of "Image" has incompatible type "int"; expected "Resampling | Literal[0, 1, 2, 3, 4, 5] | None"  [arg-type]
- torchvision/transforms/v2/functional/_color.py:733: error: Module "PIL.Image" is not valid as a type  [valid-type]
- torchvision/transforms/v2/functional/_color.py:733: note: Perhaps you meant to use a protocol matching the module structure?
- torchvision/models/swin_transformer.py:53: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/swin_transformer.py:288: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/swin_transformer.py:370: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/resnet.py:221: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/resnet.py:223: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/maxvit.py:87: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/maxvit.py:90: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/maxvit.py:96: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/maxvit.py:98: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/maxvit.py:178: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/maxvit.py:179: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/inception.py:89: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/inception.py:162: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/inception.py:376: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/inception.py:378: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/googlenet.py:87: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/googlenet.py:88: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/googlenet.py:170: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/googlenet.py:338: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/googlenet.py:339: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/resnet.py:248: error: Unused "type: ignore[arg-type, union-attr]" comment  [unused-ignore]
- torchvision/models/video/resnet.py:447: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/swin_transformer.py:53: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/swin_transformer.py:292: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/quantization/googlenet.py:203: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/quantization/googlenet.py:204: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/detection/backbone_utils.py:243: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_transform.py:113: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_augment.py:114: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_augment.py:115: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_augment.py:234: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_augment.py:282: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:234: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:235: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:236: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:251: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:252: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:253: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:263: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:264: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:265: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/video/mvit.py:344: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/detection/rpn.py:38: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/detection/rpn.py:40: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/detection/_utils.py:382: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/models/detection/_utils.py:486: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_meta.py:23: error: Unused "type: ignore[return-value]" comment  [unused-ignore]
- torchvision/transforms/v2/_meta.py:36: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_geometry.py:265: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_geometry.py:266: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/transforms/v2/_geometry.py:473: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/prototype/models/depth/stereo/raft_stereo.py:456: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/prototype/models/depth/stereo/crestereo.py:335: error: Unused "type: ignore" comment  [unused-ignore]
- torchvision/prototype/models/depth/stereo/crestereo.py:481: error: Unused "type: ignore" comment  [unused-ignore]
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

python-chess (https://github.com/niklasf/python-chess)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

parso (https://github.com/davidhalter/parso)
- parso/python/prefix.py:17: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- parso/python/tree.py:49: error: Module "collections" does not explicitly export attribute "Mapping"  [attr-defined]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

python-sop (https://gitlab.com/dkg/python-sop)
- sop/__init__.py:224: error: Missing type parameters for generic type "_SubParsersAction"  [type-arg]
- sop/__init__.py:387: error: Missing type parameters for generic type "_SubParsersAction"  [type-arg]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

attrs (https://github.com/python-attrs/attrs)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

paroxython (https://github.com/laowantong/paroxython)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration
- paroxython/goodies.py:10: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/flatten_ast.py:319: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/preprocess_source.py:32: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/normalize_predicate.py:5: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/list_programs.py:6: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/list_programs.py:51: error: Incompatible default for argument "relative_path" (default has type "None", argument has type "Path")  [assignment]
- paroxython/list_programs.py:51: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- paroxython/list_programs.py:51: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- paroxython/filter_programs.py:20: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/derived_labels_db.py:84: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/recommend_programs.py:36: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/recommend_programs.py:160: error: Incompatible types in assignment (expression has type "str", variable has type "Operation")  [assignment]
- paroxython/parse_program.py:9: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/parse_program.py:240: error: Incompatible types in assignment (expression has type "Callable[[str, int, int, bool, bool | None, float | None], Scanner[str]]", target has type "Pattern[Any]")  [assignment]
- paroxython/parse_program.py:288: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/parse_program.py:297: error: "Pattern[Any]" not callable  [operator]
- paroxython/label_programs.py:6: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/cli_recommend.py:83: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/map_taxonomy.py:113: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/map_taxonomy.py:178: error: Argument 1 to "append" of "list" has incompatible type "tuple[regex.regex.Pattern[str], TaxonPattern]"; expected "tuple[re.Pattern[Any], TaxonPattern]"  [arg-type]
- paroxython/make_db.py:12: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/cli.py:24: error: Unused "type: ignore" comment  [unused-ignore]
- paroxython/cli.py:25: error: Unused "type: ignore" comment  [unused-ignore]

bidict (https://github.com/jab/bidict)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

pylox (https://github.com/sco1/pylox)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration
- tool/generate_tests.py:43: error: Untyped decorator makes function "main" untyped  [misc]
- tool/generate_ast.py:178: error: Untyped decorator makes function "main" untyped  [misc]
- tests/include/test_include.py:60: error: Untyped decorator makes function "test_blank_line_in_include" untyped  [misc]
- pylox/ast_printer.py:10: error: Argument 1 to "accept" of "Expr" has incompatible type "AstPrinter"; expected "VisitorProtocol"  [arg-type]
- pylox/ast_printer.py:17: error: Argument 1 to "accept" of "Expr" has incompatible type "AstPrinter"; expected "VisitorProtocol"  [arg-type]
- pylox/ast_printer.py:17: note: Error code "arg-type" not covered by "type: ignore" comment
- pylox/parser.py:468: error: Incompatible return value type (got "Expr", expected "Binary")  [return-value]
- pylox/parser.py:584: error: Missing return statement  [return]
- pylox/containers/array.py:26: error: "dict[Any, Any]" has no attribute "append"  [attr-defined]
- pylox/containers/array.py:39: error: "dict[Any, Any]" has no attribute "appendleft"  [attr-defined]
- pylox/containers/array.py:84: error: All overload variants of "pop" of "dict" require at least one argument  [call-overload]
- pylox/containers/array.py:84: note: Possible overload variants:
- pylox/containers/array.py:84: note:     def pop(self, Any, /) -> Any
- pylox/containers/array.py:84: note:     def pop(self, Any, Any, /) -> Any
- pylox/containers/array.py:84: note:     def [_T] pop(self, Any, _T, /) -> Any | _T
- pylox/containers/array.py:100: error: "dict[Any, Any]" has no attribute "popleft"  [attr-defined]
- pylox/containers/array.py:115: error: "dict[Any, Any]" has no attribute "reverse"  [attr-defined]
- pylox/containers/array.py:133: error: Incompatible types in assignment (expression has type "deque[Any]", variable has type "dict[Any, Any]")  [assignment]
- pylox/containers/array.py:146: error: Incompatible types in assignment (expression has type "type[LoxArray]", variable has type "LoxClass")  [assignment]
- pylox/containers/array.py:147: error: Incompatible types in assignment (expression has type "deque[None]", variable has type "dict[Any, Any]")  [assignment]
- pylox/builtins/py_builtins.py:21: error: Incompatible types in assignment (expression has type "deque[Any]", variable has type "dict[Any, Any]")  [assignment]
- pylox/builtins/py_builtins.py:149: error: Argument 1 to "len" has incompatible type "LoxInstance"; expected "Sized"  [arg-type]
- pylox/builtins/py_builtins.py:175: error: Returning Any from function declared to return "float"  [no-any-return]
- pylox/builtins/py_builtins.py:192: error: Returning Any from function declared to return "float"  [no-any-return]
- pylox/builtins/py_builtins.py:216: error: Returning Any from function declared to return "float"  [no-any-return]
- pylox/builtins/py_builtins.py:326: error: Returning Any from function declared to return "float"  [no-any-return]
- tests/builtins/test_loxarrayize.py:15: error: Untyped decorator makes function "test_lox_arrayize" untyped  [misc]
- pylox/interpreter.py:160: error: Incompatible types in assignment (expression has type "Environment | None", variable has type "Environment")  [assignment]
- pylox/interpreter.py:220: error: Returning Any from function declared to return "Expr"  [no-any-return]
- pylox/interpreter.py:223: error: Returning Any from function declared to return "Expr"  [no-any-return]
- pylox/interpreter.py:225: error: Returning Any from function declared to return "Expr"  [no-any-return]
- pylox/interpreter.py:235: error: Returning Any from function declared to return "float | bool"  [no-any-return]
- pylox/interpreter.py:266: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:282: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:286: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:292: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:297: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:300: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:303: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:306: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:309: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- pylox/interpreter.py:312: error: Returning Any from function declared to return "float | str | None"  [no-any-return]
- tests/interpreter/test_interpreter_helpers.py:18: error: Untyped decorator makes function "test_is_truthy" untyped  [misc]
- tests/interpreter/test_interpreter_helpers.py:32: error: Untyped decorator makes function "test_stringify" untyped  [misc]
- pylox/lox.py:117: error: Untyped decorator makes function "main" untyped  [misc]
- tests/expressions/test_parse.py:15: error: Untyped decorator makes function "test_expression_parsing" untyped  [misc]
- tests/expressions/test_parse.py:16: error: Untyped decorator makes function "test_expression_parsing" untyped  [misc]
- tests/expressions/test_evaluate.py:14: error: Untyped decorator makes function "test_expression_parsing" untyped  [misc]
- tests/expressions/test_evaluate.py:15: error: Untyped decorator makes function "test_expression_parsing" untyped  [misc]
- tests/continue/test_while_continue.py:28: error: Untyped decorator makes function "test_while_break" untyped  [misc]
- tests/continue/test_nested_while_continue.py:38: error: Untyped decorator makes function "test_nested_while_break" untyped  [misc]
- tests/continue/test_nested_mixed_continue.py:30: error: Untyped decorator makes function "test_nested_mixed_break" untyped  [misc]
- tests/continue/test_nested_for_continue.py:28: error: Untyped decorator makes function "test_nested_for_break" untyped  [misc]
- tests/continue/test_for_continue.py:20: error: Untyped decorator makes function "test_for_continue" untyped  [misc]
- tests/bool/test_not.py:13: error: Untyped decorator makes function "test_not" untyped  [misc]
- tests/bool/test_equality.py:33: error: Untyped decorator makes function "test_equality" untyped  [misc]

ppb-vector (https://github.com/ppb/ppb-vector)
- ppb_vector/__init__.py:356: error: Unused "type: ignore" comment  [unused-ignore]
- tests/test_typing.py:8: error: Unused "type: ignore" comment  [unused-ignore]
- tests/benchmark.py:13: error: Unused "type: ignore" comment  [unused-ignore]
- tests/benchmark.py:16: error: Unused "type: ignore" comment  [unused-ignore]
- tests/benchmark.py:19: error: Unused "type: ignore" comment  [unused-ignore]
- tests/benchmark.py:20: error: Unused "type: ignore" comment  [unused-ignore]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/semanal.py", line 6550, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/semanal.py", line 2902, in visit_assignment_stmt
+   File "mypy/semanal.py", line 3409, in process_type_annotation
+   File "mypy/semanal.py", line 6222, in defer
+ AssertionError: Must not defer during final iteration

pydantic (https://github.com/samuelcolvin/pydantic)
- pydantic/aliases.py:25: error: Incompatible types in assignment (expression has type "list[str]", variable has type "list[int | str]")  [assignment]
- pydantic/aliases.py:25: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
- pydantic/aliases.py:25: note: Consider using "Sequence" instead, which is covariant
- pydantic/aliases.py:25: error: Argument 1 to "list" has incompatible type "tuple[str | int, ...]"; expected "Iterable[str]"  [arg-type]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/subprocess.pyi:1838: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.9.0
+ note: use --pdb to drop into pdb
- pydantic/_internal/_validators.py:125: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_forward_ref.py:20: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_forward_ref.py:23: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/errors.py:114: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/typing.py:47: error: Cannot assign to a type  [misc]
- pydantic/v1/typing.py:47: error: Incompatible types in assignment (expression has type "tuple[()]", variable has type "type[GenericAlias]")  [assignment]
- pydantic/v1/typing.py:50: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/typing.py:53: error: Cannot assign to a type  [misc]
- pydantic/v1/typing.py:53: error: Incompatible types in assignment (expression has type "tuple[()]", variable has type "type[UnionType]")  [assignment]
- pydantic/v1/typing.py:157: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/typing.py:252: error: Module has no attribute "_GenericAlias"  [attr-defined]
- pydantic/v1/typing.py:275: error: "classmethod" expects 3 type arguments, but 1 given  [type-arg]
- pydantic/v1/validators.py:539: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/validators.py:614: error: No overload variant of "NamedTuple" matches argument type "dict[str, Any]"  [call-overload]
- pydantic/v1/validators.py:614: note: Possible overload variants:
- pydantic/v1/validators.py:614: note:     def __init__(self, str, Iterable[tuple[str, Any]], /) -> NamedTupleT
- pydantic/v1/validators.py:614: note:     def __init__(self, str, None = ..., /, **kwargs: Any) -> NamedTupleT
- pydantic/v1/color.py:199: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/class_validators.py:282: error: Function "f" could always be true in boolean context  [truthy-function]
- pydantic/v1/types.py:309: error: Incompatible default for argument "gt" (default has type "None", argument has type "float")  [assignment]
- pydantic/v1/types.py:309: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:309: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:310: error: Incompatible default for argument "ge" (default has type "None", argument has type "float")  [assignment]
- pydantic/v1/types.py:310: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:310: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:311: error: Incompatible default for argument "lt" (default has type "None", argument has type "float")  [assignment]
- pydantic/v1/types.py:311: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:311: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:312: error: Incompatible default for argument "le" (default has type "None", argument has type "float")  [assignment]
- pydantic/v1/types.py:312: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:312: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:313: error: Incompatible default for argument "multiple_of" (default has type "None", argument has type "float")  [assignment]
- pydantic/v1/types.py:313: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:313: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:486: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/types.py:528: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/types.py:575: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/types.py:624: error: Incompatible default for argument "unique_items" (default has type "None", argument has type "bool")  [assignment]
- pydantic/v1/types.py:624: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:624: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:704: error: Unsupported operand types for >= ("Literal['n']" and "int")  [operator]
- pydantic/v1/types.py:704: error: Unsupported operand types for >= ("Literal['N']" and "int")  [operator]
- pydantic/v1/types.py:704: error: Unsupported operand types for >= ("Literal['F']" and "int")  [operator]
- pydantic/v1/types.py:704: note: Left operand is of type "Literal['n', 'N', 'F'] | int"
- pydantic/v1/types.py:706: error: Unsupported operand types for + ("int" and "Literal['n']")  [operator]
- pydantic/v1/types.py:706: error: Unsupported operand types for + ("int" and "Literal['N']")  [operator]
- pydantic/v1/types.py:706: error: Unsupported operand types for + ("int" and "Literal['F']")  [operator]
- pydantic/v1/types.py:706: note: Right operand is of type "Literal['n', 'N', 'F'] | int"
- pydantic/v1/types.py:714: error: Argument 1 to "abs" has incompatible type "Literal['n', 'N', 'F'] | int"; expected "SupportsAbs[int]"  [arg-type]
- pydantic/v1/types.py:715: error: Argument 1 to "abs" has incompatible type "Literal['n', 'N', 'F'] | int"; expected "SupportsAbs[int]"  [arg-type]
- pydantic/v1/types.py:718: error: Argument 1 to "abs" has incompatible type "Literal['n', 'N', 'F'] | int"; expected "SupportsAbs[int]"  [arg-type]
- pydantic/v1/types.py:737: error: Incompatible default for argument "gt" (default has type "None", argument has type "Decimal")  [assignment]
- pydantic/v1/types.py:737: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:737: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:738: error: Incompatible default for argument "ge" (default has type "None", argument has type "Decimal")  [assignment]
- pydantic/v1/types.py:738: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:738: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:739: error: Incompatible default for argument "lt" (default has type "None", argument has type "Decimal")  [assignment]
- pydantic/v1/types.py:739: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:739: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:740: error: Incompatible default for argument "le" (default has type "None", argument has type "Decimal")  [assignment]
- pydantic/v1/types.py:740: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:740: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:743: error: Incompatible default for argument "multiple_of" (default has type "None", argument has type "Decimal")  [assignment]
- pydantic/v1/types.py:743: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:743: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:1198: error: Incompatible default for argument "gt" (default has type "None", argument has type "date")  [assignment]
- pydantic/v1/types.py:1198: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:1198: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:1199: error: Incompatible default for argument "ge" (default has type "None", argument has type "date")  [assignment]
- pydantic/v1/types.py:1199: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:1199: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:1200: error: Incompatible default for argument "lt" (default has type "None", argument has type "date")  [assignment]
- pydantic/v1/types.py:1200: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:1200: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/types.py:1201: error: Incompatible default for argument "le" (default has type "None", argument has type "date")  [assignment]
- pydantic/v1/types.py:1201: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/types.py:1201: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/networks.py:237: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/networks.py:237: error: Unsupported type "dict[str, str]" for ** expansion in TypedDict  [typeddict-item]
- pydantic/v1/networks.py:237: note: Error code "typeddict-item" not covered by "type: ignore" comment
- pydantic/v1/networks.py:680: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/parse.py:18: error: Incompatible default for argument "content_type" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/parse.py:18: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/parse.py:18: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/parse.py:20: error: Incompatible default for argument "proto" (default has type "None", argument has type "Protocol")  [assignment]
- pydantic/v1/parse.py:20: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/parse.py:20: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/parse.py:50: error: Incompatible default for argument "content_type" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/parse.py:50: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/parse.py:50: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/parse.py:52: error: Incompatible default for argument "proto" (default has type "None", argument has type "Protocol")  [assignment]
- pydantic/v1/parse.py:52: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/parse.py:52: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/json.py:38: error: Unsupported operand types for >= ("Literal['n']" and "int")  [operator]
- pydantic/v1/json.py:38: error: Unsupported operand types for >= ("Literal['N']" and "int")  [operator]
- pydantic/v1/json.py:38: error: Unsupported operand types for >= ("Literal['F']" and "int")  [operator]
- pydantic/v1/json.py:38: note: Left operand is of type "Literal['n', 'N', 'F'] | int"
- pydantic/v1/tools.py:45: error: Incompatible default for argument "content_type" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/tools.py:45: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/tools.py:45: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/tools.py:47: error: Incompatible default for argument "proto" (default has type "None", argument has type "Protocol")  [assignment]
- pydantic/v1/tools.py:47: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/tools.py:47: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/tools.py:67: error: Incompatible default for argument "content_type" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/tools.py:67: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/tools.py:67: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/tools.py:69: error: Incompatible default for argument "proto" (default has type "None", argument has type "Protocol")  [assignment]
- pydantic/v1/tools.py:69: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/tools.py:69: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:533: error: Incompatible default for argument "content_type" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/main.py:533: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:533: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:535: error: Incompatible default for argument "proto" (default has type "None", argument has type "Protocol")  [assignment]
- pydantic/v1/main.py:535: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:535: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:556: error: Incompatible default for argument "content_type" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/main.py:556: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:556: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:558: error: Incompatible default for argument "proto" (default has type "None", argument has type "Protocol")  [assignment]
- pydantic/v1/main.py:558: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:558: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:929: error: Incompatible default for argument "__validators__" (default has type "None", argument has type "dict[str, classmethod[Any, Any, Any]]")  [assignment]
- pydantic/v1/main.py:929: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:929: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:930: error: Incompatible default for argument "__cls_kwargs__" (default has type "None", argument has type "dict[str, Any]")  [assignment]
- pydantic/v1/main.py:930: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:930: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:943: error: Incompatible default for argument "__validators__" (default has type "None", argument has type "dict[str, classmethod[Any, Any, Any]]")  [assignment]
- pydantic/v1/main.py:943: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:943: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:944: error: Incompatible default for argument "__cls_kwargs__" (default has type "None", argument has type "dict[str, Any]")  [assignment]
- pydantic/v1/main.py:944: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:944: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:956: error: Incompatible default for argument "__validators__" (default has type "None", argument has type "dict[str, classmethod[Any, Any, Any]]")  [assignment]
- pydantic/v1/main.py:956: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:956: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:957: error: Incompatible default for argument "__cls_kwargs__" (default has type "None", argument has type "dict[str, Any]")  [assignment]
- pydantic/v1/main.py:957: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:957: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/main.py:1031: error: Incompatible default for argument "cls" (default has type "None", argument has type "type[BaseModel] | type[Dataclass]")  [assignment]
- pydantic/v1/main.py:1031: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/main.py:1031: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/env_settings.py:226: error: Argument "encoding" to "read_env_file" has incompatible type "str | None"; expected "str"  [arg-type]
- pydantic/v1/env_settings.py:327: error: Incompatible default for argument "encoding" (default has type "None", argument has type "str")  [assignment]
- pydantic/v1/env_settings.py:327: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- pydantic/v1/env_settings.py:327: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- pydantic/v1/dataclasses.py:214: error: No overload variant of "dataclass" matches argument types "type[Any]", "bool", "bool", "bool", "bool", "bool", "bool", "bool"  [call-overload]
- pydantic/v1/dataclasses.py:214: note: Possible overload variants:
- pydantic/v1/dataclasses.py:214: note:     def dataclass(None, /) -> Callable[[type[_T]], type[_T]]
- pydantic/v1/dataclasses.py:214: note:     def [_T] dataclass(type[_T], /) -> type[_T]
- pydantic/v1/dataclasses.py:214: note:     def dataclass(*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ..., match_args: bool = ..., kw_only: bool = ..., slots: bool = ..., weakref_slot: bool = ...) -> Callable[[type[_T]], type[_T]]
- pydantic/plugin/_schema_validator.py:47: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_docs_extraction.py:50: error: Missing return statement  [return]
- pydantic/_internal/_docs_extraction.py:98: error: Incompatible types in assignment (expression has type "list[str] | None", variable has type "list[str]")  [assignment]
- pydantic/v1/mypy.py:71: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:143: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:168: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:208: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:218: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:504: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:511: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/mypy.py:944: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/v1/generics.py:33: error: Module "typing" has no attribute "_UnionGenericAlias"  [attr-defined]
- pydantic/v1/generics.py:124: error: No overload variant of "create_model" matches argument types "str", "str", "tuple[Any, ...]", "None", "dict[str, classmethod[Any, Any, Any]]", "None", "dict[Any, tuple[DeferredType, FieldInfo]]"  [call-overload]
- pydantic/v1/generics.py:124: note: Possible overload variants:
- pydantic/v1/generics.py:124: note:     def create_model(str, /, *, __config__: type[BaseConfig] | None = ..., __base__: None = ..., __module__: str = ..., __validators__: dict[str, classmethod[Any, Any, Any]] = ..., __cls_kwargs__: dict[str, Any] = ..., **field_definitions: Any) -> type[BaseModel]
- pydantic/v1/generics.py:124: note:     def [Model <: BaseModel] create_model(str, /, *, __config__: type[BaseConfig] | None = ..., __base__: type[Model] | tuple[type[Model], ...], __module__: str = ..., __validators__: dict[str, classmethod[Any, Any, Any]] = ..., __cls_kwargs__: dict[str, Any] = ..., **field_definitions: Any) -> type[Model]
- pydantic/deprecated/parse.py:49: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/deprecated/parse.py:53: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/config.py:978: error: "_TypeT" has no attribute "__pydantic_config__"  [attr-defined]
- pydantic/_internal/_core_metadata.py:64: error: Incompatible return value type (got "dict[Any, Any]", expected "CoreMetadata")  [return-value]
- pydantic/_internal/_core_metadata.py:87: error: Incompatible types in assignment (expression has type "dict[str, object]", variable has type "CoreMetadata")  [assignment]
- pydantic/_internal/_config.py:135: error: TypedDict key must be a string literal; expected one of ("title", "str_to_lower", "str_to_upper", "str_strip_whitespace", "str_min_length", ...)  [literal-required]
- pydantic/deprecated/config.py:22: error: TypedDict key must be a string literal; expected one of ("title", "str_to_lower", "str_to_upper", "str_strip_whitespace", "str_min_length", ...)  [literal-required]
- pydantic/_internal/_typing_extra.py:64: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_typing_extra.py:69: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_typing_extra.py:149: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_mock_val_ser.py:78: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_mock_val_ser.py:91: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_mock_val_ser.py:122: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_mock_val_ser.py:135: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_utils.py:154: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_utils.py:313: error: "Obj" has no attribute "copy"  [attr-defined]
- pydantic/_internal/_fields.py:74: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_fields.py:88: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_core_utils.py:201: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_core_utils.py:209: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_core_utils.py:215: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_core_utils.py:218: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_core_utils.py:508: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_known_annotated_metadata.py:189: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_known_annotated_metadata.py:326: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generics.py:73: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generics.py:233: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generics.py:323: error: Value of type "type[BaseModel]" is not indexable  [index]
- pydantic/_internal/_decorators.py:184: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], ReturnType] | Any", expected "PydanticDescriptorProxy[ReturnType]")  [return-value]
- pydantic/_internal/_decorators.py:285: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_decorators.py:740: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:67: error: Parameter 1 of Literal[...] cannot be of type "Any"  [valid-type]
- pydantic/json_schema.py:325: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:452: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:462: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:499: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:1760: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:1839: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:2261: error: Incompatible types in assignment (expression has type "list[str]", variable has type "dict_keys[str, Any]")  [assignment]
- pydantic/json_schema.py:2267: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/json_schema.py:2269: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/types.py:229: error: Incompatible return value type (got "object", expected "type[int]")  [return-value]
- pydantic/types.py:475: error: Incompatible return value type (got "object", expected "type[float]")  [return-value]
- pydantic/types.py:663: error: Incompatible return value type (got "object", expected "type[bytes]")  [return-value]
- pydantic/types.py:786: error: Incompatible return value type (got "object", expected "type[str]")  [return-value]
- pydantic/types.py:821: error: Incompatible return value type (got "object", expected "type[set[HashableItemType]]")  [return-value]
- pydantic/types.py:821: error: Variable "item_type" is not valid as a type  [valid-type]
- pydantic/types.py:821: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pydantic/types.py:837: error: Incompatible return value type (got "object", expected "type[frozenset[HashableItemType]]")  [return-value]
- pydantic/types.py:837: error: Variable "item_type" is not valid as a type  [valid-type]
- pydantic/types.py:837: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pydantic/types.py:872: error: Incompatible return value type (got "object", expected "type[list[AnyItemType]]")  [return-value]
- pydantic/types.py:872: error: Variable "item_type" is not valid as a type  [valid-type]
- pydantic/types.py:872: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pydantic/types.py:1093: error: Incompatible return value type (got "object", expected "type[Decimal]")  [return-value]
- pydantic/types.py:1128: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/types.py:1555: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/types.py:1575: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/types.py:2059: error: Incompatible return value type (got "object", expected "type[date]")  [return-value]
- pydantic/networks.py:516: error: Argument 1 to "validate_email" has incompatible type "Self | str"; expected "str"  [arg-type]
- pydantic/networks.py:558: error: "__new__" must return a class instance (got "IPv4Address | IPv6Address")  [misc]
- pydantic/networks.py:574: error: Need type annotation for "field_schema" (hint: "field_schema: Dict[<type>, <type>] = ...")  [var-annotated]
- pydantic/networks.py:598: error: "__new__" must return a class instance (got "IPv4Interface | IPv6Interface")  [misc]
- pydantic/networks.py:614: error: Need type annotation for "field_schema" (hint: "field_schema: Dict[<type>, <type>] = ...")  [var-annotated]
- pydantic/networks.py:638: error: "__new__" must return a class instance (got "IPv4Network | IPv6Network")  [misc]
- pydantic/networks.py:656: error: Need type annotation for "field_schema" (hint: "field_schema: Dict[<type>, <type>] = ...")  [var-annotated]
- pydantic/color.py:103: error: Need type annotation for "field_schema" (hint: "field_schema: Dict[<type>, <type>] = ...")  [var-annotated]
- pydantic/_internal/_generate_schema.py:108: error: List item 1 has incompatible type "<typing special form>"; expected "type"  [list-item]
- pydantic/_internal/_generate_schema.py:610: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:650: error: Argument "ref_mode" to "CallbackGetCoreSchemaHandler" has incompatible type "str"; expected "Literal['to-def', 'unpack']"  [arg-type]
- pydantic/_internal/_generate_schema.py:727: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:958: error: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "_ClassInfo"  [arg-type]
- pydantic/_internal/_generate_schema.py:1009: error: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "_ClassInfo"  [arg-type]
- pydantic/_internal/_generate_schema.py:1118: error: Incompatible types in assignment (expression has type "str | None", variable has type "list[str | int] | list[list[str | int]]")  [assignment]
- pydantic/_internal/_generate_schema.py:1174: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:1351: error: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "_ClassInfo"  [arg-type]
- pydantic/_internal/_generate_schema.py:1352: error: "AliasGenerator" not callable  [operator]
- pydantic/_internal/_generate_schema.py:1352: error: "None" not callable  [misc]
- pydantic/_internal/_generate_schema.py:1597: error: Argument 2 to "_generate_parameter_schema" of "GenerateSchema" has incompatible type "object"; expected "type[Any]"  [arg-type]
- pydantic/_internal/_generate_schema.py:1638: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:1821: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:1829: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:1941: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:1974: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:2022: error: Invalid index type "tuple[Literal['before', 'after', 'wrap', 'plain'], str]" for "Mapping[tuple[Any, Literal['no-info', 'with-info']], Callable[[Callable[..., Any], Any, str | None], Any]]"; expected type "tuple[Any, Literal['no-info', 'with-info']]"  [index]
- pydantic/_internal/_generate_schema.py:2061: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_generate_schema.py:2085: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:373: error: Incompatible types in assignment (expression has type "object", variable has type "type[Any]")  [assignment]
- pydantic/fields.py:435: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:575: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:767: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:773: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:803: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:999: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:1005: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/fields.py:1006: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_validate_call.py:78: error: Incompatible types in assignment (expression has type "None", variable has type "Callable[[Awaitable[Any]], Coroutine[Any, Any, None]]")  [assignment]
- pydantic/_internal/_validate_call.py:82: error: Function "__return_pydantic_validator__" could always be true in boolean context  [truthy-function]
- pydantic/_internal/_std_types_schema.py:668: error: Missing return statement  [return]
- pydantic/_internal/_model_construction.py:303: error: Missing return statement  [return]
- pydantic/_internal/_model_construction.py:443: error: Cannot assign to a method  [method-assign]
- pydantic/_internal/_model_construction.py:451: error: "object" not callable  [operator]
- pydantic/_internal/_model_construction.py:457: error: "object" not callable  [operator]
- pydantic/_internal/_dataclasses.py:131: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_dataclasses.py:144: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_dataclasses.py:145: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_dataclasses.py:146: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:135: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:136: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:137: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:165: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:178: error: "Callable[[BaseModel, KwArg(Any)], None]" has no attribute "__pydantic_base_init__"  [attr-defined]
- pydantic/main.py:420: error: Argument 2 to "issubclass" has incompatible type "<typing special form>"; expected "_ClassInfo"  [arg-type]
- pydantic/main.py:972: error: Invalid self argument "BaseModel" to attribute function "__repr_name__" with type "Callable[[Representation], str]"  [misc]
- pydantic/main.py:972: error: Invalid self argument "BaseModel" to attribute function "__repr_str__" with type "Callable[[Representation, str], str]"  [misc]
- pydantic/main.py:1000: error: Invalid self argument "BaseModel" to attribute function "__repr_str__" with type "Callable[[Representation, str], str]"  [misc]
- pydantic/main.py:1056: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:1057: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/main.py:1132: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/dataclasses.py:40: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/dataclasses.py:46: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/dataclasses.py:218: error: Argument 2 to "issubclass" has incompatible type "<typing special form>"; expected "_ClassInfo"  [arg-type]
- pydantic/dataclasse

... (truncated 19280 lines) ...

github-actions[bot] avatar Mar 21 '24 17:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[ContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[ContextManager[Any]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "ContextManager[PrefectObjectRegistry]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/__init__.py:176: error: Incompatible return value type (got "_TimeoutContext", expected "ContextManager[None]")  [return-value]
+ pymongo/__init__.py:176: note: Following member(s) of "_TimeoutContext" have conflicts:
+ pymongo/__init__.py:176: note:     Expected:
+ pymongo/__init__.py:176: note:         def __enter__(self) -> None
+ pymongo/__init__.py:176: note:     Got:
+ pymongo/__init__.py:176: note:         def __enter__(self) -> _TimeoutContext

github-actions[bot] avatar Mar 21 '24 17:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

github-actions[bot] avatar Mar 21 '24 17:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

kopf (https://github.com/nolar/kopf)
+ kopf/_core/engines/admission.py:266: error: Parameterized generics cannot be used with class or instance checks  [misc]

github-actions[bot] avatar Mar 21 '24 17:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any, bool | None]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry, bool | None]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

kopf (https://github.com/nolar/kopf)
+ kopf/_core/engines/admission.py:266: error: Parameterized generics cannot be used with class or instance checks  [misc]

github-actions[bot] avatar Mar 23 '24 12:03 github-actions[bot]

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

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/_internal/concurrency/api.py:167: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
+ src/prefect/_internal/concurrency/api.py:167: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[ContextManager[Any]] | None = ...) -> Coroutine[Any, Any, Awaitable[T]]
- src/prefect/_internal/concurrency/api.py:225: error: Missing return statement  [return]
- src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[AbstractContextManager[Any]] | None = ...) -> Awaitable[T]
+ src/prefect/_internal/concurrency/api.py:225: note:          def [T] wait_for_call_in_loop_thread(Callable[[], Awaitable[T]] | Callable[[], Awaitable[T]] | Call[Awaitable[T]], /, timeout: float | None = ..., done_callbacks: Iterable[Call[Any]] | None = ..., contexts: Iterable[ContextManager[Any]] | None = ...) -> Awaitable[T]
- src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "AbstractContextManager[PrefectObjectRegistry]")  [assignment]
+ src/prefect/context.py:570: error: Incompatible types in assignment (expression has type "None", variable has type "ContextManager[PrefectObjectRegistry]")  [assignment]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:367: error: Unused "type: ignore" comment  [unused-ignore]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/__init__.py:176: error: Incompatible return value type (got "_TimeoutContext", expected "ContextManager[None]")  [return-value]
+ pymongo/__init__.py:176: note: Following member(s) of "_TimeoutContext" have conflicts:
+ pymongo/__init__.py:176: note:     Expected:
+ pymongo/__init__.py:176: note:         def __enter__(self) -> None
+ pymongo/__init__.py:176: note:     Got:
+ pymongo/__init__.py:176: note:         def __enter__(self) -> _TimeoutContext

github-actions[bot] avatar Mar 23 '24 15:03 github-actions[bot]

The new primer hit seems fine to me. I think the only reason that previously didn't error is because AbstractContextManager[Any] was in the MRO, which used to be an alias for ContextManager[Any], so mypy took a shortcut and didn't attempt to structurally match, because the simpler subclassing check already told it everything is fine (due to Any). This could actually be considered a mypy bug. I'm not sure how I feel about subclasses that override all occurrences of a TypeVar, that was previously bound to Any with a concrete type still behaving as if the type was Any in some scenarios... Although I guess that's just the price you pay if you omit a type parameter when subclassing (or set it to Any)

Daverball avatar Mar 23 '24 15:03 Daverball

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

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/__init__.py:368: error: Unused "type: ignore" comment  [unused-ignore]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/__init__.py:176: error: Incompatible return value type (got "_TimeoutContext", expected "ContextManager[None]")  [return-value]
+ pymongo/__init__.py:176: note: Following member(s) of "_TimeoutContext" have conflicts:
+ pymongo/__init__.py:176: note:     Expected:
+ pymongo/__init__.py:176: note:         def __enter__(self) -> None
+ pymongo/__init__.py:176: note:     Got:
+ pymongo/__init__.py:176: note:         def __enter__(self) -> _TimeoutContext

github-actions[bot] avatar Apr 21 '24 12:04 github-actions[bot]