Fixed recent regression that results in spurious diagnostics being re…#10494
Closed
Fixed recent regression that results in spurious diagnostics being re…#10494
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: AutoSplit (https://github.com/Toufool/AutoSplit)
- ...
- ...:40:9 - error: Method "items" is not marked as override but is overriding a method in class "Mapping[str, object]" (reportImplicitOverride)
- ...:41:9 - error: Method "keys" is not marked as override but is overriding a method in class "Mapping[str, object]" (reportImplicitOverride)
- ...:42:9 - error: Method "values" is not marked as override but is overriding a method in class "Mapping[str, object]" (reportImplicitOverride)
- 980 errors, 5 warnings, 7 informations
+ 977 errors, 5 warnings, 7 informations
sympy (https://github.com/sympy/sympy)
- ...:540:50 - error: "Set" is not iterable
- "__iter__" method not defined (reportGeneralTypeIssues)
+ ...:2542:9 - error: Method "_cdf" overrides class "SingleContinuousDistribution" in an incompatible manner
+ Return type mismatch: base method returns type "None", override returns type "ComplexInfinity | NaN | Rational | Unknown"
+ Type "ComplexInfinity | NaN | Rational | Unknown" is not assignable to type "None"
+ "ComplexInfinity" is not assignable to "None" (reportIncompatibleMethodOverride)
+ ...:2721:9 - error: Method "_cdf" overrides class "SingleContinuousDistribution" in an incompatible manner
+ Return type mismatch: base method returns type "None", override returns type "Expr | NaN | ComplexInfinity | Rational | Unknown"
+ Type "Expr | NaN | ComplexInfinity | Rational | Unknown" is not assignable to type "None"
+ "Expr" is not assignable to "None" (reportIncompatibleMethodOverride)
- ...:261:48 - error: Cannot access attribute "doit" for class "tuple[Unknown, ...]"
- Attribute "doit" is unknown (reportAttributeAccessIssue)
- ...:261:48 - error: "doit" is not a known attribute of "None" (reportOptionalMemberAccess)
- ...:268:22 - error: Argument of type "Generator[tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | int | None, None, None]" cannot be assigned to parameter "iterable" of type "Iterable[_SupportsSumNoDefaultT@sum]" in function "sum"
+ ...:268:22 - error: Argument of type "Generator[Unknown | int | None, None, None]" cannot be assigned to parameter "iterable" of type "Iterable[_SupportsSumNoDefaultT@sum]" in function "sum"
- "Generator[tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | int | None, None, None]" is not assignable to "Iterable[_SupportsSumNoDefaultT@sum]"
+ "Generator[Unknown | int | None, None, None]" is not assignable to "Iterable[_SupportsSumNoDefaultT@sum]"
- Type parameter "_T_co@Iterable" is covariant, but "tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | int | None" is not a subtype of "_SupportsSumNoDefaultT@sum"
+ Type parameter "_T_co@Iterable" is covariant, but "Unknown | int | None" is not a subtype of "_SupportsSumNoDefaultT@sum"
- Type "tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
+ Type "Unknown | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
- Type "tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
+ Type "Unknown | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
- "Basic" is incompatible with protocol "_SupportsSumWithNoDefaultGiven" (reportArgumentType)
+ "None" is incompatible with protocol "_SupportsSumWithNoDefaultGiven" (reportArgumentType)
+ ...:138:17 - error: Argument of type "NaN | ComplexInfinity | Rational | Unknown | Expr" cannot be assigned to parameter "value" of type "int" in function "__setitem__"
+ Type "NaN | ComplexInfinity | Rational | Unknown | Expr" is not assignable to type "int"
+ "Expr" is not assignable to "int" (reportArgumentType)
- ...:473:25 - error: Argument of type "Expr | Lambda | Zero | One | Integral | Unknown | Probability | tuple[Unknown, ...] | Sum | NaN | Piecewise | Basic | NegativeOne | Integer | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | int" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
- Type "Expr | Lambda | Zero | One | Integral | Unknown | Probability | tuple[Unknown, ...] | Sum | NaN | Piecewise | Basic | NegativeOne | Integer | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | int" is not assignable to type "Expr | complex"
- Type "Basic" is not assignable to type "Expr | complex"
- "Basic" is not assignable to "Expr"
- "Basic" is not assignable to "complex" (reportArgumentType)
- ...:741:20 - error: "Set" is not iterable
- "__iter__" method not defined (reportGeneralTypeIssues)
- ...:1839:25 - error: Argument of type "tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | Integral | Any | int | None" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
+ ...:1839:25 - error: Argument of type "tuple[Unknown, ...] | Unknown | Sum | Expr | Any | Add | Zero | NaN | Piecewise | Basic | Integral | int | None" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
- Type "tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Basic | Integral | Any | int | None" is not assignable to type "Expr | complex"
+ Type "tuple[Unknown, ...] | Unknown | Sum | Expr | Any | Add | Zero | NaN | Piecewise | Basic | Integral | int | None" is not assignable to type "Expr | complex"
- ...:1894:27 - error: Cannot access attribute "doit" for class "tuple[Unknown, ...]"
- Attribute "doit" is unknown (reportAttributeAccessIssue)
- Return type mismatch: base method returns type "Self@Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Self@Expectation | Literal[0] | None"
+ Return type mismatch: base method returns type "Self@Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | Self@Expectation | Literal[0] | None"
- Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Expectation* | Literal[0] | None" is not assignable to type "Basic"
+ Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | Expectation* | Literal[0] | None" is not assignable to type "Basic"
+ ...:74:9 - error: Method "doit" overrides class "Basic" in an incompatible manner
+ Return type mismatch: base method returns type "Basic", override returns type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | ComplexInfinity | Expr | Float | Infinity | Integer | Lambda | NaN | NegativeInfinity | NegativeOne | Number | Piecewise | Rational | Integral | Literal[0]"
+ Type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | ComplexInfinity | Expr | Float | Infinity | Integer | Lambda | NaN | NegativeInfinity | NegativeOne | Number | Piecewise | Rational | Integral | Literal[0]" is not assignable to type "Basic"
+ "Literal[0]" is not assignable to "Basic" (reportIncompatibleMethodOverride)
- ...:123:27 - error: Cannot access attribute "doit" for class "tuple[Unknown, ...]"
- Attribute "doit" is unknown (reportAttributeAccessIssue)
- Return type mismatch: base method returns type "Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Literal[0] | None"
+ Return type mismatch: base method returns type "Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | Literal[0] | None"
- Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Literal[0] | None" is not assignable to type "Basic"
+ Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | Literal[0] | None" is not assignable to type "Basic"
- ...:41:21 - error: Cannot access attribute "simplify" for class "tuple[Unknown, ...]"
- Attribute "simplify" is unknown (reportAttributeAccessIssue)
- ...:41:21 - error: "simplify" is not a known attribute of "None" (reportOptionalMemberAccess)
- ...:366:12 - error: Operator "-" not supported for types "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | ExpectationMatrix | Literal[0] | None" and "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | ExpectationMatrix | Literal[0] | None"
+ ...:366:12 - error: Operator "-" not supported for types "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None" and "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None"
- ...:414:21 - error: Argument of type "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | ExpectationMatrix | Literal[0] | None" cannot be assigned to parameter "expr" of type "Basic" in function "simplify"
+ ...:414:21 - error: Argument of type "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None" cannot be assigned to parameter "expr" of type "Basic" in function "simplify"
- Type "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | ExpectationMatrix | Literal[0] | None" is not assignable to type "Basic"
+ Type "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Add | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None" is not assignable to type "Basic"
... (truncated 1985 lines) ...
steam.py (https://github.com/Gobot1234/steam.py)
- ...
- ...:52:91 - warning: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 8263 errors, 91 warnings, 0 informations
+ 8263 errors, 90 warnings, 0 informations
scipy-stubs (https://github.com/scipy/scipy-stubs)
- ...
- ...:40:9 - error: Method "items" is not marked as override but is overriding a method in class "Mapping[str, object]" (reportImplicitOverride)
- ...:41:9 - error: Method "keys" is not marked as override but is overriding a method in class "Mapping[str, object]" (reportImplicitOverride)
- ...:42:9 - error: Method "values" is not marked as override but is overriding a method in class "Mapping[str, object]" (reportImplicitOverride)
- 275 errors, 0 warnings, 0 informations
+ 272 errors, 0 warnings, 0 informations
discord.py (https://github.com/Rapptz/discord.py)
- ...
- ...:52:91 - warning: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 0 errors, 9 warnings, 0 informations
+ 0 errors, 8 warnings, 0 informations
antidote (https://github.com/Finistere/antidote)
- ...
- ...:52:91 - warning: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 269 errors, 37 warnings, 0 informations
+ 269 errors, 36 warnings, 0 informations
operator (https://github.com/canonical/operator)
- ...
- ...:52:91 - error: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 192 errors, 0 warnings, 0 informations
+ 191 errors, 0 warnings, 0 informations
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- ...
- ...:52:91 - error: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 10 errors, 0 warnings, 183 informations
+ 9 errors, 0 warnings, 183 informations
async-utils (https://github.com/mikeshardmind/async-utils)
- ...
- ...:52:91 - warning: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 0 errors, 1 warning, 0 informations
+ 0 errors, 0 warnings, 0 informations
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- ...
- ...:52:91 - error: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 37 errors, 108 warnings, 0 informations
+ 36 errors, 108 warnings, 0 informations
mypy (https://github.com/python/mypy)
- ...
- ...:662:9 - error: Method "__and__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]", override returns type "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]"
- "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]" is not assignable to "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]" (reportIncompatibleMethodOverride)
- ...:666:9 - error: Method "__or__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__or__]", override returns type "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__or__]"
- "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__or__]" is not assignable to "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__or__]" (reportIncompatibleMethodOverride)
- ...:668:9 - error: Method "__sub__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]", override returns type "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]"
- "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]" is not assignable to "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView]]" (reportIncompatibleMethodOverride)
- ...:670:9 - error: Method "__xor__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__xor__]", override returns type "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__xor__]"
- "set[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__xor__]" is not assignable to "AbstractSet[tuple[_KT_co@ItemsView, _VT_co@ItemsView] | _T@__xor__]" (reportIncompatibleMethodOverride)
- ...:675:9 - error: Method "__and__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[_KT_co@KeysView]", override returns type "set[_KT_co@KeysView]"
- "set[_KT_co@KeysView]" is not assignable to "AbstractSet[_KT_co@KeysView]" (reportIncompatibleMethodOverride)
- ...:679:9 - error: Method "__or__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[_KT_co@KeysView | _T@__or__]", override returns type "set[_KT_co@KeysView | _T@__or__]"
- "set[_KT_co@KeysView | _T@__or__]" is not assignable to "AbstractSet[_KT_co@KeysView | _T@__or__]" (reportIncompatibleMethodOverride)
- ...:681:9 - error: Method "__sub__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[_KT_co@KeysView]", override returns type "set[_KT_co@KeysView]"
- "set[_KT_co@KeysView]" is not assignable to "AbstractSet[_KT_co@KeysView]" (reportIncompatibleMethodOverride)
- ...:683:9 - error: Method "__xor__" overrides class "AbstractSet" in an incompatible manner
- Return type mismatch: base method returns type "AbstractSet[_KT_co@KeysView | _T@__xor__]", override returns type "set[_KT_co@KeysView | _T@__xor__]"
- "set[_KT_co@KeysView | _T@__xor__]" is not assignable to "AbstractSet[_KT_co@KeysView | _T@__xor__]" (reportIncompatibleMethodOverride)
- ...:964:9 - error: Method "items" overrides class "Mapping" in an incompatible manner
- Return type mismatch: base method returns type "ItemsView[str, object]", override returns type "dict_items[str, object]"
- "dict_items[str, object]" is not assignable to "ItemsView[str, object]" (reportIncompatibleMethodOverride)
- ...:965:9 - error: Method "keys" overrides class "Mapping" in an incompatible manner
- Return type mismatch: base method returns type "KeysView[str]", override returns type "dict_keys[str, object]"
- "dict_keys[str, object]" is not assignable to "KeysView[str]" (reportIncompatibleMethodOverride)
- ...:966:9 - error: Method "values" overrides class "Mapping" in an incompatible manner
- Return type mismatch: base method returns type "ValuesView[object]", override returns type "dict_values[str, object]"
- "dict_values[str, object]" is not assignable to "ValuesView[object]" (reportIncompatibleMethodOverride)
- 1238 errors, 79 warnings, 0 informations
+ 1227 errors, 79 warnings, 0 informations
trio (https://github.com/python-trio/trio)
- ...
- ...:52:91 - error: Unnecessary "# type: ignore" comment (reportUnnecessaryTypeIgnoreComment)
- 1515 errors, 13 warnings, 0 informations
+ 1514 errors, 13 warnings, 0 informations
|
Contributor
|
FWIW, this is not sufficient to address the analysis-related telemetry issue that I mentioned in email. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ported for the
_type_checker_internals.pyistub file. This addresses #10484 and #10487.