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

automatically import IPython.display.display in notebooks to match runtime and pylance #1098

Merged
merged 1 commit into from
Feb 23, 2025

Conversation

DetachHead
Copy link
Owner

fixes #1090

@DetachHead DetachHead enabled auto-merge (rebase) February 23, 2025 03:58
@DetachHead DetachHead disabled auto-merge February 23, 2025 03:58
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 "limit_at_inf" is "(num: Unknown, den: Unknown, x: Unknown) -> (NaN | Infinity | NegativeInfinity | Unknown | Literal[0])" (reportUnknownVariableType)
+     Type of "limit_at_inf" is "(num: Unknown, den: Unknown, x: Unknown) -> (NaN | Infinity | NegativeInfinity | _NotImplementedType | Expr | Unknown | Literal[0])" (reportUnknownVariableType)
-     Type of "solve_riccati" is "(fx: Unknown, x: Unknown, b0: Unknown, b1: Unknown, b2: Unknown, gensol: bool = False) -> list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+     Type of "solve_riccati" is "(fx: Unknown, x: Unknown, b0: Unknown, b1: Unknown, b2: Unknown, gensol: bool = False) -> list[Equality | Unknown]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:47:5 - warning: Return type, "tuple[Equality | Unknown | Relational | Unequality | Integer, Unknown, Unknown, Unknown]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:47:5 - warning: Return type, "tuple[Equality | Unknown, Unknown, Unknown, Unknown]", is partially unknown (reportUnknownParameterType)
-     Type of "eq" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+     Type of "eq" is "Equality | Unknown" (reportUnknownVariableType)
-     Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+     Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:58:12 - warning: Return type, "tuple[Equality | Unknown | Relational | Unequality | Integer, Unknown, Unknown, Unknown]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:58:12 - warning: Return type, "tuple[Equality | Unknown, Unknown, Unknown, Unknown]", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:76:5 - warning: Type of "tests" is partially unknown
-     Type of "tests" is "list[tuple[Any, Any, Any, Any | Unknown] | tuple[Any, Any, Any, Any] | tuple[Any, int, Any, Any]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:103:20 - warning: Type of "y" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:103:20 - warning: Type of "y" is Any (reportAny)
-     Type of "y" is "Any | Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:105:21 - warning: Type of "cancel" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:105:21 - warning: Type of "cancel" is Any (reportAny)
-     Type of "cancel" is "Any | Unknown" (reportUnknownMemberType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:105:44 - warning: Argument type is Any
+     Argument corresponds to parameter "y" in function "riccati_inverse_normal" (reportAny)
-     Type of "tests" is "list[tuple[Any | Unknown, bool, Any, Any, Any] | tuple[Any | Unknown, bool, Any | Unknown, Any, Any] | tuple[Any | Unknown, bool, int, int, int] | tuple[Expr | Unknown, bool, int, int, int]]" (reportUnknownVariableType)
+     Type of "tests" is "list[tuple[Any | Unknown, bool, Any, Any, Any] | tuple[Any | Unknown, bool, int, int, int] | tuple[Expr | Unknown, bool, int, int, int]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:275:18 - warning: Type of "b0" is partially unknown
-     Type of "b0" is "Any | Unknown | int" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:375:5 - warning: Type of "tests" is partially unknown
-     Type of "tests" is "list[tuple[Poly, Poly, int] | tuple[Poly, Poly, Infinity] | tuple[Poly, Poly, NegativeInfinity] | tuple[Poly, Poly, ComplexInfinity | Rational | Unknown]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:406:19 - warning: Type of "lim" is partially unknown
-     Type of "lim" is "int | Infinity | NegativeInfinity | ComplexInfinity | Rational | Unknown" (reportUnknownVariableType)
-     Type of "tests" is "list[tuple[Poly, Poly, Integer, list[list[Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | Unknown, list[list[Expr | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | Number | Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | Unknown | NaN | Expr | Infinity | NegativeInfinity | Zero | Float, list[list[Expr | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | Number | Unknown]]]]" (reportUnknownVariableType)
+     Type of "tests" is "list[tuple[Poly, Poly, Integer, list[list[Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr, list[list[Expr | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | Number | Unknown]]]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:444:19 - warning: Type of "pole" is partially unknown
-     Type of "pole" is "Integer | ComplexInfinity | Rational | Unknown | NaN | Expr | Infinity | NegativeInfinity | Zero | Float" (reportUnknownVariableType)
-     Type of "tests" is "list[tuple[Poly, Poly, int, int, list[list[Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | Unknown, int, list[list[ComplexInfinity | Rational | Unknown]]] | tuple[Poly, Poly, int, int, list[list[Expr | Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | Unknown, int, list[list[Expr | Unknown]]] | tuple[Poly, Poly, Expr, int, list[list[Expr | Unknown]]]]" (reportUnknownVariableType)
+     Type of "tests" is "list[tuple[Poly, Poly, int, int, list[list[Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr, int, list[list[ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr]]] | tuple[Poly, Poly, int, int, list[list[Expr | Unknown]]] | tuple[Poly, Poly, ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr, int, list[list[Expr]]] | tuple[Poly, Poly, Expr, int, list[list[Expr | Unknown]]]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:506:19 - warning: Type of "pole" is partially unknown
-     Type of "pole" is "int | ComplexInfinity | Rational | Unknown | Expr" (reportUnknownVariableType)
-     Type of "c" is "list[list[Unknown]] | list[list[ComplexInfinity | Rational | Unknown]] | list[list[Expr | Unknown]]" (reportUnknownVariableType)
+     Type of "c" is "list[list[Unknown]] | list[list[ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr]] | list[list[Expr | Unknown]] | list[list[Expr]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:662:5 - warning: Type of "tests" is partially unknown
-     Type of "tests" is "list[tuple[Poly, Poly, Integer, int, int, dict[int, int]] | tuple[Poly, Poly, ComplexInfinity | Rational | Unknown, int, int, dict[int, ComplexInfinity | Rational | Unknown]] | tuple[Poly, Poly, Expr, int, int, dict[int, Expr]] | tuple[Poly, Poly, Infinity, int, int, dict[int, int]] | tuple[Poly, Poly, Infinity, int, int, dict[int, int | ComplexInfinity | Rational | Unknown]]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:709:19 - warning: Type of "x0" is partially unknown
-     Type of "x0" is "Integer | ComplexInfinity | Rational | Unknown | Expr | Infinity" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_riccati.py:709:31 - warning: Type of "ser" is partially unknown
-     Type of "ser" is "dict[int, int] | dict[int, ComplexInfinity | Rational | Unknown] | dict[int, Expr] | dict[int, int | ComplexInfinity | Rational | Unknown]" (reportUnknownVariableType)
-     Type of "sols" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+     Type of "sols" is "list[Equality | Unknown]" (reportUnknownVariableType)

... (truncated 3262 lines) ...

static-frame (https://github.com/static-frame/static-frame)

ignite (https://github.com/pytorch/ignite)
-   /tmp/mypy_primer/projects/ignite/examples/notebooks/HandlersTimeProfiler_MNIST.ipynb:2:14:1 - error: "display" is not defined (reportUndefinedVariable)
- 3265 errors, 56017 warnings, 0 notes
+ 3264 errors, 56017 warnings, 0 notes

spack (https://github.com/spack/spack)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/yorick/package.py:26: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/builtin/packages/yorick/package.py:26: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/builtin/packages/yorick/package.py:27: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/builtin/packages/yorick/package.py:27: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/builtin/packages/yorick/package.py:28: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/builtin/packages/yorick/package.py:28: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/builtin/packages/yorick/package.py:32: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/builtin/packages/yorick/package.py:32: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/builtin/packages/yorick/package.py:33: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/builtin/packages/yorick/package.py:33: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/builtin/packages/yosys/package.py:63: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/builtin/packages/yosys/package.py:63: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/builtin/packages/yosys/package.py:64: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/builtin/packages/yosys/package.py:64: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/builtin/packages/yosys/package.py:69: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/builtin/packages/yosys/package.py:69: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/builtin/packages/yosys/package.py:70: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/builtin/packages/yosys/package.py:70: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/builtin/packages/yosys/package.py:71: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/builtin/packages/yosys/package.py:71: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/builtin/packages/yosys/package.py:72: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/builtin/packages/yosys/package.py:72: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/builtin/packages/yosys/package.py:73: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/builtin/packages/yosys/package.py:73: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/builtin/packages/yosys/package.py:74: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/builtin/packages/yosys/package.py:74: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/builtin/packages/yosys/package.py:75: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/builtin/packages/yosys/package.py:75: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/builtin/packages/yosys/package.py:76: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/builtin/packages/yosys/package.py:76: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/builtin/packages/yosys/package.py:77: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/builtin/packages/yosys/package.py:77: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/builtin/packages/yosys/package.py:78: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/builtin/packages/yosys/package.py:78: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/builtin/packages/yq/package.py:29: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/builtin/packages/yq/package.py:29: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/builtin/packages/yq/package.py:30: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 703 lines) ...

artigraph (https://github.com/artigraph/artigraph)

@DetachHead DetachHead merged commit e832f1a into main Feb 23, 2025
20 checks passed
@DetachHead DetachHead deleted the import-ipython.display-in-notebooks branch February 23, 2025 04:41
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.

[Jupyter] "display" is not defined
1 participant