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

Fixed recent regression that results in incorrect narrowed type when … #9469

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

erictraut
Copy link
Collaborator

…using the x in y pattern where y is a container type whose element type is Unknown or Any. This addresses #9457.

…using the `x in y` pattern where `y` is a container type whose element type is `Unknown` or `Any`. This addresses #9457.
Copy link
Contributor

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

openlibrary (https://github.com/internetarchive/openlibrary)
-     Return type mismatch: base method returns type "Iterator[tuple[str, str | MarcFieldBase]]", override returns type "Generator[tuple[Unknown, MockField], Any, None]"
+     Return type mismatch: base method returns type "Iterator[tuple[str, str | MarcFieldBase]]", override returns type "Generator[tuple[str, MockField], Any, None]"
-       "Generator[tuple[Unknown, MockField], Any, None]" is not assignable to "Iterator[tuple[str, str | MarcFieldBase]]"
+       "Generator[tuple[str, MockField], Any, None]" is not assignable to "Iterator[tuple[str, str | MarcFieldBase]]"
-         Type parameter "_T_co@Iterator" is covariant, but "tuple[Unknown, MockField]" is not a subtype of "tuple[str, str | MarcFieldBase]"
+         Type parameter "_T_co@Iterator" is covariant, but "tuple[str, MockField]" is not a subtype of "tuple[str, str | MarcFieldBase]"
-           "tuple[Unknown, MockField]" is not assignable to "tuple[str, str | MarcFieldBase]"
+           "tuple[str, MockField]" is not assignable to "tuple[str, str | MarcFieldBase]"
+   /tmp/mypy_primer/projects/openlibrary/openlibrary/plugins/openlibrary/api.py:63:45 - error: Argument of type "str" cannot be assigned to parameter "id_type" of type "Literal['identifier', 'openlibrary_work', 'openlibrary_edition']" in function "get_availability"
+     Type "str" is not assignable to type "Literal['identifier', 'openlibrary_work', 'openlibrary_edition']"
+       "str" is not assignable to type "Literal['identifier']"
+       "str" is not assignable to type "Literal['openlibrary_work']"
+       "str" is not assignable to type "Literal['openlibrary_edition']" (reportArgumentType)
- 1249 errors, 68 warnings, 0 informations 
+ 1250 errors, 68 warnings, 0 informations 

ibis (https://github.com/ibis-project/ibis)
-   /tmp/mypy_primer/projects/ibis/ibis/expr/visualize.py:164:50 - error: Argument of type "Node | Unknown" cannot be assigned to parameter of type "Node"
+   /tmp/mypy_primer/projects/ibis/ibis/expr/visualize.py:164:50 - error: Argument of type "Node" cannot be assigned to parameter of type "Node"
-     Type "Node | Unknown" is not assignable to type "Node"
-       "ibis.common.graph.Node" is not assignable to "ibis.expr.operations.core.Node" (reportArgumentType)
+     "ibis.common.graph.Node" is not assignable to "ibis.expr.operations.core.Node" (reportArgumentType)
-   /tmp/mypy_primer/projects/ibis/ibis/expr/visualize.py:164:53 - error: Argument of type "Node | Unknown | Relation" cannot be assigned to parameter of type "Node"
+   /tmp/mypy_primer/projects/ibis/ibis/expr/visualize.py:164:53 - error: Argument of type "Node | Relation" cannot be assigned to parameter of type "Node"
-     Type "Node | Unknown | Relation" is not assignable to type "Node"
+     Type "Node | Relation" is not assignable to type "Node"

sympy (https://github.com/sympy/sympy)
-   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/homomorphisms.py:97:32 - error: Argument of type "list[Unknown] | Unknown | Permutation | FreeGroupElement" cannot be assigned to parameter "obj" of type "Sized" in function "len"
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/homomorphisms.py:97:32 - error: Argument of type "list[Unknown] | list[Unknown | Basic] | Unknown | Permutation | FreeGroupElement" cannot be assigned to parameter "obj" of type "Sized" in function "len"
-     Type "list[Unknown] | Unknown | Permutation | FreeGroupElement" is not assignable to type "Sized"
+     Type "list[Unknown] | list[Unknown | Basic] | Unknown | Permutation | FreeGroupElement" is not assignable to type "Sized"
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/homomorphisms.py:99:22 - error: Cannot access attribute "is_identity" for class "Basic"
+     Attribute "is_identity" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/homomorphisms.py:104:42 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[-1]"
+     Operator "**" not supported for types "Basic" and "Literal[-1]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/homomorphisms.py:174:40 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[-1]"
+     Operator "**" not supported for types "Basic" and "Literal[-1]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/perm_groups.py:1248:25 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[-1]"
+     Operator "**" not supported for types "Basic" and "Literal[-1]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/perm_groups.py:4322:27 - error: Operator "**" not supported for types "Unknown | Basic" and "Literal[-1]"
+     Operator "**" not supported for types "Basic" and "Literal[-1]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/combinatorics/tests/test_perm_groups.py:860:13 - error: Operator "*" not supported for types "Unknown | Basic" and "Permutation | Unknown | Coset"
+     Operator "*" not supported for types "Basic" and "Coset" (reportOperatorIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/core/exprtools.py:485:13 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "key" of type "bytes" in function "__setitem__"
+   /tmp/mypy_primer/projects/sympy/sympy/core/exprtools.py:485:13 - error: Argument of type "bytes | Basic | Unknown" cannot be assigned to parameter "key" of type "bytes" in function "__setitem__"
-     Type "Unknown | Basic" is not assignable to type "bytes"
+     Type "bytes | Basic | Unknown" is not assignable to type "bytes"
-   /tmp/mypy_primer/projects/sympy/sympy/core/exprtools.py:780:13 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "key" of type "bytes" in function "__setitem__"
+   /tmp/mypy_primer/projects/sympy/sympy/core/exprtools.py:780:13 - error: Argument of type "bytes | Basic | Unknown" cannot be assigned to parameter "key" of type "bytes" in function "__setitem__"
-     Type "Unknown | Basic" is not assignable to type "bytes"
+     Type "bytes | Basic | Unknown" is not assignable to type "bytes"
-   /tmp/mypy_primer/projects/sympy/sympy/core/numbers.py:4123:16 - error: Operator "%" not supported for types "Unknown | Basic" and "Literal[2]"
+   /tmp/mypy_primer/projects/sympy/sympy/core/numbers.py:4123:16 - error: Operator "%" not supported for types "Unknown | Number* | Number | Integer | Rational | Float | Basic" and "Literal[2]"
+   /tmp/mypy_primer/projects/sympy/sympy/core/relational.py:1397:28 - error: Argument of type "Unknown | Expr | EvalfMixin* | TMP_RES | Float" cannot be assigned to parameter "x" of type "ConvertibleToFloat" in function "__new__"
+     Type "Unknown | Expr | EvalfMixin* | TMP_RES | Float" is not assignable to type "ConvertibleToFloat"
+       Type "EvalfMixin*" is not assignable to type "ConvertibleToFloat"
+         "EvalfMixin*" is not assignable to "str"
+         "EvalfMixin*" is incompatible with protocol "Buffer"
+           "__buffer__" is not present
+         "EvalfMixin*" is incompatible with protocol "SupportsFloat"
+           "__float__" is not present
+         "EvalfMixin*" is incompatible with protocol "SupportsIndex"
+     ... (reportArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/external/gmpy.py:328:13 - error: Type "(y: Unknown, n: Unknown) -> (tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])" is not assignable to declared type "(x: Unknown, n: Unknown) -> (tuple[Unknown, Unknown] | tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])"
+   /tmp/mypy_primer/projects/sympy/sympy/external/gmpy.py:328:13 - error: Type "(y: Unknown, n: Unknown) -> (tuple[Literal[0, 1], Literal[True]] | tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])" is not assignable to declared type "(x: Unknown, n: Unknown) -> (tuple[Unknown, Unknown] | tuple[Literal[0, 1], Literal[True]] | tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])"
-     Type "(y: Unknown, n: Unknown) -> (tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])" is not assignable to type "(x: Unknown, n: Unknown) -> (tuple[Unknown, Unknown] | tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])"
+     Type "(y: Unknown, n: Unknown) -> (tuple[Literal[0, 1], Literal[True]] | tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])" is not assignable to type "(x: Unknown, n: Unknown) -> (tuple[Unknown, Unknown] | tuple[Literal[0, 1], Literal[True]] | tuple[Unknown, Literal[True]] | tuple[int, bool] | tuple[Literal[1], Literal[False]] | tuple[Unknown | int, Unknown])"
+   /tmp/mypy_primer/projects/sympy/sympy/functions/special/singularity_functions.py:107:40 - error: Operator "-" not supported for types "Basic" and "Literal[1]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/physics/quantum/operatorset.py:135:31 - error: Object of type "Operator" is not callable
+     Attribute "__call__" is unknown (reportCallIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/physics/vector/point.py
+   /tmp/mypy_primer/projects/sympy/sympy/physics/vector/point.py:565:42 - error: Argument of type "Point* | Unknown" cannot be assigned to parameter "object" of type "Self@Point" in function "append"
+     Type "Point* | Unknown" is not assignable to type "Self@Point" (reportArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_mode_base.py:246:21 - error: Argument of type "str | Unknown | None" cannot be assigned to parameter "key" of type "str" in function "__getitem__"
+   /tmp/mypy_primer/projects/sympy/sympy/plotting/pygletplot/plot_mode_base.py:246:21 - error: Argument of type "str | None" cannot be assigned to parameter "key" of type "str" in function "__getitem__"
-     Type "str | Unknown | None" is not assignable to type "str"
+     Type "str | None" is not assignable to type "str"
-   /tmp/mypy_primer/projects/sympy/sympy/series/order.py:292:55 - error: Operator "*" not supported for types "Basic | Unknown" and "Basic"
+   /tmp/mypy_primer/projects/sympy/sympy/series/order.py:292:55 - error: Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
-     Operator "*" not supported for types "Basic" and "Basic" (reportOperatorIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/series/order.py:294:41 - error: Operator "-" not supported for type "Basic | Expr | Unknown" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/series/order.py:294:41 - error: Operator "-" not supported for type "Basic | Expr" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/sets/handlers/functions.py:212:30 - error: Cannot access attribute "is_real" for class "int"
+     Attribute "is_real" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/sets/handlers/functions.py:215:46 - error: Cannot access attribute "is_comparable" for class "int"
+     Attribute "is_comparable" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/sets/handlers/functions.py:218:32 - error: Cannot access attribute "is_imaginary" for class "int"
+     Attribute "is_imaginary" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/simplify/simplify.py:1833:39 - error: "subterm" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/ode.py:1255:27 - error: "eq_no" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/ode.py:1255:47 - error: "eq_no" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/joint_rv.py:421:24 - error: "dom" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/joint_rv.py:421:33 - error: "dom" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/sympy/sympy/utilities/tests/test_lambdify.py:1203:69 - error: Argument of type "Unknown | Expr | EvalfMixin* | TMP_RES | Float" cannot be assigned to parameter "x" of type "SupportsAbs[_T@abs]" in function "abs"
+     Type "Unknown | Expr | EvalfMixin* | TMP_RES | Float" is not assignable to type "SupportsAbs[_T@abs]"
+       "EvalfMixin*" is incompatible with protocol "SupportsAbs[_T@abs]"
+         "__abs__" is not present (reportArgumentType)

... (truncated 62 lines) ...

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ /tmp/mypy_primer/projects/mongo-python-driver/pymongo/common.py
+   /tmp/mypy_primer/projects/mongo-python-driver/pymongo/common.py:381:12 - error: Type "Literal['primary', 'primaryPreferred', 'secondary', 'secondaryPreferred', 'nearest']" is not assignable to return type "_ServerMode"
+     Type "Literal['primary', 'primaryPreferred', 'secondary', 'secondaryPreferred', 'nearest']" is not assignable to type "_ServerMode"
+       "Literal['nearest']" is not assignable to "_ServerMode" (reportReturnType)
- 1175 errors, 27 warnings, 0 informations 
+ 1176 errors, 27 warnings, 0 informations 

pydantic (https://github.com/pydantic/pydantic)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_std_types_schema.py:111:20 - error: Cannot instantiate Protocol class "PathLike" (reportAbstractUsage)
+   /tmp/mypy_primer/projects/pydantic/pydantic/_internal/_std_types_schema.py:111:35 - error: Expected 0 positional arguments (reportCallIssue)
- 265 errors, 46 warnings, 0 informations 
+ 267 errors, 46 warnings, 0 informations 

discord.py (https://github.com/Rapptz/discord.py)
+   /tmp/mypy_primer/projects/discord.py/discord/abc.py:1241:36 - error: Argument of type "Any | None" cannot be assigned to parameter "parent_id" of type "int" in function "update"
+     Type "Any | None" is not assignable to type "int"
+       "None" is not assignable to "int" (reportArgumentType)
+   /tmp/mypy_primer/projects/discord.py/discord/gateway.py:970:58 - error: Argument of type "str" cannot be assigned to parameter "mode" of type "int" in function "select_protocol"
+     "str" is not assignable to "int" (reportArgumentType)
- 106 errors, 95 warnings, 0 informations 
+ 108 errors, 95 warnings, 0 informations 

bokeh (https://github.com/bokeh/bokeh)
-   /tmp/mypy_primer/projects/bokeh/src/bokeh/plotting/_graph.py:73:39 - error: Argument of type "dict[Unknown, Unknown] | Unknown" cannot be assigned to parameter "field" of type "str" in function "__init__"
+   /tmp/mypy_primer/projects/bokeh/src/bokeh/plotting/_graph.py:73:39 - error: Argument of type "dict[Unknown, Unknown] | str" cannot be assigned to parameter "field" of type "str" in function "__init__"
-     Type "dict[Unknown, Unknown] | Unknown" is not assignable to type "str"
+     Type "dict[Unknown, Unknown] | str" is not assignable to type "str"

scikit-learn (https://github.com/scikit-learn/scikit-learn)
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/calibration.py:346:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/calibration.py:346:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/calibration.py:615:5 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/calibration.py:615:5 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/calibration.py:724:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/calibration.py:724:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/multioutput.py:680:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/multioutput.py:680:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/multioutput.py:687:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/multioutput.py:687:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/inspection/_partial_dependence.py:280:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/inspection/_partial_dependence.py:280:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/inspection/_plot/decision_boundary.py:369:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/inspection/_plot/decision_boundary.py:369:13 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/metrics/_scorer.py:90:5 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/metrics/_scorer.py:90:5 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/model_selection/_classification_threshold.py:371:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/model_selection/_classification_threshold.py:371:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/model_selection/_classification_threshold.py:846:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/model_selection/_classification_threshold.py:846:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/tests/test_docstring_parameters.py:271:9 - error: Argument missing for parameter "y" (reportCallIssue)
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/tests/test_docstring_parameters.py:271:9 - error: Argument missing for parameter "Y" (reportCallIssue)
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/tests/test_docstring_parameters.py:273:9 - error: Argument missing for parameter "y" (reportCallIssue)
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/tests/test_docstring_parameters.py:273:9 - error: Argument missing for parameter "Y" (reportCallIssue)
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/_plotting.py:38:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/_plotting.py:38:9 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/tests/test_response.py:312:5 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
+   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/tests/test_response.py:312:5 - error: Expression with type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']] | tuple[Unknown, Unknown | None]" cannot be assigned to target tuple
-     Type "tuple[Unknown, Unknown | None, Unknown | Literal['decision_function']]" is incompatible with target tuple
+     Type "tuple[Unknown, Unknown | None, Unknown | Literal['predict_proba', 'predict_log_proba', 'decision_function']]" is incompatible with target tuple

... (truncated 10 lines) ...

trio (https://github.com/python-trio/trio)
-   /tmp/mypy_primer/projects/trio/src/trio/_dtls.py:399:39 - error: Type of "msg_seq" is unknown (reportUnknownMemberType)
-     Type of "msg_seq" is "int | Unknown" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/trio/src/trio/_dtls.py:401:35 - error: Type of "msg_seq" is partially unknown
+   /tmp/mypy_primer/projects/trio/src/trio/_tests/check_type_completeness.py:164:37 - error: Argument of type "Any | str | object" cannot be assigned to parameter "element" of type "str" in function "add"
+     Type "Any | str | object" is not assignable to type "str"
+       "object" is not assignable to "str" (reportArgumentType)
- 3872 errors, 54 warnings, 0 informations 
+ 3871 errors, 54 warnings, 0 informations 

core (https://github.com/home-assistant/core)
+   /tmp/mypy_primer/projects/core/homeassistant/components/lovelace/system_health.py:45:9 - error: Argument of type "Literal['storage']" cannot be assigned to parameter "value" of type "int" in function "__setitem__"
+     "Literal['storage']" is not assignable to "int" (reportArgumentType)
+   /tmp/mypy_primer/projects/core/homeassistant/components/lovelace/system_health.py:47:9 - error: Argument of type "Literal['yaml']" cannot be assigned to parameter "value" of type "int" in function "__setitem__"
+     "Literal['yaml']" is not assignable to "int" (reportArgumentType)
+ /tmp/mypy_primer/projects/core/homeassistant/components/network/__init__.py
+   /tmp/mypy_primer/projects/core/homeassistant/components/network/__init__.py:69:12 - error: Type "str | Unknown | None" is not assignable to return type "str"
+     Type "str | Unknown | None" is not assignable to type "str"
+       "None" is not assignable to "str" (reportReturnType)
+   /tmp/mypy_primer/projects/core/homeassistant/components/template/alarm_control_panel.py:291:27 - error: Cannot assign to attribute "_state" for class "AlarmControlPanelTemplate*"
+     Type "str" is not assignable to type "AlarmControlPanelState | None"
+       "str" is not assignable to "AlarmControlPanelState"
+       "str" is not assignable to "None" (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/core/homeassistant/components/tts/__init__.py:618:17 - error: Argument of type "Unknown | str" cannot be assigned to parameter "key" of type "bytes" in function "__setitem__"
+     Type "Unknown | str" is not assignable to type "bytes"
+       "str" is not assignable to "bytes" (reportArgumentType)
+   /tmp/mypy_primer/projects/core/homeassistant/components/wyoming/wake_word.py:147:53 - error: Type "list[tuple[bytes, int] | None]" is not assignable to declared type "list[tuple[bytes, int]] | None"
+     Type "tuple[bytes, int] | None" is not assignable to type "tuple[bytes, int]"
+       "None" is not assignable to "tuple[bytes, int]" (reportAssignmentType)
- 22545 errors, 321 warnings, 0 informations 
+ 22551 errors, 321 warnings, 0 informations 

mitmproxy (https://github.com/mitmproxy/mitmproxy)
-   /tmp/mypy_primer/projects/mitmproxy/mitmproxy/proxy/events.py:97:9 - error: Argument of type "Any | type[object] | type[Command]" cannot be assigned to parameter "key" of type "Command" in function "__setitem__"
+   /tmp/mypy_primer/projects/mitmproxy/mitmproxy/proxy/events.py:97:9 - error: Argument of type "Command | Any | type[object] | type[Command]" cannot be assigned to parameter "key" of type "Command" in function "__setitem__"
-     Type "Any | type[object] | type[Command]" is not assignable to type "Command"
+     Type "Command | Any | type[object] | type[Command]" is not assignable to type "Command"

colour (https://github.com/colour-science/colour)
+ /tmp/mypy_primer/projects/colour/colour/utilities/network.py
+   /tmp/mypy_primer/projects/colour/colour/utilities/network.py:1837:18 - error: "log" is not a known attribute of "None" (reportOptionalMemberAccess)
- 2156 errors, 0 warnings, 0 informations 
+ 2157 errors, 0 warnings, 0 informations 

zulip (https://github.com/zulip/zulip)
-   /tmp/mypy_primer/projects/zulip/zerver/actions/message_send.py:1075:35 - error: Type "dict[str, Unknown | int]" is not assignable to declared type "UserData"
+   /tmp/mypy_primer/projects/zulip/zerver/actions/message_send.py:1075:35 - error: Type "dict[str, int | list[str] | None]" is not assignable to declared type "UserData"
-     "dict[str, Unknown | int]" is not assignable to "UserData" (reportAssignmentType)
+     "dict[str, int | list[str] | None]" is not assignable to "UserData" (reportAssignmentType)
+   /tmp/mypy_primer/projects/zulip/zerver/data_import/rocketchat.py:596:81 - error: Argument of type "str" cannot be assigned to parameter "name_id" of type "int" in function "truncate_name"
+     "str" is not assignable to "int" (reportArgumentType)

... (truncated 233 lines) ...```

@erictraut erictraut merged commit ce1325f into main Nov 16, 2024
18 checks passed
@erictraut erictraut deleted the issue-9457 branch November 16, 2024 05:33
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