ty
ty copied to clipboard
Improve diagnostics for bad `__getitem__` calls
Summary
This (seen on https://github.com/astral-sh/ruff/pull/22019#issuecomment-3664706394) is horrible UX for a diagnostic message:
+ pandera/engines/pandas_engine.py:1390:25: error[invalid-argument-type] Method `__getitem__` of type `Overload[(idx: int | signedinteger[_64Bit] | integer[Any] | signedinteger[_8Bit]) -> Unknown, (idx: Index[Any] | Series[Any] | slice[Any, Any, Any] | ndarray[tuple[Any, ...], dtype[integer[Any]]]) -> Series[Unknown], (idx: str | bytes | date | ... omitted 10 union elements) -> Unknown, (idx: Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | ... omitted 7 union elements) -> Series[Unknown]]` cannot be called with key of type `Series[bool] | DataFrame` on object of type `Series[Unknown]`
Version
No response