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

remove incorrect diagnostic for invalid python identifier in dataclass field aliases and prevent them from appearing in completions #838

Merged
merged 4 commits into from
Nov 1, 2024

Conversation

DetachHead
Copy link
Owner

fixes #837

This comment has been minimized.

@DetachHead DetachHead changed the title remove diagnostic for invalid python identifier in dataclass field aliases and prevent them from appearing in completions remove incorrect diagnostic for invalid python identifier in dataclass field aliases and prevent them from appearing in completions Nov 1, 2024
Copy link
Contributor

github-actions bot commented Nov 1, 2024

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

sympy (https://github.com/sympy/sympy)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:107:9 - warning: Return type, "tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Sum | Integral | None", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:107:9 - warning: Return type, "tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Integral | None", is partially unknown (reportUnknownParameterType)
-     Type of "compute_expectation" is "(expr: Unknown, rvs: Unknown | None = None, **kwargs: Unknown) -> (tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Sum | None)" (reportUnknownMemberType)
+     Type of "compute_expectation" is "(expr: Unknown, rvs: Unknown | None = None, **kwargs: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:113:20 - warning: Return type, "tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Sum | None", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/compound_rv.py:113:20 - warning: Return type, "tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None", is partially unknown (reportUnknownVariableType)
-     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None)) | ((**hints: Unknown) -> Unknown)" (reportUnknownMemberType)
+     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | None)) | ((**hints: Unknown) -> Unknown)" (reportUnknownMemberType)
-     Type of "summation" is "(f: Unknown, ...) -> (Equality | Relational | Unequality | Unknown)" (reportUnknownVariableType)
+     Type of "summation" is "(f: Unknown, ...) -> (tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None)" (reportUnknownVariableType)
-     Type of "density" is "(expr: Unknown, condition: Unknown | None = None, evaluate: bool = True, numsamples: Unknown | None = None, **kwargs: Unknown) -> (dict[Unknown, Unknown] | Density | Lambda | Basic | Any | Unknown | FiniteDensity | None)" (reportUnknownVariableType)
+     Type of "density" is "(expr: Unknown, condition: Unknown | None = None, evaluate: bool = True, numsamples: Unknown | None = None, **kwargs: Unknown) -> Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/drv.py:242:13 - warning: Type of "dens" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/stats/drv.py:242:13 - warning: Type of "dens" is unknown (reportUnknownVariableType)
-     Type of "dens" is "dict[Unknown, Unknown] | Density | Lambda | Basic | Any | Unknown | FiniteDensity | None" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/drv.py:245:53 - warning: Argument type is unknown
+     Argument corresponds to parameter "pdf" in function "__new__" (reportUnknownArgumentType)
-     Type of "doit" is "Unknown | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None)) | ((**hints: Unknown) -> Self@Expr) | ((**hints: Unknown) -> Order) | Any | ((**hints: Unknown) -> Piecewise) | ((**hints: Unknown) -> Basic) | ((**hints: Unknown) -> Equality) | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality)" (reportUnknownMemberType)
+     Type of "doit" is "Unknown | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | None)) | ((**hints: Unknown) -> Self@Expr) | ((**hints: Unknown) -> Order) | Any | ((**hints: Unknown) -> Piecewise) | ((**hints: Unknown) -> Basic) | ((**hints: Unknown) -> Equality) | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality)" (reportUnknownMemberType)
-     Type of "probability" is "(condition: Unknown) -> Unknown" (reportUnknownMemberType)
+     Type of "probability" is "(condition: Unknown) -> (Unknown | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | int)" (reportUnknownMemberType)
-     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None))" (reportUnknownMemberType)
+     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | None))" (reportUnknownMemberType)
-     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None))" (reportUnknownMemberType)
+     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | None))" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/frv.py:443:9 - warning: Return type, "tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Sum | None", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/frv.py:443:9 - warning: Return type, "tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None", is partially unknown (reportUnknownParameterType)
-     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Sum | None))" (reportUnknownMemberType)
+     Type of "doit" is "((**hints: Unknown) -> Equality) | Unknown | ((**hints: Unknown) -> Relational) | ((**hints: Unknown) -> Unequality) | ((**hints: Unknown) -> (tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | None))" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/frv.py:451:20 - warning: Return type, "tuple[Unknown, ...] | Unknown | Self@Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | Sum | None", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/stats/frv.py:451:20 - warning: Return type, "tuple[Unknown, ...] | Unknown | Sum | Self@Expr | Order | Any | Piecewise | Basic | Equality | Relational | Unequality | None", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/frv_types.py:236:16 - error: Operator "&" not supported for types "_NotImplementedType | GreaterThan | Unknown | Equality | Relational | Unequality" and "_NotImplementedType | LessThan | Unknown | Equality | Relational | Unequality"
-     Operator "&" not supported for types "GreaterThan" and "LessThan"
-     Operator "&" not supported for types "GreaterThan" and "Equality"
-     Operator "&" not supported for types "GreaterThan" and "Relational"
-     Operator "&" not supported for types "GreaterThan" and "Unequality"
-     Operator "&" not supported for types "Equality" and "LessThan"
-     Operator "&" not supported for types "Equality" and "Equality"
-     Operator "&" not supported for types "Equality" and "Relational"
-     Operator "&" not supported for types "Equality" and "Unequality"
-     ... (reportOperatorIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/frv_types.py:425:16 - error: Operator "&" not supported for types "_NotImplementedType | GreaterThan | Unknown | Equality | Relational | Unequality" and "_NotImplementedType | LessThan | Unknown | Equality | Relational | Unequality"
-     Operator "&" not supported for types "GreaterThan" and "LessThan"
-     Operator "&" not supported for types "GreaterThan" and "Equality"
-     Operator "&" not supported for types "GreaterThan" and "Relational"
-     Operator "&" not supported for types "GreaterThan" and "Unequality"
-     Operator "&" not supported for types "Equality" and "LessThan"
-     Operator "&" not supported for types "Equality" and "Equality"
-     Operator "&" not supported for types "Equality" and "Relational"
-     Operator "&" not supported for types "Equality" and "Unequality"
-     ... (reportOperatorIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/stats/frv_types.py:713:17 - error: Operator "&" not supported for types "_NotImplementedType | GreaterThan | Unknown | Equality | Relational | Unequality" and "_NotImplementedType | LessThan | Unknown | Equality | Relational | Unequality"

... (truncated 409 lines) ...

asynq (https://github.com/quora/asynq): 212.37x slower (0.1s -> 13.1s in a single noisy sample)

@DetachHead DetachHead merged commit 191cfc3 into main Nov 1, 2024
20 checks passed
@DetachHead DetachHead deleted the fix-dataclass-alias branch November 1, 2024 08:07
@DetachHead DetachHead mentioned this pull request Nov 5, 2024
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.

incorrect error on dataclass_transform aliases that aren't valid python names
1 participant