Skip to content

Fix TypeIs narrowing before isinstance#21622

Open
nkgotcode wants to merge 3 commits into
python:masterfrom
nkgotcode:fix/typeis-isinstance-negative-narrowing
Open

Fix TypeIs narrowing before isinstance#21622
nkgotcode wants to merge 3 commits into
python:masterfrom
nkgotcode:fix/typeis-isinstance-negative-narrowing

Conversation

@nkgotcode

@nkgotcode nkgotcode commented Jun 17, 2026

Copy link
Copy Markdown

Fixes #21508.

This keeps isinstance narrowing based on the currently narrowed expression
type. When a previous TypeIs check has already removed one side of a union,
an elif isinstance(...) check against a runtime generic alias no longer
widens the expression back to its original type.

The change also adds regression coverage for a TypeIs false branch followed
by isinstance(obj, Slice).

Tests:

  • pytest -n0 mypy/test/testcheck.py::TypeCheckSuite::check-typeis.test -q
  • pytest -n0 mypy/test/testcheck.py::TypeCheckSuite::check-isinstance.test -q
  • python -m mypy --config-file mypy_self_check.ini --no-incremental -p mypy

@github-actions

Copy link
Copy Markdown
Contributor

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

kornia (https://github.com/kornia/kornia)
+ kornia/constants.py:118: error: Item "str" of "str | int | Any | Any | DType" has no attribute "item"  [union-attr]
+ kornia/constants.py:118: error: Item "int" of "str | int | Any | Any | DType" has no attribute "item"  [union-attr]
+ kornia/constants.py:118: error: Item "DType" of "str | int | Any | Any | DType" has no attribute "item"  [union-attr]
+ kornia/filters/in_range.py:134: error: Item "tuple[Any, ...]" of "tuple[Any, ...] | Any" has no attribute "shape"  [union-attr]
+ kornia/filters/in_range.py:138: error: Item "tuple[Any, ...]" of "tuple[Any, ...] | Any" has no attribute "to"  [union-attr]
+ kornia/filters/in_range.py:139: error: Item "tuple[Any, ...]" of "tuple[Any, ...] | Any" has no attribute "to"  [union-attr]
- kornia/core/mixin/image_module.py:199: error: Unused "type: ignore" comment  [unused-ignore]
+ kornia/enhance/adjust.py:660: error: Item "float" of "float | Any" has no attribute "shape"  [union-attr]
+ kornia/enhance/adjust.py:661: error: Argument 1 to "len" has incompatible type "float | Any"; expected "Sized"  [arg-type]
+ kornia/enhance/adjust.py:661: error: Item "float" of "float | Any" has no attribute "shape"  [union-attr]
+ kornia/enhance/adjust.py:664: error: Item "float" of "float | Any" has no attribute "to"  [union-attr]
+ kornia/enhance/adjust.py:727: error: Item "float" of "float | Any" has no attribute "shape"  [union-attr]
+ kornia/enhance/adjust.py:728: error: Argument 1 to "len" has incompatible type "float | Any"; expected "Sized"  [arg-type]
+ kornia/enhance/adjust.py:728: error: Item "float" of "float | Any" has no attribute "shape"  [union-attr]
+ kornia/enhance/adjust.py:731: error: Item "float" of "float | Any" has no attribute "to"  [union-attr]
+ kornia/contrib/object_detection.py:362: error: Item "list[int]" of "Any | list[int]" has no attribute "view"  [union-attr]
- kornia/augmentation/_2d/mix/transplantation.py:182: error: Item "Sequence[int]" of "Sequence[int] | Any" has no attribute "ndim"  [union-attr]
+ kornia/augmentation/_2d/mix/transplantation.py:182: error: Item "list[int | Any]" of "list[int | Any] | Sequence[int] | Any" has no attribute "ndim"  [union-attr]
- kornia/augmentation/_2d/mix/transplantation.py:183: error: Item "Sequence[int]" of "Sequence[int] | Any" has no attribute "ndim"  [union-attr]
+ kornia/augmentation/_2d/mix/transplantation.py:182: error: Item "Sequence[int]" of "list[int | Any] | Sequence[int] | Any" has no attribute "ndim"  [union-attr]
+ kornia/augmentation/_2d/mix/transplantation.py:183: error: Item "list[int | Any]" of "list[int | Any] | Sequence[int] | Any" has no attribute "ndim"  [union-attr]
+ kornia/augmentation/_2d/mix/transplantation.py:183: error: Item "Sequence[int]" of "list[int | Any] | Sequence[int] | Any" has no attribute "ndim"  [union-attr]

spark (https://github.com/apache/spark)
+ python/pyspark/pandas/indexes/multi.py:1167: error: Item "list[Any]" of "Index | list[Any]" has no attribute "to_frame"  [union-attr]
+ python/pyspark/pandas/indexes/multi.py:1168: error: Item "list[Any]" of "Index | list[Any]" has no attribute "names"  [union-attr]
+ python/pyspark/pandas/indexes/multi.py:1180: error: Argument 1 to "_index_fields_for_union_like" of "Index" has incompatible type "DataFrame[Any] | Series[Any] | Index | list[Any]"; expected "Index"  [arg-type]
+ python/pyspark/sql/connect/session.py:650: error: Item "Iterable[Any]" of "Any | DataFrame | Iterable[Any]" has no attribute "column_names"  [union-attr]
+ python/pyspark/sql/connect/session.py:650: error: Incompatible types in assignment (expression has type "Any | Series[Any]", variable has type "list[str] | None")  [assignment]
+ python/pyspark/sql/connect/session.py:651: error: Item "Iterable[Any]" of "Any | DataFrame | Iterable[Any]" has no attribute "columns"  [union-attr]
+ python/pyspark/sql/connect/session.py:653: error: Item "Iterable[Any]" of "Any | DataFrame | Iterable[Any]" has no attribute "columns"  [union-attr]
+ python/pyspark/sql/connect/session.py:657: error: Item "Iterable[Any]" of "Any | DataFrame | Iterable[Any]" has no attribute "schema"  [union-attr]

psycopg (https://github.com/psycopg/psycopg)
- psycopg/psycopg/types/numeric.py:407: error: No overload variant of "int" matches argument type "object"  [call-overload]
- psycopg/psycopg/types/numeric.py:407: note: Possible overload variants:
- psycopg/psycopg/types/numeric.py:407: note:     def int(str | Buffer | SupportsInt | SupportsIndex = ..., /) -> int
- psycopg/psycopg/types/numeric.py:407: note:     def int(str | bytes | bytearray, /, base: SupportsIndex) -> int

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/collections.py:521: error: Value of type variable "_DataclassT" of "replace" cannot be "DataclassInstance | type[DataclassInstance]"  [type-var]
+ src/prefect/utilities/processutils/__init__.py:472: error: Incompatible types in "await" (actual type "Any | int", expected type "Awaitable[Any]")  [misc]
+ src/prefect/utilities/processutils/__init__.py:473: error: Incompatible types in "await" (actual type "Any | None", expected type "Awaitable[Any]")  [misc]
+ src/prefect/server/utilities/database.py:765: error: Item "str" of "str | Any | Any" has no attribute "url"  [union-attr]
+ src/prefect/states.py:227: error: "BaseException" has no attribute "request"  [attr-defined]
+ src/prefect/_internal/states.py:93: error: "BaseException" has no attribute "request"  [attr-defined]
+ src/prefect/runner/storage.py:248: error: Item "object" of "Any | object" has no attribute "get_secret_value"  [union-attr]
+ src/prefect/runner/storage.py:294: error: Item "object" of "Any | object" has no attribute "get_secret_value"  [union-attr]
- src/prefect/server/events/schemas/automations.py:609: error: Item "dict[str, str | list[str]]" of "ResourceSpecification | dict[str, str | list[str]]" has no attribute "matches_every_resource_of_kind"  [union-attr]
+ src/prefect/server/events/schemas/automations.py:609: error: Item "dict[str, str | list[str]]" of "ResourceSpecification | dict[str, str | list[str]] | Any" has no attribute "matches_every_resource_of_kind"  [union-attr]
- src/prefect/testing/utilities.py:281: error: Argument 1 to "aread" of "ResultStore" has incompatible type "str | None"; expected "str"  [arg-type]
+ src/prefect/testing/utilities.py:281: error: Argument 1 to "aread" of "ResultStore" has incompatible type "Any | str | None"; expected "str"  [arg-type]
- src/prefect/testing/utilities.py:298: error: Argument 1 to "read_block_document" of "BlocksDocumentAsyncClient" has incompatible type "UUID | None"; expected "UUID"  [arg-type]
+ src/prefect/testing/utilities.py:298: error: Argument 1 to "read_block_document" of "BlocksDocumentAsyncClient" has incompatible type "Any | UUID | None"; expected "UUID"  [arg-type]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/http.py:95: error: Item "str" of "Any | str" has no attribute "host"  [union-attr]
+ steam/http.py:103: error: Item "str" of "Any | str" has no attribute "host"  [union-attr]
+ steam/manifest.py:978: error: Item "str" of "Any | str | None" has no attribute "items"  [union-attr]
+ steam/manifest.py:978: error: Item "None" of "Any | str | None" has no attribute "items"  [union-attr]
+ steam/ext/csgo/state.py:217: error: Invalid index type "int | Any" for "dict[AssetID, Future[CasketItem]]"; expected type "AssetID"  [index]

strawberry (https://github.com/strawberry-graphql/strawberry)
+ strawberry/http/async_base_view.py:384: error: Item "ExecutionResult" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:384: error: Item "list[ExecutionResult]" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:386: error: Item "ExecutionResult" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:386: error: Item "list[ExecutionResult]" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:388: error: Item "ExecutionResult" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:388: error: Item "list[ExecutionResult]" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:390: error: Item "ExecutionResult" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:390: error: Item "list[ExecutionResult]" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:394: error: Item "ExecutionResult" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:394: error: Item "list[ExecutionResult]" of "ExecutionResult | list[ExecutionResult]" has no attribute "initial_result"  [union-attr]
+ strawberry/http/async_base_view.py:396: error: Item "ExecutionResult" of "ExecutionResult | list[ExecutionResult]" has no attribute "subsequent_results"  [union-attr]
+ strawberry/http/async_base_view.py:396: error: Item "list[ExecutionResult]" of "ExecutionResult | list[ExecutionResult]" has no attribute "subsequent_results"  [union-attr]

altair (https://github.com/vega/altair)
+ altair/vegalite/v6/api.py:4377: error: Argument 3 to "_repeat_names" has incompatible type "Chart | RepeatChart | ConcatChart | HConcatChart | VConcatChart | FacetChart | LayerChart"; expected "Chart | LayerChart"  [arg-type]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/http/response/text.py:275: error: Item "None" of "SelectorList | Iterable[str | Link] | Any | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ scrapy/logformatter.py:103: error: Item "Response" of "Response | Any" has no attribute "getErrorMessage"  [union-attr]

pandera (https://github.com/pandera-dev/pandera)
+ pandera/engines/geopandas_engine.py:71: error: Item "dtype[generic[Any]]" of "dtype[generic[Any]] | ExtensionDtype | Series[Any] | Any" has no attribute "to_dict"  [union-attr]
+ pandera/engines/geopandas_engine.py:71: error: Item "ExtensionDtype" of "dtype[generic[Any]] | ExtensionDtype | Series[Any] | Any" has no attribute "to_dict"  [union-attr]
- pandera/engines/geopandas_engine.py:118: error: Unused "type: ignore" comment  [unused-ignore]
+ pandera/engines/geopandas_engine.py:181: error: Item "None" of "Series[Any] | DataFrame | Any | Any | None" has no attribute "crs"  [union-attr]
+ pandera/engines/geopandas_engine.py:185: error: Item "None" of "Series[Any] | DataFrame | Any | Any | None" has no attribute "crs"  [union-attr]
+ pandera/engines/geopandas_engine.py:190: error: Item "None" of "Series[Any] | DataFrame | Any | Any | None" has no attribute "columns"  [union-attr]
+ pandera/engines/geopandas_engine.py:191: error: Value of type "Series[Any] | DataFrame | Any | Any | None" is not indexable  [index]
+ pandera/engines/geopandas_engine.py:192: error: Value of type "Series[Any] | DataFrame | Any | Any | None" is not indexable  [index]
+ pandera/io/pandas_io.py:1130: error: Item "str" of "str | Path | dict[Any, Any] | Any" has no attribute "primary_key"  [union-attr]
+ pandera/io/pandas_io.py:1130: error: Item "Path" of "str | Path | dict[Any, Any] | Any" has no attribute "primary_key"  [union-attr]
+ pandera/io/pandas_io.py:1130: error: Item "dict[Any, Any]" of "str | Path | dict[Any, Any] | Any" has no attribute "primary_key"  [union-attr]
+ pandera/io/pandas_io.py:1132: error: Item "str" of "str | Path | dict[Any, Any] | Any" has no attribute "fields"  [union-attr]
+ pandera/io/pandas_io.py:1132: error: Item "Path" of "str | Path | dict[Any, Any] | Any" has no attribute "fields"  [union-attr]
+ pandera/io/pandas_io.py:1132: error: Item "dict[Any, Any]" of "str | Path | dict[Any, Any] | Any" has no attribute "fields"  [union-attr]
+ pandera/io/pandas_io.py:1141: error: Item "str" of "str | Path | dict[Any, Any] | Any" has no attribute "primary_key"  [union-attr]
+ pandera/io/pandas_io.py:1141: error: Item "Path" of "str | Path | dict[Any, Any] | Any" has no attribute "primary_key"  [union-attr]
+ pandera/io/pandas_io.py:1141: error: Item "dict[Any, Any]" of "str | Path | dict[Any, Any] | Any" has no attribute "primary_key"  [union-attr]

pylint (https://github.com/pycqa/pylint)
+ pylint/checkers/utils.py:866: error: Item "None" of "Any | None" has no attribute "function"  [union-attr]
+ pylint/checkers/typecheck.py:588: error: Item "None" of "Any | None" has no attribute "parent"  [union-attr]
+ pylint/checkers/typecheck.py:762: error: Item "None" of "Any | None" has no attribute "items"  [union-attr]
+ pylint/checkers/typecheck.py:766: error: Item "None" of "Any | None" has no attribute "parent"  [union-attr]
+ pylint/checkers/typecheck.py:769: error: Item "None" of "Any | None" has no attribute "parent"  [union-attr]
+ pylint/checkers/typecheck.py:771: error: Item "None" of "Any | None" has no attribute "statement"  [union-attr]
+ pylint/checkers/strings.py:404: error: Item "None" of "Any | None" has no attribute "pytype"  [union-attr]
+ pylint/checkers/stdlib.py:872: error: Item "None" of "Any | None" has no attribute "value"  [union-attr]
+ pylint/checkers/stdlib.py:879: error: Item "None" of "Any | None" has no attribute "value"  [union-attr]
+ pylint/checkers/stdlib.py:918: error: Item "None" of "Any | None" has no attribute "value"  [union-attr]
+ pylint/checkers/method_args.py:110: error: Item "None" of "Any | None" has no attribute "args"  [union-attr]
+ pylint/checkers/method_args.py:113: error: Item "None" of "Any | None" has no attribute "args"  [union-attr]
+ pylint/checkers/method_args.py:115: error: Item "None" of "Any | None" has no attribute "args"  [union-attr]
+ pylint/checkers/refactoring/recommendation_checker.py:419: error: Item "None" of "Any | None" has no attribute "items"  [union-attr]
+ pylint/checkers/base/docstring_checker.py:39: error: Item "None" of "Any | None" has no attribute "value"  [union-attr]
+ pylint/checkers/base/name_checker/checker.py:596: error: Item "None" of "Any | None" has no attribute "qname"  [union-attr]
+ pylint/checkers/base/name_checker/checker.py:720: error: Item "None" of "Any | None" has no attribute "qname"  [union-attr]
+ pylint/checkers/refactoring/refactoring_checker.py:2248: error: Item "None" of "Any | None" has no attribute "value"  [union-attr]

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/mypy.py:637: error: Item "None" of "Any | None" has no attribute "items"  [union-attr]

rotki (https://github.com/rotki/rotki)
+ rotkehlchen/db/filtering.py:1167: error: Item "EVMTxHash" of "EVMTxHash | Any" has no attribute "to_bytes"  [union-attr]

sympy (https://github.com/sympy/sympy)
+ sympy/series/residues.py:78: error: "Expr" has no attribute "exp"  [attr-defined]
+ sympy/sets/ordinals.py:46: error: Argument 2 to "OmegaPower" has incompatible type "object"; expected "Integer | int"  [arg-type]
+ sympy/sets/ordinals.py:139: error: Argument 1 to "convert" of "Ordinal" has incompatible type "object"; expected "Integer | int"  [arg-type]
+ sympy/simplify/simplify.py:2074: error: "Basic" has no attribute "base"  [attr-defined]
+ sympy/simplify/simplify.py:2077: error: "Basic" has no attribute "exp"  [attr-defined]
+ sympy/matrices/matrixbase.py:3213: error: "Expr" has no attribute "p"  [attr-defined]
+ sympy/matrices/matrixbase.py:3218: error: "Expr" has no attribute "p"  [attr-defined]
+ sympy/matrices/matrixbase.py:3223: error: "Expr" has no attribute "p"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:852: error: "Expr" has no attribute "q"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:853: error: "Expr" has no attribute "p"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:853: error: "Expr" has no attribute "q"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:854: error: "Expr" has no attribute "q"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:858: error: "Expr" has no attribute "q"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:865: error: "Expr" has no attribute "q"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:869: error: "Expr" has no attribute "q"  [attr-defined]
+ sympy/functions/elementary/trigonometric.py:872: error: "Expr" has no attribute "p"  [attr-defined]
+ sympy/tensor/array/expressions/from_matrix_to_array.py:67: error: "Basic" has no attribute "base"  [attr-defined]
+ sympy/tensor/array/expressions/from_matrix_to_array.py:68: error: "Basic" has no attribute "exp"  [attr-defined]
+ sympy/tensor/array/expressions/from_matrix_to_array.py:71: error: "Basic" has no attribute "exp"  [attr-defined]
+ sympy/tensor/array/expressions/from_matrix_to_array.py:73: error: "Basic" has no attribute "exp"  [attr-defined]
+ sympy/tensor/array/expressions/from_matrix_to_array.py:76: error: "Basic" has no attribute "exp"  [attr-defined]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/unittest.py:647: error: Incompatible return value type (got "tuple[type[Any], Any, TracebackType | None]", expected "tuple[type[BaseException], BaseException, TracebackType] | tuple[None, None, None]")  [return-value]
+ src/_pytest/unittest.py:647: error: "BaseException" has no attribute "value"  [attr-defined]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/util/serialization.py:195:20: error: Item "date" of "Any | date | time | datetime64[date | int | None]" has no attribute "value"  [union-attr]
+ src/bokeh/util/serialization.py:195:20: error: Item "time" of "Any | date | time | datetime64[date | int | None]" has no attribute "value"  [union-attr]
+ src/bokeh/util/serialization.py:195:20: error: Item "datetime64[date | int | None]" of "Any | date | time | datetime64[date | int | None]" has no attribute "value"  [union-attr]
+ src/bokeh/util/serialization.py:199:20: error: Item "date" of "Any | date | time | datetime64[date | int | None]" has no attribute "value"  [union-attr]
+ src/bokeh/util/serialization.py:199:20: error: Item "time" of "Any | date | time | datetime64[date | int | None]" has no attribute "value"  [union-attr]
+ src/bokeh/util/serialization.py:199:20: error: Item "datetime64[date | int | None]" of "Any | date | time | datetime64[date | int | None]" has no attribute "value"  [union-attr]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/arrays/arrow/array.py:3145: error: Item "ExtensionArray" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "ndarray[tuple[Any, ...], dtype[Any]]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "str" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "bytes" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "date" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "timedelta" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "datetime64[date | int | None]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "timedelta64[timedelta | int | None]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "int" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "float" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "Interval[Any]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "complex" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "integer[Any]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "floating[Any]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]
+ pandas/core/arrays/arrow/array.py:3145: error: Item "complexfloating[Any, Any]" of "ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | str | bytes | date | <10 more items>" has no attribute "as_py"  [union-attr]

xarray (https://github.com/pydata/xarray)
+ xarray/namedarray/pycompat.py: note: In function "to_numpy":
+ xarray/namedarray/pycompat.py:119: error: Item "ndarray[Any, Never]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "get"  [union-attr]
+ xarray/namedarray/pycompat.py:119: error: Item "_arrayfunction[Any, Any]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "get"  [union-attr]
+ xarray/namedarray/pycompat.py:119: error: Item "_arrayapi[Any, Any]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "get"  [union-attr]
+ xarray/namedarray/pycompat.py:122: error: Item "ndarray[Any, Never]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "magnitude"  [union-attr]
+ xarray/namedarray/pycompat.py:122: error: Item "_arrayfunction[Any, Any]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "magnitude"  [union-attr]
+ xarray/namedarray/pycompat.py:122: error: Item "_arrayapi[Any, Any]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "magnitude"  [union-attr]
+ xarray/namedarray/pycompat.py:124: error: Item "ndarray[Any, Never]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "todense"  [union-attr]
+ xarray/namedarray/pycompat.py:124: error: Item "_arrayfunction[Any, Any]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "todense"  [union-attr]
+ xarray/namedarray/pycompat.py:124: error: Item "_arrayapi[Any, Any]" of "ndarray[Any, Never] | _arrayfunction[Any, Any] | _arrayapi[Any, Any]" has no attribute "todense"  [union-attr]
+ xarray/plot/utils.py: note: In function "_parse_size":
+ xarray/plot/utils.py:1353: error: Item "tuple[float | bool | None, ...]" of "tuple[float | None, float | None, bool] | Any" has no attribute "clip"  [union-attr]
+ xarray/plot/utils.py:1354: error: Item "tuple[float | bool | None, ...]" of "tuple[float | None, float | None, bool] | Any" has no attribute "scaled"  [union-attr]
+ xarray/plot/utils.py:1355: error: "tuple[float | None, float | None, bool]" not callable  [operator]
+ xarray/plot/utils.py:1358: error: "tuple[float | None, float | None, bool]" not callable  [operator]
+ xarray/plot/utils.py: note: At top level:

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/sql/datatypes.py:321: error: Item "None" of "Any | None" has no attribute "expression"  [union-attr]
+ ibis/backends/sql/datatypes.py:324: error: Item "None" of "Any | None" has no attribute "this"  [union-attr]
+ ibis/backends/sql/datatypes.py:327: error: Item "None" of "Any | None" has no attribute "this"  [union-attr]
+ ibis/backends/athena/__init__.py:195: error: Argument 1 to "_run_pre_execute_hooks" of "BaseBackend" has incompatible type "Any | DataFrame"; expected "Expr"  [arg-type]
+ ibis/backends/athena/__init__.py:206: error: "Series[Any]" not callable  [operator]
+ ibis/backends/athena/__init__.py:208: error: Argument 1 to "to_sqlglot" of "SQLGlotCompiler" has incompatible type "Any | DataFrame"; expected "Expr"  [arg-type]
+ ibis/backends/trino/__init__.py:472: error: Argument 1 to "_run_pre_execute_hooks" of "BaseBackend" has incompatible type "Any | DataFrame"; expected "Expr"  [arg-type]
+ ibis/backends/trino/__init__.py:481: error: "Series[Any]" not callable  [operator]
+ ibis/backends/trino/__init__.py:483: error: Argument 1 to "to_sqlglot" of "SQLGlotCompiler" has incompatible type "Any | DataFrame"; expected "Expr"  [arg-type]
+ ibis/backends/datafusion/__init__.py:203: error: "Series[Any]" not callable  [operator]
+ ibis/backends/flink/__init__.py:957: error: Item "Iterable[Mapping[str, Any]]" of "Any | Iterable[Mapping[str, Any]] | Iterable[Iterable[Any]] | Mapping[str, Iterable[Any]] | DataFrame | _HasArrowCStream" has no attribute "to_pandas"  [union-attr]
+ ibis/backends/flink/__init__.py:957: error: Item "Iterable[Iterable[Any]]" of "Any | Iterable[Mapping[str, Any]] | Iterable[Iterable[Any]] | Mapping[str, Iterable[Any]] | DataFrame | _HasArrowCStream" has no attribute "to_pandas"  [union-attr]
+ ibis/backends/flink/__init__.py:957: error: Item "Mapping[str, Iterable[Any]]" of "Any | Iterable[Mapping[str, Any]] | Iterable[Iterable[Any]] | Mapping[str, Iterable[Any]] | DataFrame | _HasArrowCStream" has no attribute "to_pandas"  [union-attr]
+ ibis/backends/flink/__init__.py:957: error: Item "_HasArrowCStream" of "Any | Iterable[Mapping[str, Any]] | Iterable[Iterable[Any]] | Mapping[str, Iterable[Any]] | DataFrame | _HasArrowCStream" has no attribute "to_pandas"  [union-attr]
+ ibis/backends/flink/__init__.py:957: error: "Series[Any]" not callable  [operator]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/config.py:6038:39: error: Argument 1 to "asdict" has incompatible type "DataclassInstance | type[DataclassInstance]"; expected "DataclassInstance"  [arg-type]

jax (https://github.com/google/jax)
+ jax/experimental/mosaic/gpu/layouts.py:154: error: Argument 1 to "get" of "SwizzleTransformAttr" has incompatible type "MemRefTransform | Any"; expected "int"  [arg-type]
+ jax/_src/pallas/mosaic_gpu/core.py:1348: error: Unsupported operand types for + ("int" and "Slice")  [operator]
+ jax/_src/pallas/mosaic_gpu/core.py:1348: note: Right operand is of type "int | Array | Any | Slice"

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/search/__init__.py:625:52: error: Value of type "Node" is not indexable  [index]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/binary.py:517: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "ndim"  [union-attr]
+ bson/binary.py:523: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "astype"  [union-attr]
+ bson/binary.py:525: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "min"  [union-attr]
+ bson/binary.py:525: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "max"  [union-attr]
+ bson/binary.py:526: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "astype"  [union-attr]
+ bson/binary.py:530: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "min"  [union-attr]
+ bson/binary.py:530: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "max"  [union-attr]
+ bson/binary.py:531: error: Item "Sequence[float | int]" of "Any | Sequence[float | int]" has no attribute "astype"  [union-attr]

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ pytest_robotframework/_internal/api.py:102: error: "BaseException" has no attribute "message"  [attr-defined]
+ pytest_robotframework/_internal/api.py:104: error: "BaseException" has no attribute "syntax"  [attr-defined]

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.

TypeIs with isinstance fails to narrow

1 participant