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

fix paramspecs being printed as Callable types in inlay hints #943

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

DetachHead
Copy link
Owner

fixes #934

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-typeprinter-paramspec branch from ae20a6e to 797a8b2 Compare December 9, 2024 13:56
Copy link
Contributor

github-actions bot commented Dec 9, 2024

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

sympy (https://github.com/sympy/sympy)
-     Type of "i" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "i" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "rootof" is "(f: Unknown, x: Unknown, index: Unknown | None = None, radicals: bool = True, expand: bool = True) -> (Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr)" (reportUnknownVariableType)
+     Type of "rootof" is "(f: Unknown, x: Unknown, index: Unknown | None = None, radicals: bool = True, expand: bool = True) -> (Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Expr)" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_inequalities.py:134:9 - warning: Type of "inf" is partially unknown
+     Type of "inf" is "One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Unknown" (reportUnknownVariableType)
-     Argument type is "Equality | Unknown" (reportUnknownArgumentType)
+     Argument type is "Equality | Unknown | Relational | Unequality" (reportUnknownArgumentType)
-     Argument type is "Equality | Unknown" (reportUnknownArgumentType)
+     Argument type is "Equality | Unknown | Relational | Unequality" (reportUnknownArgumentType)
-     Type of "e" is "Equality | Unknown | NaN | Sum" (reportUnknownVariableType)
+     Type of "e" is "Equality | Unknown | Relational | Unequality | NaN | Sum" (reportUnknownVariableType)
-     Argument type is "Equality | Unknown" (reportUnknownArgumentType)
+     Argument type is "Equality | Unknown | Relational | Unequality" (reportUnknownArgumentType)
-     Argument type is "Equality | Unknown" (reportUnknownArgumentType)
+     Argument type is "Equality | Unknown | Relational | Unequality" (reportUnknownArgumentType)
-     Argument type is "Equality | Unknown" (reportUnknownArgumentType)
+     Argument type is "Equality | Unknown | Relational | Unequality" (reportUnknownArgumentType)
-     Argument type is "Equality | Unknown" (reportUnknownArgumentType)
+     Argument type is "Equality | Unknown | Relational | Unequality" (reportUnknownArgumentType)
-     Type of "r" is "Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr" (reportUnknownVariableType)
+     Type of "r" is "Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Expr" (reportUnknownVariableType)
-     Type of "ie" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "ie" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "e" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "e" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "eq" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "eq" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "eq" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "eq" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "eq" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "eq" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "wave" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "wave" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "eq" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "eq" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "eq" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "eq" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "sol4" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol4" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "expand" is "((**kwargs: Unknown) -> Equality) | Unknown" (reportUnknownMemberType)
+     Type of "expand" is "((**kwargs: Unknown) -> Equality) | Unknown | ((**kwargs: Unknown) -> Relational) | ((**kwargs: Unknown) -> Unequality)" (reportUnknownMemberType)
-     Type of "expand" is "((**kwargs: Unknown) -> Equality) | Unknown" (reportUnknownMemberType)
+     Type of "expand" is "((**kwargs: Unknown) -> Equality) | Unknown | ((**kwargs: Unknown) -> Relational) | ((**kwargs: Unknown) -> Unequality)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_recurr.py:116:5 - warning: Type of "h" is Any (reportAny)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_recurr.py:116:5 - warning: Type of "h" is unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:104:9 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality | LessThan | bool], Any]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:104:9 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality], Any]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:105:13 - warning: Return type, "Integer | Unknown | NaN | Expr | One | NegativeOne | Zero | Rational | ComplexInfinity | Half", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:109:20 - warning: Return type, "Unknown | NaN | Expr | One | NegativeOne | Zero | Integer | Rational | ComplexInfinity | Half", is partially unknown (reportUnknownVariableType)
-     Type of "constraints" is "list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality | LessThan | bool]" (reportUnknownVariableType)
+     Type of "constraints" is "list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:111:29 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "sum"
+     Argument type is "Generator[Any | Unknown, None, None]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:113:25 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "sum"
+     Argument type is "Generator[Any | Unknown, None, None]" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:114:16 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality | LessThan | bool], Any]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:114:16 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | GreaterThan | Equality | Relational | Unequality], Any]", is partially unknown (reportUnknownVariableType)
-     Type of "r1" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "r1" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "r2" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "r2" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
-     Type of "constraints" is "list[Equality | Unknown | Any]" (reportUnknownVariableType)
+     Type of "constraints" is "list[Equality | Unknown | Relational | Unequality | Any]" (reportUnknownVariableType)
-     Type of "constr" is "Equality | Unknown | Any" (reportUnknownVariableType)
+     Type of "constr" is "Equality | Unknown | Relational | Unequality | Any" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:181:5 - warning: Type of "ans" is partially unknown
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:221:9 - warning: Type of "ans" is partially unknown
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:222:48 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "__init__"
+     Argument type is "zip[tuple[Any, int | Unknown]]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:222:55 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iter2" in function "__new__"
+     Argument type is "list[int | Unknown]" (reportUnknownArgumentType)
-     Type of "eq" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "list[Equality | Unknown | Relational | Unequality]" (reportUnknownVariableType)
-     Type of "i" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "i" is "Equality | Unknown | Relational | Unequality" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:229:9 - warning: Type of "ans" is partially unknown
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:230:53 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "__init__"
+     Argument type is "zip[tuple[Any, int | Unknown]]" (reportUnknownArgumentType)

... (truncated 4857 lines) ...

@DetachHead DetachHead merged commit 66113b8 into main Dec 10, 2024
20 checks passed
@DetachHead DetachHead deleted the fix-typeprinter-paramspec branch December 10, 2024 01:42
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.

Inlay hints show ParamSpec as Callable
1 participant