Alternative fix for recent regression related to _type_checker_internals.pyi#10496
Merged
debonte merged 2 commits intomicrosoft:mainfrom May 23, 2025
Merged
Alternative fix for recent regression related to _type_checker_internals.pyi#10496debonte merged 2 commits intomicrosoft:mainfrom
_type_checker_internals.pyi#10496debonte merged 2 commits intomicrosoft:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
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)
+ ...:793:52 - error: Argument of type "tuple[Unknown, ...] | Tuple | Unknown | Basic" cannot be assigned to parameter "key" of type "Basic" in function "__getitem__"
+ Type "tuple[Unknown, ...] | Tuple | Unknown | Basic" is not assignable to type "Basic"
+ "tuple[Unknown, ...]" is not assignable to "Basic" (reportArgumentType)
+ ...:1322:49 - error: "Basic" is not iterable
+ "__iter__" method not defined (reportGeneralTypeIssues)
- ...:1329:24 - error: Operator "in" not supported for types "Unknown | Basic" and "Basic"
- Operator "in" not supported for types "Basic" and "Basic" (reportOperatorIssue)
- ...:1330:32 - error: Argument of type "Basic" cannot be assigned to parameter "iterable" of type "Iterable[Unknown | Basic]" in function "extend"
- "Basic" is incompatible with protocol "Iterable[Unknown | Basic]"
- "__iter__" is not present (reportArgumentType)
- ...:1331:21 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- ...:1331:21 - error: Argument of type "None" cannot be assigned to parameter "value" of type "Basic" in function "__setitem__"
- "None" is not assignable to "Basic" (reportArgumentType)
- ...:64:2 - error: Argument of type "(expr: ArraySymbol, x: _ArrayExpr) -> (Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims)" cannot be assigned to parameter of type "(...) -> NoReturn"
+ ...:64:2 - error: Argument of type "(expr: ArraySymbol, x: _ArrayExpr) -> (Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims)" cannot be assigned to parameter of type "(...) -> NoReturn"
- Type "(expr: ArraySymbol, x: _ArrayExpr) -> (Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims)" is not assignable to type "(...) -> NoReturn"
+ Type "(expr: ArraySymbol, x: _ArrayExpr) -> (Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims)" is not assignable to type "(...) -> NoReturn"
- Function return type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is incompatible with type "NoReturn"
+ Function return type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is incompatible with type "NoReturn"
- Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to type "NoReturn"
+ Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to type "NoReturn"
- ...:74:2 - error: Argument of type "(expr: MatrixSymbol, x: _ArrayExpr) -> (Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims)" cannot be assigned to parameter of type "(...) -> NoReturn"
+ ...:74:2 - error: Argument of type "(expr: MatrixSymbol, x: _ArrayExpr) -> (Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims)" cannot be assigned to parameter of type "(...) -> NoReturn"
- Type "(expr: MatrixSymbol, x: _ArrayExpr) -> (Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims)" is not assignable to type "(...) -> NoReturn"
+ Type "(expr: MatrixSymbol, x: _ArrayExpr) -> (Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims)" is not assignable to type "(...) -> NoReturn"
- Function return type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is incompatible with type "NoReturn"
+ Function return type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is incompatible with type "NoReturn"
- Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to type "NoReturn"
+ Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to type "NoReturn"
+ ...:50:25 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
+ ...:50:25 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "key" of type "slice[Any, Any, Any]" in function "__setitem__"
+ Type "Unknown | Basic" is not assignable to type "slice[Any, Any, Any]"
+ "Basic" is not assignable to "slice[Any, Any, Any]" (reportArgumentType)
- ...:81:36 - error: Argument of type "Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayDiagonal | ArrayAdd | ArrayContraction" cannot be assigned to parameter "base_array" of type "ArrayContraction | ArrayDiagonal | ArrayTensorProduct" in function "__init__"
+ ...:81:36 - error: Argument of type "Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayContraction" cannot be assigned to parameter "base_array" of type "ArrayContraction | ArrayDiagonal | ArrayTensorProduct" in function "__init__"
- Type "Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayDiagonal | ArrayAdd | ArrayContraction" is not assignable to type "ArrayContraction | ArrayDiagonal | ArrayTensorProduct"
+ Type "Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayContraction" is not assignable to type "ArrayContraction | ArrayDiagonal | ArrayTensorProduct"
- ...:214:12 - error: Type "ArrayContraction | Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayDiagonal | ArrayAdd" is not assignable to declared type "ArrayContraction"
+ ...:214:12 - error: Type "ArrayContraction | Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct" is not assignable to declared type "ArrayContraction"
- Type "ArrayContraction | Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayDiagonal | ArrayAdd" is not assignable to type "ArrayContraction"
+ Type "ArrayContraction | Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct" is not assignable to type "ArrayContraction"
- ...:215:12 - error: Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to declared type "ArrayContraction"
+ ...:215:12 - error: Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to declared type "ArrayContraction"
- Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to type "ArrayContraction"
+ Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to type "ArrayContraction"
- ...:216:12 - error: Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to declared type "ArrayContraction"
+ ...:216:12 - error: Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to declared type "ArrayContraction"
- Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to type "ArrayContraction"
+ Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to type "ArrayContraction"
- ...:217:12 - error: Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to declared type "ArrayContraction"
+ ...:217:12 - error: Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to declared type "ArrayContraction"
- Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims" is not assignable to type "ArrayContraction"
+ Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims" is not assignable to type "ArrayContraction"
- ...:233:39 - error: Cannot access attribute "contraction_indices" for class "ArrayDiagonal"
- Attribute "contraction_indices" is unknown (reportAttributeAccessIssue)
- ...:233:39 - error: Cannot access attribute "contraction_indices" for class "ArrayAdd"
- Attribute "contraction_indices" is unknown (reportAttributeAccessIssue)
+ ...:256:40 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayContraction | ArrayDiagonal" in function "identify_hadamard_products"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayContraction | ArrayDiagonal"
+ Type "Basic" is not assignable to type "ArrayContraction | ArrayDiagonal"
+ "Basic" is not assignable to "ArrayContraction"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
- ...:307:17 - error: Argument of type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims | Any | Transpose" cannot be assigned to parameter "value" of type "None" in function "__setitem__"
+ ...:307:17 - error: Argument of type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims | Any | Transpose" cannot be assigned to parameter "value" of type "None" in function "__setitem__"
- Type "Zero | ZeroArray | ArrayTensorProduct | Unknown | ArrayContraction | Basic | ArrayDiagonal | ArrayAdd | PermuteDims | Any | Transpose" is not assignable to type "None"
+ Type "Zero | ZeroArray | Unknown | ArrayContraction | Basic | PermuteDims | Any | Transpose" is not assignable to type "None"
... (truncated 370 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
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
|
erictraut
approved these changes
May 23, 2025
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.
Alternative to #10494, since that change wasn't sufficient to address the analysis-related telemetry issue we were seeing in Pylance.
#10494 ensured that
_type_checker_internals.pyiwas not flagged as a user file, but since the file was added to theProgramviaaddTrackedFile, it was included in thegetFilesToAnalyzeCountcount. This prevented the following check in Pylance's telemetry code from detecting that analysis was complete:This addresses #10484 and #10487.