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

Modified the overload call evaluation logic to conform with the new p… #9760

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

erictraut
Copy link
Collaborator

…roposed type specification rules regarding *args parameters. This addresses #9748.

…roposed type specification rules regarding `*args` parameters. This addresses #9748.
Copy link
Contributor

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

ibis (https://github.com/ibis-project/ibis)
-   /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:3021:41 - error: Argument of type "list[Unknown]" cannot be assigned to parameter "dtypes" of type "Iterator[DataType]" in function "highest_precedence"
+   /tmp/mypy_primer/projects/ibis/ibis/expr/types/relations.py:3021:41 - error: Argument of type "list[Any]" cannot be assigned to parameter "dtypes" of type "Iterator[DataType]" in function "highest_precedence"
-     "list[Unknown]" is incompatible with protocol "Iterator[DataType]"
+     "list[Any]" is incompatible with protocol "Iterator[DataType]"

sympy (https://github.com/sympy/sympy)
+   /tmp/mypy_primer/projects/sympy/sympy/core/expr.py:1592:39 - error: Cannot access attribute "args_cnc" for class "Basic"
+     Attribute "args_cnc" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/core/expr.py:1592:62 - error: "args" is not a known attribute of "None" (reportOptionalMemberAccess)
-   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:201:41 - error: Argument of type "Any | list[int]" cannot be assigned to parameter "X" of type "str" in function "interpolating_poly"
+   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:201:41 - error: Argument of type "tuple[Any, ...] | Any | list[int]" cannot be assigned to parameter "X" of type "str" in function "interpolating_poly"
-     Type "Any | list[int]" is not assignable to type "str"
+     Type "tuple[Any, ...] | Any | list[int]" is not assignable to type "str"
-   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:201:44 - error: Argument of type "Any | list[Unknown]" cannot be assigned to parameter "Y" of type "str" in function "interpolating_poly"
+   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:201:44 - error: Argument of type "tuple[Any, ...] | Any | list[Unknown]" cannot be assigned to parameter "Y" of type "str" in function "interpolating_poly"
-     Type "Any | list[Unknown]" is not assignable to type "str"
+     Type "tuple[Any, ...] | Any | list[Unknown]" is not assignable to type "str"
-   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:204:41 - error: Argument of type "Any | list[int]" cannot be assigned to parameter "X" of type "str" in function "interpolating_poly"
+   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:204:41 - error: Argument of type "tuple[Any, ...] | Any | list[int]" cannot be assigned to parameter "X" of type "str" in function "interpolating_poly"
-     Type "Any | list[int]" is not assignable to type "str"
+     Type "tuple[Any, ...] | Any | list[int]" is not assignable to type "str"
-   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:204:44 - error: Argument of type "Any | list[Unknown]" cannot be assigned to parameter "Y" of type "str" in function "interpolating_poly"
+   /tmp/mypy_primer/projects/sympy/sympy/polys/polyfuncs.py:204:44 - error: Argument of type "tuple[Any, ...] | Any | list[Unknown]" cannot be assigned to parameter "Y" of type "str" in function "interpolating_poly"
-     Type "Any | list[Unknown]" is not assignable to type "str"
+     Type "tuple[Any, ...] | Any | list[Unknown]" is not assignable to type "str"
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:120:18 - error: Argument of type "Equality | Unknown | Relational | Unequality | Integer" cannot be assigned to parameter "expr" of type "Expr" in function "add"
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:120:18 - error: Argument of type "Equality | Unknown" cannot be assigned to parameter "expr" of type "Expr" in function "add"
-     Type "Equality | Unknown | Relational | Unequality | Integer" is not assignable to type "Expr"
+     Type "Equality | Unknown" is not assignable to type "Expr"
-       "Relational" is not assignable to "Expr" (reportArgumentType)
+       "Equality" is not assignable to "Expr" (reportArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:123:18 - error: Argument of type "Equality | Unknown | Relational | Unequality | Integer" cannot be assigned to parameter "expr" of type "Expr" in function "add"
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:123:18 - error: Argument of type "Equality | Unknown" cannot be assigned to parameter "expr" of type "Expr" in function "add"
-     Type "Equality | Unknown | Relational | Unequality | Integer" is not assignable to type "Expr"
+     Type "Equality | Unknown" is not assignable to type "Expr"
-       "Relational" is not assignable to "Expr" (reportArgumentType)
+       "Equality" is not assignable to "Expr" (reportArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:126:9 - error: Argument of type "Equality | Unknown | Relational | Unequality | Integer" cannot be assigned to parameter "expr" of type "Expr" in function "add"
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:126:9 - error: Argument of type "Equality | Unknown" cannot be assigned to parameter "expr" of type "Expr" in function "add"
-     Type "Equality | Unknown | Relational | Unequality | Integer" is not assignable to type "Expr"
+     Type "Equality | Unknown" is not assignable to type "Expr"
-       "Relational" is not assignable to "Expr" (reportArgumentType)
+       "Equality" is not assignable to "Expr" (reportArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:132:9 - error: Argument of type "Equality | Unknown | Relational | Unequality | Integer" cannot be assigned to parameter "expr" of type "Expr" in function "add"
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_matchpy_connector.py:132:9 - error: Argument of type "Equality | Unknown" cannot be assigned to parameter "expr" of type "Expr" in function "add"
-     Type "Equality | Unknown | Relational | Unequality | Integer" is not assignable to type "Expr"
+     Type "Equality | Unknown" is not assignable to type "Expr"
-       "Relational" is not assignable to "Expr" (reportArgumentType)
+       "Equality" is not assignable to "Expr" (reportArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:895:12 - error: Operator "/" not supported for types "Equality | Unknown | Relational | Unequality | Integer" and "Literal[2]"
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:895:12 - error: Operator "/" not supported for types "Equality | Unknown" and "Literal[2]"
-     Operator "/" not supported for types "Equality" and "Literal[2]"
-     Operator "/" not supported for types "Relational" and "Literal[2]"
-     Operator "/" not supported for types "Unequality" and "Literal[2]" (reportOperatorIssue)
+     Operator "/" not supported for types "Equality" and "Literal[2]" (reportOperatorIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1863:12 - error: Cannot access attribute "combsimp" for class "Relational"
-     Attribute "combsimp" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1863:12 - error: Cannot access attribute "combsimp" for class "Unequality"
-     Attribute "combsimp" is unknown (reportAttributeAccessIssue)
-     Attribute "factor" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1911:14 - error: Cannot access attribute "factor" for class "Relational"
-     Attribute "factor" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1911:14 - error: Cannot access attribute "factor" for class "Unequality"
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1918:14 - error: Cannot access attribute "combsimp" for class "Relational"
-     Attribute "combsimp" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1918:14 - error: Cannot access attribute "combsimp" for class "Unequality"
-     Attribute "combsimp" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1992:22 - error: Argument of type "Equality | Unknown | NaN | Sum" cannot be assigned to parameter "x" of type "ConvertibleToFloat" in function "__new__"
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1932:12 - error: Cannot access attribute "combsimp" for class "Relational"
-     Attribute "combsimp" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1932:12 - error: Cannot access attribute "combsimp" for class "Unequality"
-     Attribute "combsimp" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:1992:22 - error: Argument of type "Equality | Unknown | Relational | Unequality | Integer | NaN | Sum" cannot be assigned to parameter "x" of type "ConvertibleToFloat" in function "__new__"
-     Type "Equality | Unknown | Relational | Unequality | Integer | NaN | Sum" is not assignable to type "ConvertibleToFloat"
+     Type "Equality | Unknown | NaN | Sum" is not assignable to type "ConvertibleToFloat"
-       Type "Relational" is not assignable to type "ConvertibleToFloat"
+       Type "Equality" is not assignable to type "ConvertibleToFloat"
-         "Relational" is not assignable to "str"
+         "Equality" is not assignable to "str"
-         "Relational" is incompatible with protocol "Buffer"
+         "Equality" is incompatible with protocol "Buffer"
-         "Relational" is incompatible with protocol "SupportsFloat"
+         "Equality" is incompatible with protocol "SupportsFloat"
-         "Relational" is incompatible with protocol "SupportsIndex"
+         "Equality" is incompatible with protocol "SupportsIndex"
-     Attribute "gammasimp" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:2074:56 - error: Cannot access attribute "gammasimp" for class "Relational"
-     Attribute "gammasimp" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_wester.py:2074:56 - error: Cannot access attribute "gammasimp" for class "Unequality"

... (truncated 79 lines) ...

core (https://github.com/home-assistant/core)
+   /tmp/mypy_primer/projects/core/homeassistant/components/sensor/recorder.py:529:13 - error: Could not assign item in TypedDict
+     "tuple[Any, ...]" is not assignable to "float" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/core/homeassistant/components/sensor/recorder.py:533:13 - error: Could not assign item in TypedDict
+     "tuple[Any, ...]" is not assignable to "float" (reportGeneralTypeIssues)
- 64197 errors, 293 warnings, 0 informations 
+ 64199 errors, 293 warnings, 0 informations 

zulip (https://github.com/zulip/zulip)
- /tmp/mypy_primer/projects/zulip/zerver/data_import/slack_message_conversion.py
-   /tmp/mypy_primer/projects/zulip/zerver/data_import/slack_message_conversion.py:270:21 - error: Expression with type "tuple[str]" cannot be assigned to target tuple
-     Type "tuple[str]" is incompatible with target tuple
-       Tuple size mismatch; expected 2 but received 1 (reportAssignmentType)
- 4949 errors, 461 warnings, 0 informations 
+ 4948 errors, 461 warnings, 0 informations 

mypy (https://github.com/python/mypy)
-   /tmp/mypy_primer/projects/mypy/mypy/semanal.py:5106:48 - error: Argument of type "list[Never]" cannot be assigned to parameter "lvals" of type "list[Lvalue]" in function "process_module_assignment"
-     "list[Never]" is not assignable to "list[Lvalue]"
-       Type parameter "_T@list" is invariant, but "Never" is not the same as "Lvalue"
-       Consider switching from "list" to "Sequence" which is covariant (reportArgumentType)
- 1228 errors, 102 warnings, 0 informations 
+ 1227 errors, 102 warnings, 0 informations 

spark (https://github.com/apache/spark)
-   /tmp/mypy_primer/projects/spark/python/pyspark/pandas/frame.py:7651:62 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
- 25411 errors, 327 warnings, 0 informations 
+ 25410 errors, 327 warnings, 0 informations 

vision (https://github.com/pytorch/vision)
-   /tmp/mypy_primer/projects/vision/test/test_datasets.py:1852:21 - error: Cannot access attribute "lstrip" for class "int"
-     Attribute "lstrip" is unknown (reportAttributeAccessIssue)
- 1641 errors, 53 warnings, 0 informations 
+ 1640 errors, 53 warnings, 0 informations 

jax (https://github.com/google/jax)
-   /tmp/mypy_primer/projects/jax/jax/_src/sharding_impls.py:369:12 - error: Type "int | float" is not assignable to return type "int"
-     Type "int | float" is not assignable to type "int"
-       "float" is not assignable to "int" (reportReturnType)
-   /tmp/mypy_primer/projects/jax/jax/_src/interpreters/pxla.py:2119:10 - error: Type "tuple[float | int, None]" is not assignable to return type "tuple[int, tuple[Unknown, ...] | None]"
-     Type "float | int" is not assignable to type "int"
-       "float" is not assignable to "int" (reportReturnType)
-   /tmp/mypy_primer/projects/jax/jax/_src/numpy/lax_numpy.py:12135:30 - error: Argument of type "Sequence[int] | None" cannot be assigned to parameter "iterable" of type "Iterable[int]" in function "extend"
+   /tmp/mypy_primer/projects/jax/jax/_src/numpy/lax_numpy.py:12135:30 - error: Argument of type "tuple[Any, ...] | None" cannot be assigned to parameter "iterable" of type "Iterable[int]" in function "extend"
-     Type "Sequence[int] | None" is not assignable to type "Iterable[int]"
+     Type "tuple[Any, ...] | None" is not assignable to type "Iterable[int]"
-   /tmp/mypy_primer/projects/jax/jax/_src/numpy/lax_numpy.py:12136:35 - error: Argument of type "Sequence[int] | None" cannot be assigned to parameter "iterable" of type "Iterable[int]" in function "extend"
+   /tmp/mypy_primer/projects/jax/jax/_src/numpy/lax_numpy.py:12136:35 - error: Argument of type "tuple[Any, ...] | None" cannot be assigned to parameter "iterable" of type "Iterable[int]" in function "extend"
-     Type "Sequence[int] | None" is not assignable to type "Iterable[int]"
+     Type "tuple[Any, ...] | None" is not assignable to type "Iterable[int]"
- 6557 errors, 28 warnings, 0 informations 
+ 6555 errors, 28 warnings, 0 informations 

@erictraut erictraut merged commit 7f5eeb6 into main Jan 25, 2025
18 checks passed
@erictraut erictraut deleted the issue-9748 branch January 25, 2025 18:43
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