Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove union simplification during inference #18067

Closed
wants to merge 1 commit into from

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Oct 29, 2024

This is very hot and I'm curious how necessary it is, especially given the comment

Copy link
Contributor

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

websockets (https://github.com/aaugustin/websockets)
+ src/websockets/asyncio/connection.py:287: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/asyncio/connection.py:355: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/asyncio/connection.py:427: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/asyncio/connection.py:613: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/asyncio/connection.py:891: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/asyncio/connection.py:907: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/asyncio/server.py:484: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:624: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:777: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:790: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:914: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:928: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:955: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/protocol.py:1356: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ src/websockets/legacy/server.py:813: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]

operator (https://github.com/canonical/operator)
- ops/_private/harness.py:2256: error: Value expression in dictionary comprehension has incompatible type "str | int | float | None"; expected type "str | int | float"  [misc]
+ ops/_private/harness.py:2256: error: Value expression in dictionary comprehension has incompatible type "str | int | float | None"; expected type "str | int | float | bool"  [misc]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/context/menu.py:194: error: Argument "default" to "resolve_to_member" of "MenuContext" has incompatible type "None"; expected "User"  [arg-type]
+ tanjun/context/menu.py:194: error: Argument "default" to "resolve_to_member" of "MenuContext" has incompatible type "None"; expected "Union[User, Member]"  [arg-type]

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/_acompat.py:90: error: Argument 1 to "shield" has incompatible type "Future[list[Any]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ psycopg_pool/psycopg_pool/_acompat.py:140: error: Argument 1 to "shield" has incompatible type "Future[list[Any]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ tests/test_pipeline_async.py:595: error: Need type annotation for "cursors"  [var-annotated]
+ tests/test_pipeline_async.py:596: error: Argument 1 to "wait_for" has incompatible type "Future[list[Any]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_internal/concurrency/api.py:142: error: Argument 1 to "call_soon_in_loop_thread" of "_base" has incompatible type "Call[Awaitable[T]]"; expected "Callable[[], Awaitable[Never]] | Call[Awaitable[Never]]"  [arg-type]
+ src/prefect/_internal/concurrency/api.py:159: error: Argument 1 to "call_soon_in_new_thread" of "_base" has incompatible type "Call[T]"; expected "Callable[[], Never] | Call[Never]"  [arg-type]
+ src/prefect/_internal/concurrency/api.py:192: error: Argument 1 to "call_soon_in_loop_thread" of "_base" has incompatible type "Call[Awaitable[T]]"; expected "Callable[[], Awaitable[Never]] | Call[Awaitable[Never]]"  [arg-type]
+ src/prefect/_internal/concurrency/api.py:211: error: Argument 1 to "call_soon_in_new_thread" of "_base" has incompatible type "Call[T]"; expected "Callable[[], Never] | Call[Never]"  [arg-type]
+ src/prefect/deployments/runner.py:756: error: Need type annotation for "flow"  [var-annotated]
+ src/prefect/deployments/runner.py:757: error: Argument 1 to "wait_for_call_in_new_thread" of "from_async" has incompatible type "Call[Flow[Any, Any]]"; expected "Callable[[], Never] | Call[Never]"  [arg-type]
+ src/prefect/runner/runner.py:1321: error: Argument 1 to "call_in_new_thread" of "from_async" has incompatible type "Call[None]"; expected "Callable[[], Never] | Call[Never]"  [arg-type]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/frame.py:9626: error: Argument 2 to "stack_v3" has incompatible type "list[Hashable]"; expected "list[int]"  [arg-type]
+ pandas/core/indexes/multi.py:3273: error: Argument "level" to "_get_loc_level" of "MultiIndex" has incompatible type "int | list[Hashable]"; expected "int | list[int]"  [arg-type]

aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[object]"  [type-var]

boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/boost.py:193: error: Argument 1 to "wait_for" has incompatible type "Future[None]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]

black (https://github.com/psf/black)
+ src/black/concurrency.py:189:31: error: Argument 1 to "gather" has incompatible type "*list[Future[bool]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/lib/column_config_utils_test.py:537:21: error: Dict entry 0 has incompatible type "str": "str"; expected "str": "ColumnConfig"  [dict-item]
+ lib/tests/streamlit/elements/lib/column_config_utils_test.py:537:21: error: Dict entry 0 has incompatible type "Literal['label']": "str"; expected "Union[Literal['_index'], str]": "ColumnConfig"  [dict-item]

colour (https://github.com/colour-science/colour)
- colour/hints/__init__.py:606: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | int | float | complex | str | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
+ colour/hints/__init__.py:606: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
- colour/hints/__init__.py:608: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | int | float | complex | str | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
+ colour/hints/__init__.py:608: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
- colour/hints/__init__.py:617: error: Argument 1 to "number_or_arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | int | float | complex | str | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
+ colour/hints/__init__.py:617: error: Argument 1 to "number_or_arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
- colour/hints/__init__.py:619: error: Argument 1 to "number_or_arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | int | float | complex | str | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
+ colour/hints/__init__.py:619: error: Argument 1 to "number_or_arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
- colour/hints/__init__.py:628: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | int | float | complex | str | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
+ colour/hints/__init__.py:628: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
- colour/hints/__init__.py:630: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | int | float | complex | str | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
+ colour/hints/__init__.py:630: error: Argument 1 to "arraylike" has incompatible type "list[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]

kopf (https://github.com/nolar/kopf)
+ kopf/_core/actions/invocation.py:139: error: Argument 1 to "shield" has incompatible type "Future[object]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ kopf/_core/reactor/queueing.py:238: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ kopf/_core/reactor/queueing.py:245: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_indexes.py:182: error: Need type annotation for "idx"  [var-annotated]

paasta (https://github.com/yelp/paasta)
+ paasta_tools/instance/kubernetes.py:722: error: Argument 1 to "gather" has incompatible type "*List[Future[Dict[str, Any]]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ paasta_tools/instance/kubernetes.py:857: error: Argument 1 to "gather" has incompatible type "Task[List[Dict[Any, Any]]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ paasta_tools/instance/kubernetes.py:857: error: Argument 2 to "gather" has incompatible type "Task[List[Dict[str, Any]]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ paasta_tools/instance/kubernetes.py:1005: error: Need type annotation for "tail_lines"  [var-annotated]
+ paasta_tools/instance/kubernetes.py:1005: error: Need type annotation for "previous_tail_lines"  [var-annotated]
+ paasta_tools/instance/kubernetes.py:1006: error: Argument 1 to "gather" has incompatible type "Task[MutableMapping[str, Any]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ paasta_tools/instance/kubernetes.py:1007: error: Argument 2 to "gather" has incompatible type "Task[MutableMapping[str, Any]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ paasta_tools/instance/kubernetes.py:1111: error: Argument 1 to "gather" has incompatible type "*List[Future[Mapping[str, Any]]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ paasta_tools/cli/cmds/mark_for_deployment.py:1888: error: Need type annotation for "coro"  [var-annotated]
+ paasta_tools/cli/cmds/mark_for_deployment.py:1889: error: Argument 1 to "as_completed" has incompatible type "List[Task[Tuple[str, str]]]"; expected "Iterable[Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]]"  [arg-type]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/typing/_builds_overloads.py:238: error: Overloaded function implementation does not accept all possible arguments of signature 3  [misc]
- src/hydra_zen/typing/_builds_overloads.py:238: error: Overloaded function implementation does not accept all possible arguments of signature 5  [misc]
- src/hydra_zen/typing/_builds_overloads.py:238: error: Overloaded function implementation does not accept all possible arguments of signature 7  [misc]
- src/hydra_zen/typing/_builds_overloads.py:238: error: Overloaded function implementation does not accept all possible arguments of signature 9  [misc]
- src/hydra_zen/typing/_builds_overloads.py:477: error: Overloaded function implementation does not accept all possible arguments of signature 2  [misc]
- src/hydra_zen/typing/_builds_overloads.py:477: error: Overloaded function implementation does not accept all possible arguments of signature 4  [misc]
- src/hydra_zen/typing/_builds_overloads.py:477: error: Overloaded function implementation does not accept all possible arguments of signature 6  [misc]
- src/hydra_zen/typing/_builds_overloads.py:477: error: Overloaded function implementation does not accept all possible arguments of signature 8  [misc]
- src/hydra_zen/typing/_builds_overloads.py:477: error: Overloaded function implementation does not accept all possible arguments of signature 10  [misc]
- src/hydra_zen/typing/_builds_overloads.py:663: error: Overloaded function implementation does not accept all possible arguments of signature 1  [misc]
- src/hydra_zen/typing/_builds_overloads.py:663: error: Overloaded function implementation does not accept all possible arguments of signature 5  [misc]

dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/broadcast_processor/broadcast_processor.py:196:35: error: Argument 1 to "gather" has incompatible type "*Set[Task[None]]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/test/wsgi_test.py:74: error: Need type annotation for "resps"  [var-annotated]
+ tornado/test/wsgi_test.py:75: error: Argument 1 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:76: error: Argument 2 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:84: error: Need type annotation for "resps"  [var-annotated]
+ tornado/test/wsgi_test.py:85: error: Argument 1 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:86: error: Argument 2 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:103: error: Need type annotation for "resps"  [var-annotated]
+ tornado/test/wsgi_test.py:104: error: Argument 1 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:105: error: Argument 2 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:112: error: Need type annotation for "resps"  [var-annotated]
+ tornado/test/wsgi_test.py:113: error: Argument 1 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]
+ tornado/test/wsgi_test.py:114: error: Argument 2 to "gather" has incompatible type "Future[HTTPResponse]"; expected "Union[Future[Never], Generator[Any, None, Never], Awaitable[Never]]"  [arg-type]

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/verify.py: note: In function "delete_unowned_files":
+ src/bandersnatch/verify.py:106: error: Argument 1 to "gather" has incompatible type "*list[Future[None]]"; expected "Future[Never] | Generator[Any, None, Never] | Awaitable[Never]"  [arg-type]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/gateway.py:552: error: Argument 1 to "gather" has incompatible type "*set[Task[PollAuthSessionStatusResponse] | Future[None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ steam/gateway.py:921: error: "Never" has no attribute "__iter__" (not iterable)  [attr-defined]
+ steam/gateway.py:921: error: Argument 1 to "wait_for" has incompatible type "Future[list[Never]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ steam/client.py:535: error: Argument 1 to "gather" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ steam/client.py:535: error: Argument 2 to "gather" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/state.py:606: error: Argument 1 to "wait_for" has incompatible type "Future[list[Member]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ discord/state.py:1854: error: Argument 1 to "gather" has incompatible type "*dict_values[int, Task[None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ discord/state.py:1888: error: Argument 1 to "wait_for" has incompatible type "Future[list[Member]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/base_protocol.py:96:30: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ aiohttp/web_request.py:242:27: error: Need type annotation for "new_headers"  [var-annotated]
+ aiohttp/web_request.py:242:27: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-var-annotated for more info
+ aiohttp/web_request.py:242:44: error: Argument 1 to "CIMultiDictProxy" has incompatible type "CIMultiDict[str]"; expected "MultiMapping[Never] | MutableMultiMapping[Never]"  [arg-type]
+ aiohttp/web_fileresponse.py:357:34: error: Argument 1 to "shield" has incompatible type "Future[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ aiohttp/web_ws.py:296:28: error: Need type annotation for "response_headers"  [var-annotated]
+ aiohttp/web_ws.py:297:13: error: Argument 1 to "CIMultiDict" has incompatible type "dict[istr, str]"; expected "Mapping[str, Never] | Mapping[istr, Never] | dict[str, Never] | dict[istr, Never] | MultiMapping[Never] | Iterable[tuple[str, Never]] | Iterable[tuple[istr, Never]]"  [arg-type]
+ aiohttp/web_protocol.py:316:42: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ aiohttp/test_utils.py:643:36: error: Argument 1 to "CIMultiDictProxy" has incompatible type "CIMultiDict[str]"; expected "MultiMapping[Never] | MutableMultiMapping[Never]"  [arg-type]
+ aiohttp/test_utils.py:644:25: error: Need type annotation for "v"  [var-annotated]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/types/strings.py:969: error: Argument 2 to "StringSQLLike" has incompatible type "Iterable[str | StringValue]"; expected "Value[String, Any]"  [arg-type]
+ ibis/expr/types/strings.py:969: error: Argument 2 to "StringSQLLike" has incompatible type "object"; expected "Value[String, Any]"  [arg-type]
- ibis/expr/types/strings.py:1014: error: Argument 2 to "StringSQLILike" has incompatible type "Iterable[str | StringValue]"; expected "Value[String, Any]"  [arg-type]
+ ibis/expr/types/strings.py:1014: error: Argument 2 to "StringSQLILike" has incompatible type "object"; expected "Value[String, Any]"  [arg-type]
- ibis/backends/flink/ddl.py:96: error: Argument 1 to "promote_list" has incompatible type "str | Sequence[str] | None"; expected "Sequence[None] | None"  [arg-type]

core (https://github.com/home-assistant/core)
+ homeassistant/helpers/trigger.py:348: error: Argument 1 to "gather" has incompatible type "*list[Task[Callable[[], None]]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/trigger.py:358: error: Statement is unreachable  [unreachable]
+ homeassistant/helpers/trigger.py:359: error: Unused "type: ignore" comment  [unused-ignore]
+ homeassistant/config.py:1289: error: Need type annotation for "validated_config"  [var-annotated]
+ homeassistant/config.py:1292: error: Argument 1 to "gather" has incompatible type "*Generator[Task[dict[str, Any] | None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/setup.py:237: error: Need type annotation for "results" (hint: "results: list[<type>] = ...")  [var-annotated]
+ homeassistant/setup.py:238: error: Argument 1 to "gather" has incompatible type "*dict_values[Any, Future[bool]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/setup.py:238: error: Argument 2 to "gather" has incompatible type "*dict_values[str, Future[bool]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/setup.py:462: error: Argument 1 to "gather" has incompatible type "*Generator[Task[None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/integration_platform.py:122: error: Argument 1 to "gather" has incompatible type "*list[Future[Awaitable[None] | None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/integration_platform.py:258: error: Argument 1 to "gather" has incompatible type "*list[Future[None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/config_entries.py:2225: error: Argument 1 to "gather" has incompatible type "*Generator[Task[bool], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/entity_platform.py:373: error: Argument 1 to "gather" has incompatible type "*list[Task[None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/entity_platform.py:1056: error: Argument 1 to "gather" has incompatible type "*list[Task[None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/script.py:1331: error: Argument 1 to "gather" has incompatible type "*Generator[Task[None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/script.py:1351: error: Argument 1 to "gather" has incompatible type "*Generator[Task[None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/helpers/script.py:1826: error: Argument 1 to "shield" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/google_assistant/smart_home.py:254: error: Need type annotation for "execute_results"  [var-annotated]
+ homeassistant/components/google_assistant/smart_home.py:256: error: Argument 1 to "shield" has incompatible type "Future[list[Any]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/schlage/coordinator.py:59: error: Need type annotation for "lock_data" (hint: "lock_data: list[<type>] = ...")  [var-annotated]
+ homeassistant/components/schlage/coordinator.py:60: error: Argument 1 to "gather" has incompatible type "*Generator[Future[LockData], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/matrix/__init__.py:323: error: Need type annotation for "resolved_room"  [var-annotated]
+ homeassistant/components/matrix/__init__.py:323: error: Argument 1 to "as_completed" has incompatible type "list[Task[dict[RoomID | RoomAlias, RoomID]]]"; expected "Iterable[Future[Never] | Awaitable[Never]]"  [arg-type]
+ homeassistant/components/homekit/__init__.py:521: error: Argument 1 to "gather" has incompatible type "*list[Task[bool]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/sonos/__init__.py:325: error: Argument 1 to "gather" has incompatible type "*Generator[Task[None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/mqtt/__init__.py:443: error: Argument 1 to "gather" has incompatible type "*list[Task[None]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/lg_thinq/__init__.py:105: error: Need type annotation for "task_result" (hint: "task_result: list[<type>] = ...")  [var-annotated]
+ homeassistant/components/lg_thinq/__init__.py:105: error: Argument 1 to "gather" has incompatible type "*list[Task[DeviceDataUpdateCoordinator]]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/rest/__init__.py:138: error: Argument 1 to "gather" has incompatible type "*Generator[Task[None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/components/rest/__init__.py:141: error: Argument 1 to "gather" has incompatible type "*Generator[Task[None], None, None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]
+ homeassistant/bootstrap.py:428: error: Argument 1 to "gather" has incompatible type "Task[None]"; expected "Future[Never] | Awaitable[Never]"  [arg-type]

... (truncated 31 lines) ...```

@hauntsaninja
Copy link
Collaborator Author

Comes in at about 1.07x faster on "import torch". There's a useful comment here: #8051 (comment)

Closing for now, but could be interesting to pick up again.

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

Successfully merging this pull request may close these issues.

1 participant