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 language server crash when diagnosticMode is "workspace" and workspace contains jupyter notebooks that haven't yet been opened #1065

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

DetachHead
Copy link
Owner

fixes #1055

…workspace contains jupyter notebooks that haven't yet been opened
Copy link
Contributor

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

sympy (https://github.com/sympy/sympy)
-     Type of "eq" is "Unknown | Expr | Any | Integer | None" (reportUnknownVariableType)
+     Type of "eq" is "Unknown | None" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:128:19 - warning: Argument type is unknown
+     Argument corresponds to parameter "expr" in function "_mexpand" (reportUnknownArgumentType)
-     Type of "mainlog" is "log | Any | Unknown | None" (reportUnknownVariableType)
+     Type of "mainlog" is "Unknown | None" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:132:5 - warning: Type of "other" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:132:5 - warning: Type of "other" is unknown (reportUnknownVariableType)
-     Type of "other" is "Expr | Any | Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:132:13 - warning: Type of "subs" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:132:13 - warning: Type of "subs" is unknown (reportUnknownMemberType)
-     Type of "subs" is "Unknown | Overload[(arg1: Mapping[Basic | complex, Expr | complex], arg2: None = None) -> Expr, (arg1: Iterable[tuple[Basic | complex, Expr | complex]], arg2: None = None, **kwargs: Any) -> Expr, (arg1: Expr | complex, arg2: Expr | complex) -> Expr, (arg1: Mapping[Basic | complex, Basic | complex], arg2: None = None, **kwargs: Any) -> Basic, (arg1: Iterable[tuple[Basic | complex, Basic | complex]], arg2: None = None, **kwargs: Any) -> Basic, (arg1: Basic | complex, arg2: Basic | complex, **kwargs: Any) -> Basic] | Any" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:132:21 - warning: Argument type is partially unknown
-     Argument corresponds to parameter "arg1" in function "subs"
-     Argument type is "log | Any | Unknown" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:134:9 - warning: Type of "eq" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:134:9 - warning: Type of "eq" is unknown (reportUnknownVariableType)
-     Type of "eq" is "Expr | Any | Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:134:14 - warning: Type of "subs" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:134:14 - warning: Type of "subs" is unknown (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:134:32 - warning: Argument type is partially unknown
-     Argument type is "log | Any | Unknown" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:134:41 - warning: Argument type is partially unknown
-     Argument corresponds to parameter "arg2" in function "subs"
-     Type of "args" is "Tuple[Expr] | Any | Unknown" (reportUnknownMemberType)
+     Type of "args" is "Unknown" (reportUnknownMemberType)
-     Type of "mainlog" is "Expr | Any | Unknown" (reportUnknownVariableType)
+     Type of "mainlog" is "Unknown" (reportUnknownVariableType)
-     Type of "args" is "Tuple[Expr] | Any | Unknown" (reportUnknownMemberType)
+     Type of "args" is "Unknown" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:138:17 - error: Operator "-" not supported for type "Basic | Any | Unknown" (reportOperatorIssue)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:138:18 - warning: Type of "args" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:138:18 - warning: Type of "args" is unknown (reportUnknownMemberType)
-     Type of "args" is "tuple[Basic, ...] | Any | Unknown" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:139:9 - warning: Type of "eq" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:139:9 - warning: Type of "eq" is unknown (reportUnknownVariableType)
-     Type of "eq" is "Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:140:17 - warning: Type of "free_symbols" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:140:17 - warning: Type of "free_symbols" is unknown (reportUnknownMemberType)
-     Type of "free_symbols" is "Unknown | set[Basic] | Any" (reportUnknownMemberType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:142:23 - warning: Argument type is unknown
+     Argument corresponds to parameter "arg" in function "_linab" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:143:23 - warning: Argument type is unknown
-     Type of "logarg" is "Expr | Any | Unknown" (reportUnknownVariableType)
+     Type of "logarg" is "Expr | Unknown" (reportUnknownVariableType)
-     Type of "args" is "Tuple[Expr] | Any | Unknown" (reportUnknownMemberType)
+     Type of "args" is "Tuple[Expr] | Unknown" (reportUnknownMemberType)
-     Type of "eq" is "Unknown | Expr | Any" (reportUnknownVariableType)
+     Type of "eq" is "Unknown | Expr | Any | Self@Expr" (reportUnknownVariableType)
-     Type of "lhs" is "Unknown | Expr | Any" (reportUnknownVariableType)
+     Type of "lhs" is "Unknown | Expr | Any | Self@Expr" (reportUnknownVariableType)
-     Type of "lhs" is "Unknown | Expr | Any" (reportUnknownVariableType)
+     Type of "lhs" is "Unknown | Expr | Self@Expr | Any" (reportUnknownVariableType)
-     Type of "xreplace" is "Unknown | ((rule: Unknown) -> (Unknown | Expr)) | Any" (reportUnknownMemberType)
+     Type of "xreplace" is "Unknown | ((rule: Unknown) -> (Unknown | Expr)) | Any | ((rule: Unknown) -> (Unknown | Self@Expr))" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:460:9 - warning: Type of "f" is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:460:9 - warning: Type of "f" is partially unknown
+     Type of "f" is "Unknown | Expr" (reportUnknownVariableType)
-     Type of "as_expr" is "(*gens: Unknown) -> Unknown" (reportUnknownMemberType)
+     Type of "as_expr" is "(*gens: Unknown) -> (Unknown | Expr)" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:463:34 - warning: Type of "subs" is unknown (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:463:34 - warning: Argument type is unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:463:34 - warning: Type of "subs" is partially unknown
-     Argument corresponds to parameter "rep" in function "__new__" (reportUnknownArgumentType)
+     Type of "subs" is "Unknown | Overload[(arg1: Mapping[Basic | complex, Expr | complex], arg2: None = None) -> Expr, (arg1: Iterable[tuple[Basic | complex, Expr | complex]], arg2: None = None, **kwargs: Any) -> Expr, (arg1: Expr | complex, arg2: Expr | complex) -> Expr, (arg1: Mapping[Basic | complex, Basic | complex], arg2: None = None, **kwargs: Any) -> Basic, (arg1: Iterable[tuple[Basic | complex, Basic | complex]], arg2: None = None, **kwargs: Any) -> Basic, (arg1: Basic | complex, arg2: Basic | complex, **kwargs: Any) -> Basic]" (reportUnknownMemberType)
-     Type of "a" is "Unknown | Expr | Any | Self@Expr | Self@Add | None" (reportUnknownVariableType)
+     Type of "a" is "Unknown | None" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:477:9 - warning: Type of "free" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:477:9 - warning: Type of "free" is unknown (reportUnknownVariableType)
-     Type of "free" is "Unknown | set[Basic] | Any" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:477:16 - warning: Type of "free_symbols" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/bivariate.py:477:16 - warning: Type of "free_symbols" is unknown (reportUnknownMemberType)
-     Type of "free_symbols" is "Unknown | set[Basic] | Any" (reportUnknownMemberType)
-     Type of "decompose" is "(f: Unknown, ...) -> (list[Unknown] | list[Unknown | Poly] | Unknown)" (reportUnknownVariableType)
+     Type of "decompose" is "(f: Unknown, ...) -> (list[Unknown | Expr] | list[Unknown | Poly] | Unknown)" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/decompogen.py:9:5 - warning: Return type, "list[Expr] | list[Function | Pow] | list[Expr | Basic] | list[Function | Pow | Basic] | Unknown | list[Min | Max | Basic] | list[Unknown | Max | Min | Basic] | list[Basic] | list[Unknown | Poly | Basic] | list[Min | Max] | list[Unknown | Max | Min] | list[Unknown] | list[Unknown | Poly]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/decompogen.py:9:5 - warning: Return type, "list[Expr] | list[Function | Pow] | list[Expr | Basic] | list[Function | Pow | Basic] | Unknown | list[Min | Max | Basic] | list[Unknown | Max | Min | Basic] | list[Basic] | list[Unknown | Expr | Basic] | list[Unknown | Poly | Basic] | list[Min | Max] | list[Unknown | Max | Min] | list[Unknown | Expr] | list[Unknown | Poly]", is partially unknown (reportUnknownParameterType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/decompogen.py:51:16 - warning: Return type, "list[Expr | Basic] | list[Function | Pow | Basic] | Unknown | list[Min | Max | Basic] | list[Unknown | Max | Min | Basic] | list[Basic] | list[Unknown | Poly | Basic]", is partially unknown (reportUnknownVariableType)

... (truncated 1118 lines) ...

spack (https://github.com/spack/spack)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/duplicates.test/packages/virtual-build/package.py:15:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/duplicates.test/packages/virtual-build/package.py:15:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/blas-only-client/package.py:18:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/blas-only-client/package.py:18:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/conditional-edge/package.py:21:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/conditional-edge/package.py:22:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/conditional-edge/package.py:23:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/conditional-edge/package.py:21:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/conditional-edge/package.py:22:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/edges.test/packages/conditional-edge/package.py:23:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:10:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:10:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:11:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:11:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:12:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:12:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:14:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/t/package.py:14:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/u/package.py:10:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/u/package.py:10:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/u/package.py:12:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/u/package.py:12:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/v/package.py:11:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/v/package.py:11:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/v/package.py:13:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/v/package.py:13:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:13:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:13:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:14:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:14:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:15:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:15:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/w/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/x/package.py:12:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/x/package.py:12:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/flags.test/packages/x/package.py:13:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)

... (truncated 63 lines) ...

arviz (https://github.com/arviz-devs/arviz): 2.69x slower (12.8s -> 34.4s in a single noisy sample)

@DetachHead DetachHead merged commit 7d4104f into main Feb 12, 2025
20 checks passed
@DetachHead DetachHead deleted the fix-notebook-disgnosticmode-workspace-crash branch February 12, 2025 11:49
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.

crash when notebooks are present in the workspace and diagnosticMode is "workspace"
1 participant