-
Notifications
You must be signed in to change notification settings - Fork 102
Do not type-check non-python cells in Jupyter Notebooks #1282
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
base: main
Are you sure you want to change the base?
Conversation
|
thanks for the contribution! i just want to make sure i fully understand the issue before we merge this, see #1281 (comment) |
This comment has been minimized.
This comment has been minimized.
| // Make sure we don't return any non-python cells | ||
| if ( | ||
| source && | ||
| ['%sql', '%%sql', '%sh', '%pip', '%run', '%fs', '%load', '%matplotlib', '%who', '%env'].includes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this is the correct spot for this because this method is only called when running basedpyright from the CLI. when using the language server, the file contents get passed to the SourceFile object by writing to this._writableData.clientDocumentContents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, is there a method or so where this filtering would make sense? How do I test the language server?
| // Make sure we don't return any non-python cells | ||
| if ( | ||
| source && | ||
| ['%sql', '%%sql', '%sh', '%pip', '%run', '%fs', '%load', '%matplotlib', '%who', '%env'].includes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only checks the first line of the file. is %sql only valid on the first line? what if there's a newline or something before the line? if we need more complicated logic for stuff like that, then i think this logic should go in the parser with the rest of the ipython magics support, see
basedpyright/packages/pyright-internal/src/parser/tokenizer.ts
Lines 1240 to 1261 in 8b0f262
| private _getIPythonMagicsKind(): 'line' | 'cell' | undefined { | |
| if (!isMagicChar(this._cs.currentChar)) { | |
| return undefined; | |
| } | |
| const prevToken = this._tokens.length > 0 ? this._tokens[this._tokens.length - 1] : undefined; | |
| if (prevToken !== undefined && !isWhitespace(prevToken)) { | |
| return undefined; | |
| } | |
| if (this._cs.nextChar === this._cs.currentChar) { | |
| // Eat up next magic char. | |
| this._cs.moveNext(); | |
| return 'cell'; | |
| } | |
| return 'line'; | |
| function isMagicChar(ch: number) { | |
| return ch === Char.Percent || ch === Char.ExclamationMark; | |
| } | |
| } |
is there a way i can run databricks notebooks locally so i can mess around with it myself to learn how they work? it looks like i have to make an account and run it on their site or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%sql is valid on the first line of a cell, and this method is called per cell so I think it's ok. Also the test I added is in the 3rd cell.
There is no way of detecting databricks notebooks easily, you can also author them with vs code and it will work just fine. It's really just a jupyter notebook where you see %sql in the first cell. So I do not think we can distinguish between Databricks / Non-Databricks
| // Make sure we don't return any non-python cells | ||
| if ( | ||
| source && | ||
| ['%sql', '%%sql', '%sh', '%pip', '%run', '%fs', '%load', '%matplotlib', '%who', '%env'].includes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm also a bit skeptical about this change because it prevents errors from correctly appearing for users that are just working with regular notebooks. we still want to report an error for this invalid syntax on regular notebooks.
i think if we do this we need a new setting called databricksNotebooks or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a more generic setting allowing to skip cells based on magic would be good
Update from main
|
basedpyright already reads |
|
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
- Type of "nthroot" is "(expr: Unknown, n: Unknown, max_len: int = 4, prec: int = 15) -> (Unknown | Integer | NaN | ComplexInfinity | Rational | Zero | NegativeInfinity | Infinity | Float | Number | Expr | None)" (reportUnknownVariableType)
+ Type of "nthroot" is "(expr: Unknown, n: Unknown, max_len: int = 4, prec: int = 15) -> (Unknown | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | NegativeInfinity | Infinity | Float | Number | Expr | Any | Mul | Add | None)" (reportUnknownVariableType)
+ ...:248:20 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
- ...:264:5 - warning: Type of "p" is partially unknown
- Type of "p" is "Unknown | Expr | Any" (reportUnknownVariableType)
- ...:267:5 - warning: Type of "p" is partially unknown
- Type of "p" is "Unknown | Expr | Any" (reportUnknownVariableType)
+ ...:254:39 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
+ ...:256:20 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
+ ...:258:20 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
+ ...:259:20 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
+ ...:264:5 - warning: Type of "p" is unknown (reportUnknownVariableType)
+ ...:265:20 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
+ ...:267:5 - warning: Type of "p" is unknown (reportUnknownVariableType)
+ ...:268:20 - warning: Argument type is unknown
+ Argument corresponds to parameter "expr" in function "nthroot" (reportUnknownArgumentType)
- Type of "d2" is "Integer | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | Expr | Unknown" (reportUnknownVariableType)
+ Type of "d2" is "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr | Unknown" (reportUnknownVariableType)
- Argument type is "Any | Unknown | Expr | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | Integer" (reportUnknownArgumentType)
+ Argument type is "Any | Unknown | Expr | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | One | NegativeOne | Integer" (reportUnknownArgumentType)
- Argument type is "Any | Unknown | Expr | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | Integer" (reportUnknownArgumentType)
+ Argument type is "Any | Unknown | Expr | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | One | NegativeOne | Integer" (reportUnknownArgumentType)
- ...:10:46 - warning: Type of "igcd" is partially unknown
- Type of "igcd" is "_lru_cache_wrapper[Unknown]" (reportUnknownVariableType)
- ...:354:22 - warning: Argument type is unknown
- Argument corresponds to parameter "object" in function "append" (reportUnknownArgumentType)
- ...:358:17 - warning: Type of "gcd" is unknown (reportUnknownVariableType)
- ...:361:29 - warning: Argument type is unknown
- Argument corresponds to parameter "object" in function "insert" (reportUnknownArgumentType)
- ...:551:17 - warning: Type of "g" is unknown (reportUnknownVariableType)
- ...:552:17 - warning: Type of "a" is unknown (reportUnknownVariableType)
- ...:553:17 - warning: Type of "c" is unknown (reportUnknownVariableType)
- ...:556:29 - warning: Argument type is unknown
- Argument corresponds to parameter "n" in function "isqrt" (reportUnknownArgumentType)
- ...:557:29 - warning: Argument type is unknown
- Argument corresponds to parameter "n" in function "isqrt" (reportUnknownArgumentType)
- ...:561:21 - warning: Type of "eq" is unknown (reportUnknownVariableType)
- ...:562:43 - warning: Argument type is unknown
- Argument corresponds to parameter "f" in function "solveset_real" (reportUnknownArgumentType)
- ...:567:33 - warning: Argument type is unknown
- Argument corresponds to parameter "x" in function "int_valued" (reportUnknownArgumentType)
- ...:576:39 - warning: Argument type is unknown
- Argument corresponds to parameter "a" in function "divisible" (reportUnknownArgumentType)
- ...:577:39 - warning: Argument type is unknown
- Argument corresponds to parameter "a" in function "divisible" (reportUnknownArgumentType)
- ...:1214:9 - warning: Type of "g" is unknown (reportUnknownVariableType)
- ...:1219:9 - warning: Type of "g" is unknown (reportUnknownVariableType)
- ...:3002:5 - warning: Type of "pc" is unknown (reportUnknownVariableType)
- ...:3005:5 - warning: Type of "pa" is unknown (reportUnknownVariableType)
- ...:3008:5 - warning: Type of "pb" is unknown (reportUnknownVariableType)
- ...:3055:19 - warning: Argument type is unknown
- Argument corresponds to parameter "n" in function "factorint" (reportUnknownArgumentType)
- Type of "gcd" is "(f: Unknown, g: Unknown | None = None, ...) -> (Any | Unknown | Zero | NaN | Infinity | NegativeInfinity | Float | Number | Expr | Integer | Rational | Poly)" (reportUnknownVariableType)
+ Type of "gcd" is "(f: Unknown, g: Unknown | None = None, ...) -> (Any | Unknown | Zero | NaN | Infinity | NegativeInfinity | Float | Number | One | NegativeOne | Integer | Expr | Rational | Poly)" (reportUnknownVariableType)
- ...:62:5 - warning: Return type, "dict[str, Unknown | Add | Expr | Mul | Any | Zero | NaN | Infinity | NegativeInfinity | Float | Number | Integer | Rational | Poly | str | list[Unknown]] | None", is partially unknown (reportUnknownParameterType)
+ ...:62:5 - warning: Return type, "dict[str, Unknown | Add | Expr | Mul | Any | Zero | NaN | Infinity | NegativeInfinity | Float | Number | One | NegativeOne | Integer | Rational | Poly | str | list[Unknown]] | None", is partially unknown (reportUnknownParameterType)
- Type of "as_base_exp" is "Unknown | (() -> (tuple[Integer, Expr] | tuple[Expr, Expr]))" (reportUnknownMemberType)
+ Type of "as_base_exp" is "Unknown | (() -> (tuple[One | NegativeOne | Zero | Integer, Expr] | tuple[Expr, Expr]))" (reportUnknownMemberType)
- Type of "k" is "Any | Unknown | Zero | NaN | Infinity | NegativeInfinity | Float | Number | Expr | Integer | Rational | Poly" (reportUnknownVariableType)
+ Type of "k" is "Any | Unknown | Zero | NaN | Infinity | NegativeInfinity | Float | Number | One | NegativeOne | Integer | Expr | Rational | Poly" (reportUnknownVariableType)
- ...:130:16 - warning: Return type, "dict[str, Unknown | Add | Expr | Mul | Any | Zero | NaN | Infinity | NegativeInfinity | Float | Number | Integer | Rational | Poly | str | list[Unknown]]", is partially unknown (reportUnknownVariableType)
+ ...:130:16 - warning: Return type, "dict[str, Unknown | Add | Expr | Mul | Any | Zero | NaN | Infinity | NegativeInfinity | Float | Number | One | NegativeOne | Integer | Rational | Poly | str | list[Unknown]]", is partially unknown (reportUnknownVariableType)
- ...:534:17 - warning: Type of "polyy" is unknown (reportUnknownVariableType)
+ ...:534:17 - warning: Type of "polyy" is partially unknown
+ Type of "polyy" is "dict[tuple[int], Unknown] | dict[Unknown, Unknown] | dict[tuple[int, ...], Any] | Unknown" (reportUnknownVariableType)
+ ...:537:33 - warning: Type of "values" is partially unknown
+ Type of "values" is "(() -> dict_values[tuple[int], Unknown]) | (() -> dict_values[Unknown, Unknown]) | (() -> dict_values[tuple[int, ...], Any]) | Unknown" (reportUnknownMemberType)
- ...:537:33 - warning: Type of "values" is unknown (reportUnknownMemberType)
- ...:537:33 - warning: Argument type is unknown
- Argument corresponds to parameter "f" in function "solve" (reportUnknownArgumentType)
- ...:600:17 - warning: Type of "cpoly" is unknown (reportUnknownVariableType)
+ ...:600:17 - warning: Type of "cpoly" is partially unknown
+ Type of "cpoly" is "dict[tuple[int], Unknown] | dict[Unknown, Unknown] | dict[tuple[int, ...], Any] | Unknown" (reportUnknownVariableType)
+ ...:603:37 - warning: Type of "values" is partially unknown
+ Type of "values" is "(() -> dict_values[tuple[int], Unknown]) | (() -> dict_values[Unknown, Unknown]) | (() -> dict_values[tuple[int, ...], Any]) | Unknown" (reportUnknownMemberType)
- ...:603:37 - warning: Type of "values" is unknown (reportUnknownMemberType)
- ...:603:37 - warning: Argument type is unknown
- Argument corresponds to parameter "f" in function "solve" (reportUnknownArgumentType)
- Type of "rootof" is "(f: Unknown, x: Unknown, index: Unknown | None = None, radicals: bool = True, expand: bool = True) -> (Unknown | Integer | NaN | ComplexInfinity | Rational | Zero | 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 | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr)" (reportUnknownVariableType)
- Type of "chareqroots" is "list[Unknown | Integer | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr]" (reportUnknownVariableType)
+ Type of "chareqroots" is "list[Unknown | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr]" (reportUnknownVariableType)
... (truncated 1529 lines) ...
xarray (https://github.com/pydata/xarray)
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
- /tmp/mypy_primer/projects/xarray/doc/examples/area_weighted_temperature.ipynb - cell 1
- ...:1:3:8 - error: Import "cartopy.crs" could not be resolved (reportMissingImports)
- ...:1:4:8 - error: Import "matplotlib.pyplot" could not be resolved (reportMissingImports)
+ ...:2:1:1 - warning: Type of "ds" is unknown (reportUnknownVariableType)
+ ...:2:1:6 - error: "xr" is not defined (reportUndefinedVariable)
+ ...:2:1:6 - warning: Type of "tutorial" is unknown (reportUnknownMemberType)
- ...:2:1:6 - warning: Type of "load_dataset" is partially unknown
+ ...:2:1:6 - warning: Type of "load_dataset" is unknown (reportUnknownMemberType)
- Type of "load_dataset" is "(...) -> Dataset" (reportUnknownMemberType)
- ...:2:4:1 - warning: Type of "air" is Any (reportAny)
+ ...:2:4:1 - warning: Type of "air" is unknown (reportUnknownVariableType)
- ...:2:4:7 - warning: Type of "air" is Any (reportAny)
+ ...:2:4:7 - warning: Type of "air" is unknown (reportUnknownMemberType)
- ...:2:7:1 - warning: Type of "air" is Any (reportAny)
+ ...:2:7:1 - warning: Type of "air" is unknown (reportUnknownVariableType)
- ...:2:7:7 - warning: Type of "resample" is Any (reportAny)
+ ...:2:7:7 - warning: Type of "resample" is unknown (reportUnknownMemberType)
- ...:2:7:7 - warning: Type of "mean" is Any (reportAny)
+ ...:2:7:7 - warning: Type of "mean" is unknown (reportUnknownMemberType)
+ ...:3:1:14 - error: "ccrs" is not defined (reportUndefinedVariable)
+ ...:3:3:9 - error: "plt" is not defined (reportUndefinedVariable)
- ...:3:5:1 - warning: Type of "isel" is Any (reportAny)
+ ...:3:5:1 - warning: Type of "isel" is unknown (reportUnknownMemberType)
- ...:3:5:1 - warning: Type of "plot" is Any (reportAny)
+ ...:3:5:1 - warning: Type of "plot" is unknown (reportUnknownMemberType)
+ ...:3:5:33 - error: "ccrs" is not defined (reportUndefinedVariable)
- ...:4:1:1 - warning: Type of "weights" is Any (reportAny)
+ ...:4:1:1 - warning: Type of "weights" is unknown (reportUnknownVariableType)
- ...:4:1:18 - warning: Argument type is Any
- Argument corresponds to parameter "__x1" in function "__call__" (reportAny)
+ ...:4:1:11 - error: "np" is not defined (reportUndefinedVariable)
+ ...:4:1:11 - warning: Type of "cos" is unknown (reportUnknownMemberType)
+ ...:4:1:18 - error: "np" is not defined (reportUndefinedVariable)
+ ...:4:1:18 - warning: Type of "deg2rad" is unknown (reportUnknownMemberType)
- ...:4:1:29 - warning: Type of "lat" is Any (reportAny)
+ ...:4:1:29 - warning: Type of "lat" is unknown (reportUnknownMemberType)
- ...:4:1:29 - warning: Argument type is Any
- Argument corresponds to parameter "__x1" in function "__call__" (reportAny)
- ...:5:1:1 - warning: Type of "air_weighted" is Any (reportAny)
+ ...:5:1:1 - warning: Type of "air_weighted" is unknown (reportUnknownVariableType)
- ...:5:1:16 - warning: Type of "weighted" is Any (reportAny)
+ ...:5:1:16 - warning: Type of "weighted" is unknown (reportUnknownMemberType)
- ...:6:1:1 - warning: Type of "weighted_mean" is Any (reportAny)
+ ...:6:1:1 - warning: Type of "weighted_mean" is unknown (reportUnknownVariableType)
- ...:6:1:17 - warning: Type of "mean" is Any (reportAny)
+ ...:6:1:17 - warning: Type of "mean" is unknown (reportUnknownMemberType)
- ...:7:1:1 - warning: Type of "plot" is Any (reportAny)
+ ...:7:1:1 - warning: Type of "plot" is unknown (reportUnknownMemberType)
- ...:7:2:1 - warning: Type of "mean" is Any (reportAny)
+ ...:7:2:1 - warning: Type of "mean" is unknown (reportUnknownMemberType)
- ...:7:2:1 - warning: Type of "plot" is Any (reportAny)
+ ...:7:2:1 - warning: Type of "plot" is unknown (reportUnknownMemberType)
+ ...:7:4:1 - error: "plt" is not defined (reportUndefinedVariable)
- /tmp/mypy_primer/projects/xarray/doc/examples/monthly-means.ipynb - cell 1
- ...:1:3:8 - error: Import "pandas" could not be resolved from source (reportMissingModuleSource)
- ...:1:5:8 - error: Import "matplotlib.pyplot" could not be resolved (reportMissingImports)
+ ...:2:1:1 - warning: Type of "ds" is unknown (reportUnknownVariableType)
+ ...:2:1:6 - error: "xr" is not defined (reportUndefinedVariable)
+ ...:2:1:6 - warning: Type of "tutorial" is unknown (reportUnknownMemberType)
- ...:2:1:6 - warning: Type of "open_dataset" is partially unknown
+ ...:2:1:6 - warning: Type of "open_dataset" is unknown (reportUnknownMemberType)
+ ...:2:1:6 - warning: Type of "load" is unknown (reportUnknownMemberType)
- Type of "open_dataset" is "(name: str, cache: bool = True, cache_dir: str | PathLike[Unknown] | None = None, *, engine: type[BackendEntrypoint] | str | None = None, **kws: Unknown) -> Dataset" (reportUnknownMemberType)
- ...:2:1:6 - warning: Type of "load" is partially unknown
- Type of "load" is "(**kwargs: Unknown) -> Dataset" (reportUnknownMemberType)
- ...:3:1:1 - warning: Type of "month_length" is Any (reportAny)
+ ...:3:1:1 - warning: Type of "month_length" is unknown (reportUnknownVariableType)
- ...:3:1:16 - warning: Type of "time" is Any (reportAny)
+ ...:3:1:16 - warning: Type of "time" is unknown (reportUnknownMemberType)
- ...:3:1:16 - warning: Type of "dt" is Any (reportAny)
+ ...:3:1:16 - warning: Type of "dt" is unknown (reportUnknownMemberType)
- ...:3:1:16 - warning: Type of "days_in_month" is Any (reportAny)
+ ...:3:1:16 - warning: Type of "days_in_month" is unknown (reportUnknownMemberType)
- ...:4:2:1 - warning: Type of "weights" is Any (reportAny)
+ ...:4:2:1 - warning: Type of "weights" is unknown (reportUnknownVariableType)
- ...:4:3:5 - warning: Type of "groupby" is Any (reportAny)
+ ...:4:3:5 - warning: Type of "groupby" is unknown (reportUnknownMemberType)
- ...:4:3:43 - warning: Type of "groupby" is Any (reportAny)
+ ...:4:3:43 - warning: Type of "groupby" is unknown (reportUnknownMemberType)
- ...:4:3:43 - warning: Type of "sum" is Any (reportAny)
+ ...:4:3:43 - warning: Type of "sum" is unknown (reportUnknownMemberType)
+ ...:4:7:1 - error: "np" is not defined (reportUndefinedVariable)
+ ...:4:7:1 - warning: Type of "testing" is unknown (reportUnknownMemberType)
+ ...:4:7:1 - warning: Type of "assert_allclose" is unknown (reportUnknownMemberType)
- ...:4:7:28 - warning: Type of "groupby" is Any (reportAny)
+ ...:4:7:28 - warning: Type of "groupby" is unknown (reportUnknownMemberType)
- ...:4:7:28 - warning: Type of "sum" is Any (reportAny)
+ ...:4:7:28 - warning: Type of "sum" is unknown (reportUnknownMemberType)
- ...:4:7:28 - warning: Type of "values" is Any (reportAny)
+ ...:4:7:28 - warning: Type of "values" is unknown (reportUnknownMemberType)
- ...:4:7:28 - warning: Argument type is Any
- Argument corresponds to parameter "actual" in function "assert_allclose" (reportAny)
+ ...:4:7:73 - error: "np" is not defined (reportUndefinedVariable)
+ ...:4:7:73 - warning: Type of "ones" is unknown (reportUnknownMemberType)
- ...:4:10:1 - warning: Type of "ds_weighted" is Any (reportAny)
+ ...:4:10:1 - warning: Type of "ds_weighted" is unknown (reportUnknownVariableType)
- ...:4:10:15 - warning: Type of "groupby" is Any (reportAny)
+ ...:4:10:15 - warning: Type of "groupby" is unknown (reportUnknownMemberType)
- ...:4:10:15 - warning: Type of "sum" is Any (reportAny)
+ ...:4:10:15 - warning: Type of "sum" is unknown (reportUnknownMemberType)
+ ...:6:2:1 - warning: Type of "ds_unweighted" is unknown (reportUnknownVariableType)
+ ...:6:2:17 - warning: Type of "groupby" is unknown (reportUnknownMemberType)
+ ...:6:2:17 - warning: Type of "mean" is unknown (reportUnknownMemberType)
- ...:6:3:1 - warning: Type of "ds_diff" is Any (reportAny)
+ ...:6:3:1 - warning: Type of "ds_diff" is unknown (reportUnknownVariableType)
+ ...:7:2:11 - error: "pd" is not defined (reportUndefinedVariable)
+ ...:7:2:11 - warning: Type of "notnull" is unknown (reportUnknownMemberType)
- ...:7:2:11 - warning: Type of "notnull" is partially unknown
- Type of "notnull" is "Overload[(obj: DataFrame) -> DataFrame, (obj: Series[Any]) -> Series[builtins.bool], (obj: Index[Any] | list[Any] | ExtensionArray | ndarray[Unknown, Unknown]) -> ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]], (obj: ScalarT@notna | NaTType | NAType | None) -> TypeIs[ScalarT@notna]]" (reportUnknownMemberType)
- ...:7:2:11 - error: No overloads for "notna" match the provided arguments (reportCallIssue)
- ...:7:2:22 - error: Argument of type "DataArray" cannot be assigned to parameter "obj" of type "ScalarT@notna | NaTType | NAType | None" in function "notna"
- Type "DataArray" is not assignable to type "ScalarT@notna | NaTType | NAType | None"
- Type "DataArray" is not assignable to type "Scalar"
- Type "DataArray" is not assignable to type "Scalar"
- "DataArray" is not assignable to "str"
- "DataArray" is not assignable to "bytes"
- "DataArray" is not assignable to "date"
- "DataArray" is not assignable to "datetime"
- "DataArray" is not assignable to "timedelta"
- ... (reportArgumentType)
+ ...:7:4:13 - error: "plt" is not defined (reportUndefinedVariable)
- ...:7:6:5 - warning: Type of "sel" is Any (reportAny)
+ ...:7:6:5 - warning: Type of "sel" is unknown (reportUnknownMemberType)
- ...:7:6:5 - warning: Type of "where" is Any (reportAny)
+ ...:7:6:5 - warning: Type of "where" is unknown (reportUnknownMemberType)
- ...:7:6:5 - warning: Type of "plot" is Any (reportAny)
+ ...:7:6:5 - warning: Type of "plot" is unknown (reportUnknownMemberType)
- ...:7:6:5 - warning: Type of "pcolormesh" is Any (reportAny)
+ ...:7:6:5 - warning: Type of "pcolormesh" is unknown (reportUnknownMemberType)
... (truncated 100 lines) ...
ignite (https://github.com/pytorch/ignite)
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
- /tmp/mypy_primer/projects/ignite/examples/notebooks/Cifar10_Ax_hyperparam_tuning.ipynb - cell 16
- ...:16:7:1 - warning: Type of "plot_values" is partially unknown
- Type of "plot_values" is "(num_events: int, **scheduler_kwargs: Mapping[Unknown, Unknown]) -> Any" (reportUnknownMemberType)
- ...:16:7:52 - error: Argument of type "Literal['lr']" cannot be assigned to parameter "param_name" of type "Mapping[Unknown, Unknown]" in function "plot_values"
- "Literal['lr']" is not assignable to "Mapping[Unknown, Unknown]" (reportArgumentType)
- ...:16:7:76 - error: Argument of type "list[tuple[int, float]]" cannot be assigned to parameter "milestones_values" of type "Mapping[Unknown, Unknown]" in function "plot_values"
- "list[tuple[int, float]]" is not assignable to "Mapping[Unknown, Unknown]" (reportArgumentType)
- /tmp/mypy_primer/projects/ignite/examples/notebooks/FastaiLRFinder_MNIST.ipynb - cell 2
- ...:2:3:8 - error: Import "torch" could not be resolved (reportMissingImports)
- ...:2:4:8 - error: Import "torch.nn" could not be resolved (reportMissingImports)
- ...:2:5:8 - error: Import "torch.nn.functional" could not be resolved (reportMissingImports)
- ...:2:6:8 - error: Import "torch.optim" could not be resolved (reportMissingImports)
- ...:2:7:8 - error: Import "torchvision.transforms" could not be resolved (reportMissingImports)
- ...:2:8:6 - error: Import "torch.utils.data" could not be resolved (reportMissingImports)
- ...:2:8:30 - warning: Type of "DataLoader" is unknown (reportUnknownVariableType)
- ...:2:9:6 - error: Import "torchvision.datasets" could not be resolved (reportMissingImports)
- ...:2:9:34 - warning: Type of "MNIST" is unknown (reportUnknownVariableType)
+ ...:11:4:89 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:1:13 - error: "transforms" is not defined (reportUndefinedVariable)
+ ...:6:1:33 - error: "transforms" is not defined (reportUndefinedVariable)
+ ...:6:1:56 - error: "transforms" is not defined (reportUndefinedVariable)
+ ...:6:3:12 - error: "MNIST" is not defined (reportUndefinedVariable)
+ ...:6:4:15 - error: "DataLoader" is not defined (reportUndefinedVariable)
+ ...:6:6:11 - error: "MNIST" is not defined (reportUndefinedVariable)
+ ...:6:7:14 - error: "DataLoader" is not defined (reportUndefinedVariable)
+ ...:7:1:11 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:4:22 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:5:22 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:6:27 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:7:20 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:8:20 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:11:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:11:20 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:12:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:12:20 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:14:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:15:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:17:16 - error: "F" is not defined (reportUndefinedVariable)
+ ...:8:1:20 - error: "torch" is not defined (reportUndefinedVariable)
+ ...:8:2:13 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:8:5:13 - error: "optim" is not defined (reportUndefinedVariable)
- /tmp/mypy_primer/projects/ignite/examples/notebooks/HandlersTimeProfiler_MNIST.ipynb - cell 2
- ...:2:3:8 - error: Import "torch" could not be resolved (reportMissingImports)
- ...:2:4:8 - error: Import "torch.nn" could not be resolved (reportMissingImports)
- ...:2:5:8 - error: Import "torch.nn.functional" could not be resolved (reportMissingImports)
- ...:2:6:8 - error: Import "torch.optim" could not be resolved (reportMissingImports)
- ...:2:7:8 - error: Import "torchvision.transforms" could not be resolved (reportMissingImports)
- ...:2:8:6 - error: Import "torch.utils.data" could not be resolved (reportMissingImports)
- ...:2:8:30 - warning: Type of "DataLoader" is unknown (reportUnknownVariableType)
- ...:2:9:6 - error: Import "torchvision.datasets" could not be resolved (reportMissingImports)
- ...:2:9:34 - warning: Type of "MNIST" is unknown (reportUnknownVariableType)
- ...:2:13:6 - error: Import "IPython.core.display" could not be resolved (reportMissingImports)
- ...:2:13:34 - warning: Type of "HTML" is unknown (reportUnknownVariableType)
+ ...:5:1:13 - error: "transforms" is not defined (reportUndefinedVariable)
+ ...:5:1:33 - error: "transforms" is not defined (reportUndefinedVariable)
+ ...:5:1:56 - error: "transforms" is not defined (reportUndefinedVariable)
+ ...:5:3:12 - error: "MNIST" is not defined (reportUndefinedVariable)
+ ...:5:4:15 - error: "DataLoader" is not defined (reportUndefinedVariable)
+ ...:5:6:11 - error: "MNIST" is not defined (reportUndefinedVariable)
+ ...:5:7:14 - error: "DataLoader" is not defined (reportUndefinedVariable)
+ ...:6:1:11 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:4:22 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:5:22 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:6:27 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:7:20 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:8:20 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:6:11:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:6:11:20 - error: "F" is not defined (reportUndefinedVariable)
+ ...:6:12:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:6:12:20 - error: "F" is not defined (reportUndefinedVariable)
+ ...:6:14:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:6:15:13 - error: "F" is not defined (reportUndefinedVariable)
+ ...:6:17:16 - error: "F" is not defined (reportUndefinedVariable)
+ ...:7:1:20 - error: "torch" is not defined (reportUndefinedVariable)
+ ...:7:2:13 - error: "nn" is not defined (reportUndefinedVariable)
+ ...:7:5:13 - error: "optim" is not defined (reportUndefinedVariable)
+ ...:8:2:89 - error: "nn" is not defined (reportUndefinedVariable)
- 3341 errors, 58089 warnings, 0 notes
+ 3372 errors, 58083 warnings, 0 notes
arviz (https://github.com/arviz-devs/arviz)
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
+ Cannot read properties of undefined (reading 'split')
|

Fixes it by looking at the cell contents and just give out an empty string for non-python cells. Implementation has room for improvements, but hey: tests pass!
Fixes #1281