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

Revert "Narrow based on collection containment (#17344)" #17865

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Oct 2, 2024

This reverts commit ed0cd4a.

See #17864 for context. The implementation has some issues, and I'm reverting the PR to unblock the 1.12 release.

Closes #17864. Closes #17841.

This reverts commit ed0cd4a.

See #17864 for context. The implementation has some issues, and I'm
reverting the PR to unblock the 1.12 release.
@JukkaL JukkaL merged commit 329e38e into master Oct 2, 2024
19 checks passed
@JukkaL JukkaL deleted the revert-in-narrow branch October 2, 2024 14:44
Copy link
Contributor

github-actions bot commented Oct 2, 2024

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

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/SelfTest/Signature/test_dss.py:334: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]

pydantic (https://github.com/pydantic/pydantic)
- 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[str, tuple[DeferredType, FieldInfo]]"  [call-overload]
+ 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]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/context/menu.py:141: error: Incompatible return value type (got "CommandType", expected "Literal[CommandType.USER, CommandType.MESSAGE]")  [return-value]
- tanjun/commands/menu.py:534: error: Incompatible types in assignment (expression has type "CommandType", variable has type "Literal[CommandType.USER]")  [assignment]
- tanjun/commands/menu.py:534: error: Incompatible types in assignment (expression has type "CommandType", variable has type "Literal[CommandType.MESSAGE]")  [assignment]

psycopg (https://github.com/psycopg/psycopg)
- tests/types/test_array.py:212: error: Incompatible types in assignment (expression has type "type[int] | type[float]", variable has type "type[Decimal]")  [assignment]

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/arrays/string_.py:178: error: Redundant cast to "str"  [redundant-cast]
- pandas/io/stata.py:1508: error: Redundant cast to "str"  [redundant-cast]
- pandas/io/stata.py:1837: error: Redundant cast to "str"  [redundant-cast]
- pandas/io/stata.py:1843: error: Redundant cast to "str"  [redundant-cast]
- pandas/core/internals/concat.py:98: error: Argument 2 to "_is_homogeneous_mgr" has incompatible type "type[object]"; expected "dtype[Any] | ExtensionDtype"  [arg-type]
- pandas/core/internals/concat.py:104: error: Argument 3 to "_concat_homogeneous_fastpath" has incompatible type "type[object]"; expected "dtype[Any]"  [arg-type]
- pandas/tests/extension/test_masked.py:309: error: "str" has no attribute "name"  [attr-defined]

operator (https://github.com/canonical/operator)
- ops/lib/__init__.py:241: error: Argument 1 to "_Missing" has incompatible type "dict[str, object]"; expected "bool"  [arg-type]
+ ops/lib/__init__.py:241: error: Argument 1 to "_Missing" has incompatible type "dict[str | Any, object]"; expected "bool"  [arg-type]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/collections.py:391: error: "Never" not callable  [misc]
+ src/prefect/server/api/server.py:498: error: Invalid index type "tuple[str, bool]" for "dict[tuple[Settings, bool], Any]"; expected type "tuple[Settings, bool]"  [index]

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply" of class "DefaultSubstitutions":
- sphinx/transforms/__init__.py:121:68: error: Argument 1 to "_handle_default_substitution" of "DefaultSubstitutions" has incompatible type "str"; expected "Literal['version', 'release', 'today', 'translation progress']"  [arg-type]

streamlit (https://github.com/streamlit/streamlit)
- lib/streamlit/elements/heading.py: note: In member "_handle_divider_color" of class "HeadingMixin":
- lib/streamlit/elements/heading.py:249:20: error: Redundant cast to "str"  [redundant-cast]

spark (https://github.com/apache/spark)
- python/pyspark/pandas/utils.py:746: error: Redundant cast to "int"  [redundant-cast]

colour (https://github.com/colour-science/colour)
- colour/io/image.py:670: error: Value of type variable "_IntType" of "iinfo" cannot be "object"  [type-var]
- colour/io/image.py:671: error: Value of type variable "_IntType" of "iinfo" cannot be "object"  [type-var]
- colour/io/image.py:675: error: Argument 2 to "as_int_array" has incompatible type "type[object]"; expected "type[signedinteger[_8Bit]] | type[signedinteger[_16Bit]] | type[signedinteger[_32Bit]] | type[signedinteger[_64Bit]] | type[unsignedinteger[_8Bit]] | type[unsignedinteger[_16Bit]] | type[unsignedinteger[_32Bit]] | type[unsignedinteger[_64Bit]] | None"  [arg-type]

pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/python_api.py:322: error: "Never" not callable  [misc]

schema_salad (https://github.com/common-workflow-language/schema_salad)
- schema_salad/avro/schema.py: note: In function "make_avsc_object":
- schema_salad/avro/schema.py:703:30: error: Redundant cast to "str"  [redundant-cast]
- schema_salad/schema.py: note: In function "make_valid_avro":
- schema_salad/schema.py:561:28: error: Redundant cast to "str"  [redundant-cast]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/common.py:378: error: Incompatible return value type (got "str", expected "_ServerMode")  [return-value]

aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/rtcpeerconnection.py:1143: error: Invalid index type "int | str" for "dict[int, RTCRtpDecodingParameters]"; expected type "int"  [index]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/csgo/state.py:210: error: Argument 1 to "__delitem__" of "dict" has incompatible type "int"; expected "AssetID"  [arg-type]
+ steam/ext/csgo/state.py:211: error: Argument 1 to "__delitem__" of "dict" has incompatible type "int"; expected "AssetID"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
- discord/gateway.py:968: error: Argument 3 to "select_protocol" of "DiscordVoiceWebSocket" has incompatible type "Literal['xsalsa20_poly1305_lite', 'xsalsa20_poly1305_suffix', 'xsalsa20_poly1305']"; expected "int"  [arg-type]
- discord/state.py:656: error: Unused "type: ignore" comment  [unused-ignore]

jax (https://github.com/google/jax)
- jax/_src/interpreters/partial_eval.py:2587: error: Unused "type: ignore" comment  [unused-ignore]

ibis (https://github.com/ibis-project/ibis)
- ibis/common/graph.py:156: error: "Never" not callable  [misc]

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- mitmproxy/addons/core.py:172: error: Unused "type: ignore" comment  [unused-ignore]

Jordandev678 added a commit to Jordandev678/mypy that referenced this pull request Oct 9, 2024
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.

Narrowing inconsistency between == and "in" Wrong type inferred when "not in" narrowing Any
1 participant