GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Limit binder special-casing to imprecise Any by ilevkivskyi · Pull Request #22050 · python/mypy

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Sep 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There is a bunch of special-casing for Any types in binder. The goal of this special-casing is to limit the spread of Any types from legacy code with missing/imprecise types. This special-casing is quite ad-hoc, and thus should be limited only to imprecise kinds of Any.

Note this should help with #22011
cc @JukkaL @hauntsaninja

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ilevkivskyi
Limit binder special-casing to imprecise Any
e0a60ec
@github-actions

This comment has been minimized.

Sign in to view
@ilevkivskyi

ilevkivskyi commented Sep 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Mostly expected things, but there are couple weird results in scipy and pymongo, I will investigate later.

In the meantime, I remember last time we tried this, it caused issues for homeassistant, but now the primer is broken for it, see hauntsaninja/mypy_primer#263 cc @hauntsaninja please take a look.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

This comment has been minimized.

Sign in to view
@ilevkivskyi
Keep reverse logic
6837346
@github-actions

This comment has been minimized.

Sign in to view
@ilevkivskyi

ilevkivskyi commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

I think primer looks very good. New errors in mongo are real (were previously wrongly unreachable). There is a healthy doze of Returning Any from function, but I think they are justified. I spot-checked some of them, and they all look essentially like this (real example):

    def _match_version(self, got_tuple: tuple[int, ...]) -> bool:
        ...
        op: Callable[[tuple[int, ...], tuple[int, ...]], bool]
        op = getattr(operator, self._OP_NAMES[self.op])
        return op(got_tuple, version_tuple)

IMO this is exactly the case where this error should be given. Literally nothing prevents me from writing:

    def _match_version(self, got_tuple: tuple[int, ...]) -> Cake:
        ...
        op: Callable[[tuple[int, ...], tuple[int, ...]], Cake]
        op = getattr(operator, self._OP_NAMES[self.op])
        return op(got_tuple, version_tuple)

But this doesn't mean I will get a cake. I think these are all from people who can't have even a single # type: ignore in their code. They will be not happy, but 15 errors for them are definitely better than ~150 errors for other people.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi

ilevkivskyi commented Sep 27, 2026

Copy link
Copy Markdown
Member Author

Btw cc @cdce8p (so that it will not be a surprise for you).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JukkaL
JukkaL approved these changes Sep 28, 2026
View reviewed changes

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

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.

Primer looks great, thanks! One comment about tests, otherwise looks good.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test-data/unit/check-unreachable-code.test
reveal_type(self) # N: Revealed type is "__main__.Child"
reveal_type(self) # N: Revealed type is "None"
return None # E: Incompatible return value type (got "None", expected "int")
reveal_type(self) # N: Revealed type is "Any"

@JukkaL JukkaL Sep 28, 2026

Copy link
Copy Markdown
Collaborator

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.

Add a new test case focused on the new behavior, as now it seems to be tested only incidentally?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ilevkivskyi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
ilevkivskyi added 2 commits September 28, 2026 21:50
@ilevkivskyi
Merge remote-tracking branch 'upstream/master' into better-binder-any
0151e5d
@ilevkivskyi
Add dedicated tests
6aee713
@github-actions

github-actions Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

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

spark (https://github.com/apache/spark)
+ python/pyspark/pandas/groupby.py:357: error: Unused "type: ignore" comment  [unused-ignore]
+ python/pyspark/sql/connect/column.py:90: error: Unused "type: ignore" comment  [unused-ignore]

psycopg (https://github.com/psycopg/psycopg)
+ tests/utils.py:143: error: Returning Any from function declared to return "bool"  [no-any-return]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/cli/deploy/_core.py:356: error: Argument 1 to "_initialize_deployment_triggers" has incompatible type "Any | None"; expected "str"  [arg-type]

colour (https://github.com/colour-science/colour)
- colour/appearance/atd95.py:264: error: No overload variant of "__mul__" of "ndarray" matches argument type "Buffer"  [operator]
- colour/appearance/atd95.py:264: note: Possible overload variants:
- colour/appearance/atd95.py:264: note:     def __mul__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[floating[_64Bit]]] | _NestedSequence[_SupportsArray[dtype[floating[_64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[float64]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]] | _NestedSequence[_SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[complex128]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[number[Any, Any]]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[timedelta64[Any]]] | _NestedSequence[_SupportsArray[dtype[timedelta64[Any]]]], /) -> ndarray[tuple[Any, ...], dtype[timedelta64[Any]]]
- colour/appearance/atd95.py:264: note:     def __mul__(self, _SupportsArray[dtype[object_]] | _NestedSequence[_SupportsArray[dtype[object_]]], /) -> Any
- colour/appearance/atd95.py:264: error: Unsupported operand types for * ("ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]" and "_NestedSequence[complex | bytes | str]")  [operator]
- colour/appearance/atd95.py:264: note: Right operand is of type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]"
- colour/appearance/atd95.py:264: error: No overload variant of "__add__" of "ndarray" matches argument type "bytes"  [operator]
- colour/appearance/atd95.py:264: note:     def __add__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[floating[_64Bit]]] | _NestedSequence[_SupportsArray[dtype[floating[_64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[float64]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]] | _NestedSequence[_SupportsArray[dtype[complexfloating[_64Bit, _64Bit]]]], /) -> ndarray[tuple[Any, ...], dtype[complex128]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any] | floating[Any]]]] | float | _NestedSequence[float], /) -> ndarray[tuple[Any, ...], dtype[floating[Any]]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, Any]]]] | complex | _NestedSequence[complex], /) -> ndarray[tuple[Any, ...], dtype[number[Any, Any]]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[object_]] | _NestedSequence[_SupportsArray[dtype[object_]]], /) -> Any
- colour/appearance/atd95.py:264: error: No overload variant of "__add__" of "ndarray" matches argument type "str"  [operator]
- colour/appearance/atd95.py:264: note:     def __add__(self, int | numpy.bool[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]
- colour/appearance/atd95.py:264: note:     def __add__(self, _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool], /) -> ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]
- colour/appearance/atd95.py:264: error: Unsupported operand types for + ("bytes" and "str")  [operator]
- colour/appearance/atd95.py:264: error: Unsupported operand types for + ("str" and "ndarray[tuple[Any, ...], dtype[floating[_16Bit] | floating[_32Bit] | float64]]")  [operator]
- colour/appearance/atd95.py:264: error: Unsupported operand types for + ("str" and "ndarray[tuple[Any, ...], dtype[complexfloating[Any, Any]]]")  [operator]
- colour/appearance/atd95.py:264: error: Unsupported operand types for + ("str" and "bytes")  [operator]
- colour/appearance/atd95.py:264: note: Both left and right operands are unions
- colour/models/rgb/rgb_colourspace.py:1064: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1066: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1067: error: Item "str" of "RGB_Colourspace | str" has no attribute "matrix_XYZ_to_RGB"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1068: error: Item "str" of "RGB_Colourspace | str" has no attribute "cctf_encoding"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1197: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1199: error: Item "str" of "RGB_Colourspace | str" has no attribute "whitepoint"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1200: error: Item "str" of "RGB_Colourspace | str" has no attribute "matrix_RGB_to_XYZ"  [union-attr]
- colour/models/rgb/rgb_colourspace.py:1201: error: Item "str" of "RGB_Colourspace | str" has no attribute "cctf_decoding"  [union-attr]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ src/hydra_zen/structured_configs/_make_config.py:278: error: Unused "type: ignore" comment  [unused-ignore]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/downloadermiddlewares/httpcache.py:108: error: Returning Any from function declared to return "Request | Response | None"  [no-any-return]

urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/connectionpool.py:760: error: Unused "type: ignore" comment  [unused-ignore]

comtypes (https://github.com/enthought/comtypes)
- comtypes/errorinfo.py:128: error: Item "str" of "Any | str" has no attribute "as_progid"  [union-attr]

core (https://github.com/home-assistant/core)
- Warning: disabling incremental mode may severely reduce performance
- If this is intentional, delete '.mypy_cache' to suppress this warning
+ homeassistant/components/cloud/account_link.py:66: error: Returning Any from function declared to return "list[dict[str, Any]]"  [no-any-return]
+ homeassistant/components/homeassistant/exposed_entities.py:257: error: Returning Any from function declared to return "bool"  [no-any-return]
+ homeassistant/components/homeassistant/exposed_entities.py:284: error: Returning Any from function declared to return "bool"  [no-any-return]
+ homeassistant/components/mqtt/models.py:398: error: Returning Any from function declared to return "str | bytes | bytearray"  [no-any-return]
+ homeassistant/components/mqtt/models.py:424: error: Returning Any from function declared to return "str | bytes | bytearray"  [no-any-return]
+ homeassistant/components/shelly/entity.py:592: error: Returning Any from function declared to return "str | int | float | None"  [no-any-return]
+ homeassistant/components/unifiprotect/utils.py:85: error: Returning Any from function declared to return "dict[str, Any]"  [no-any-return]
+ homeassistant/components/enphase_envoy/coordinator.py:91: error: Returning Any from function declared to return "bool"  [no-any-return]
+ homeassistant/components/mqtt/config_flow.py:849: error: Returning Any from function declared to return "str"  [no-any-return]

dulwich (https://github.com/dulwich/dulwich)
+ dulwich/client.py:4471: error: Returning Any from function declared to return "ProxyManager | PoolManager | AuthCallbackPoolManager"  [no-any-return]

scipy (https://github.com/scipy/scipy)
- scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "Buffer")  [operator]
- scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "_SupportsArray[dtype[Any]]")  [operator]
- scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "_NestedSequence[_SupportsArray[dtype[Any]]]")  [operator]
- scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "complex")  [operator]
- scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for > ("int" and "_NestedSequence[complex | bytes | str]")  [operator]
- scipy/spatial/transform/_rotation_xp.py:521: note: Left operand is of type "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]"
- scipy/spatial/transform/_rotation_xp.py:521: error: Unsupported operand types for < ("str" and "int")  [operator]
- scipy/spatial/transform/_rotation_xp.py:529: error: Item "Buffer" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:529: error: Item "_SupportsArray[dtype[Any]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:529: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:529: error: Item "complex" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:529: error: Item "str" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:529: error: Item "_NestedSequence[complex | bytes | str]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:532: error: Item "Buffer" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:532: error: Item "_SupportsArray[dtype[Any]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:532: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:532: error: Item "complex" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:532: error: Item "str" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/spatial/transform/_rotation_xp.py:532: error: Item "_NestedSequence[complex | bytes | str]" of "Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "Buffer" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "_SupportsArray[dtype[Any]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "complex" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "bytes" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "str" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:328: error: Item "_NestedSequence[complex | bytes | str]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "shape"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "Buffer" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "_SupportsArray[dtype[Any]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "_NestedSequence[_SupportsArray[dtype[Any]]]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "complex" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "bytes" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "str" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
- scipy/stats/_entropy.py:369: error: Item "_NestedSequence[complex | bytes | str]" of "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]" has no attribute "dtype"  [union-attr]
+ scipy/spatial/transform/_rotation.py:2578: error: Unused "type: ignore" comment  [unused-ignore]
- scipy/conftest.py:721: error: "str" not callable  [operator]

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/main.py:864: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/_internal/_discriminated_union.py:210: error: "Mapping[str, Any]" has no attribute "pop"  [attr-defined]
- pydantic/types.py:3148: error: "Mapping[str, Any]" has no attribute "pop"  [attr-defined]
- pydantic/_internal/_known_annotated_metadata.py:223: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
- pydantic/_internal/_known_annotated_metadata.py:223: error: Unsupported target for indexed assignment ("Mapping[str, Any] | AfterValidatorFunctionSchema")  [index]
- pydantic/_internal/_generate_schema.py:2358: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
- pydantic/_internal/_generate_schema.py:2366: error: Unsupported target for indexed assignment ("Mapping[str, Any]")  [index]
+ pydantic/deprecated/copy_internals.py:49: error: Unused "type: ignore" comment  [unused-ignore]
- pydantic/experimental/pipeline.py:464: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:468: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:472: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:496: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:507: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:518: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:529: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:543: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:545: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:562: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:575: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:586: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]
- pydantic/experimental/pipeline.py:655: error: Unsupported target for indexed assignment ("Mapping[str, Any] | Any")  [index]

beartype (https://github.com/beartype/beartype)
+ error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 2.5.0+dev.0256f151cacd8a9d597a733fe6539c13cc4c5108
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 6, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 16, in console_entry
+     main()
+     ~~~~^^
+   File "/main.py", line 167, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+                               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/main.py", line 257, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 388, in build
+     metastore = create_metastore(options, parallel_worker=False)
+   File "/build.py", line 1902, in create_metastore
+     mds: MetadataStore = SqliteMetadataStore(
+                          ~~~~~~~~~~~~~~~~~~~^
+         _cache_dir_prefix(options),
+         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+         set_journal_mode=not parallel_worker,
+         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+         num_shards=options.sqlite_num_shards,
+         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+     )
+     ^
+   File "/metastore.py", line 200, in __init__
+     connect_db(os_path_join(cache_dir_prefix, f"cache.{i}.db"), set_journal_mode)
+     ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/metastore.py", line 174, in connect_db
+     db.execute("PRAGMA journal_mode=WAL")
+     ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ sqlite3.OperationalError: database is locked
+ 
- beartype/typing/__init__.py:331: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/kind/maplike/utilmaptest.py:96: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_cave/_cavefast.py:181: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_cave/_cavefast.py:289: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_cave/_cavefast.py:1402: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/text/utiltextjoin.py:339: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/kind/maplike/utilmapfrozen.py:224: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/error/utilerrwarn.py:83: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/error/utilerrwarn.py:89: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/error/utilerrwarn.py:124: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/utilhintfactory.py:46: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_conf/_confoverrides.py:89: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_conf/confmain.py:1437: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/utilobjattr.py:362: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/text/utiltextlabel.py:179: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/module/utilmodtest.py:21: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep696.py:118: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep557.py:81: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep749/pep749evaluate.py:265: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:483: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:520: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:609: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/pep484585args.py:61: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484/pep484union.py:87: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484/pep484604union.py:150: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484/pep484604union.py:277: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484/pep484604union.py:282: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncscope.py:822: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncframe.py:1239: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfunccodeobj.py:130: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfunccodeobj.py:348: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/api/external/utilnumpy.py:254: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdreffake.py:189: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/kind/inferthirdparty.py:125: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/kind/inferthirdparty.py:134: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/kind/inferthirdparty.py:138: error: Unused "type: ignore[misc, valid-type]" comment  [unused-ignore]
- beartype/bite/kind/inferthirdparty.py:144: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/collection/infercollectionsabc.py:163: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/collection/infercollectionsabc.py:830: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep586.py:243: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep544.py:115: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep749/pep484749forwardref.py:471: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484/pep484generic.py:149: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484/pep484generic.py:177: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncmake.py:24: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncmake.py:308: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncmake.py:313: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncmake.py:355: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncmake.py:356: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/cls/pep/clspep3119.py:99: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/cls/pep/clspep3119.py:278: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/cls/pep/clspep3119.py:441: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/cls/pep/clspep3119.py:549: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/cls/pep/clspep3119.py:612: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/cls/pep/clspep3119.py:911: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_cache/cls/cacheclsabc.py:98: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep585.py:378: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep749/pep649749annotate.py:438: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep749/pep649749annotate.py:518: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep749/pep649749annotate.py:916: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/arg/utilfuncargiter.py:404: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/arg/utilfuncargiter.py:419: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/arg/utilfuncargiter.py:424: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/pep/pep484/checkpep484typevar.py:178: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep484585/redpep484585itemsview.py:72: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep484585/redpep484585itemsview.py:82: error: Unused "type: ignore[assignment]" comment  [unused-ignore]
- beartype/_check/cls/hint/hintsane.py:529: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doormeta.py:138: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doormeta.py:204: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/pep484585func.py:110: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_redrecurse.py:230: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/redpep673.py:129: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep484585/redpep484585subclass.py:109: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/cls/call/calldatadecorfuncmin.py:86: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/collection/infercollectionitems.py:317: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/collection/infercollectionitems.py:500: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/utilpepget.py:453: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/utilpepget.py:1038: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/utilpepget.py:1173: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/func/utilfuncwrap.py:542: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_nonpep/api/redapinumpy.py:129: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_nonpep/api/redapinumpy.py:275: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_nonpep/api/redapinumpy.py:325: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:504: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:612: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:789: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:964: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:1075: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefcache.py:394: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefcache.py:522: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/vale/_is/_valeistype.py:122: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/vale/_is/_valeistype.py:325: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/vale/_is/_valeisoper.py:184: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/vale/_is/_valeisobj.py:138: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/vale/_is/_valeis.py:265: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:83: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:302: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:381: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:640: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:684: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:751: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/forward/reference/_cls/fwdrefmeta.py:792: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep695.py:565: error: Unused "type: ignore[union-attr]" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep695.py:692: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep484/redpep484ref.py:294: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/utilpepsign.py:589: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep612.py:90: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep612.py:96: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep612.py:167: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep612.py:227: error: Unused "type: ignore[attr-defined]" comment  [unused-ignore]
- beartype/_util/hint/pep/proposal/pep612.py:260: error: Unused "type: ignore[attr-defined]" comment  [unused-ignore]
- beartype/_check/pep/pep484585/checkpep484585subclass.py:128: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/pep/pep484585/checkpep484585subclass.py:139: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:220: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:643: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_reduce/_pep/pep646/redpep484612646typearg.py:1258: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_convcoerce.py:205: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/convert/_convcoerce.py:421: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/bite/_infermain.py:268: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/cls/hint/tree/hinttreeerror.py:484: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/error/errmain.py:194: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/error/_nonpep/errnonpeptype.py:107: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/error/_nonpep/errnonpeptype.py:253: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/code/_pep/pep484585/codepep484585subclass.py:71: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/code/_pep/pep484/codepep484604union.py:197: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/code/codemain.py:737: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/code/codemain.py:854: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/_check/make/checkmakefunc.py:626: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doorabc.py:717: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doorabc.py:1192: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doorabc.py:1210: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doorabc.py:1228: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/doorabc.py:1250: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/pep/doorpep586.py:79: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/pep/doorpep586.py:92: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/pep/doorpep484604.py:59: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/pep/pep484585/doorpep484585callable.py:211: error: Unused "type: ignore" comment  [unused-ignore]
- beartype/door/_cls/pep/pep484/doorpep484newtype.py:65: error: Unused "type: ignore" comment  [unused-ignore]

... (truncated 43 lines) ...

sympy (https://github.com/sympy/sympy)
+ sympy/core/evalf.py:917: error: Unused "type: ignore" comment  [unused-ignore]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/arrays/interval.py:694: error: Argument 1 to "ndim" has incompatible type "ndarray[Any, Any] | ExtensionArray"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]"  [arg-type]
+ pandas/core/reshape/merge.py:2968: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/indexes/base.py:4434: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/indexes/base.py:4454: error: Unused "type: ignore" comment  [unused-ignore]

boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/listing.py:403: error: Unused "type: ignore" comment  [unused-ignore]
+ boostedblob/listing.py:412: error: Unused "type: ignore" comment  [unused-ignore]

poetry (https://github.com/python-poetry/poetry)
+ tests/helpers.py:269: error: Returning Any from function declared to return "EntryPoint"  [no-any-return]

ibis (https://github.com/ibis-project/ibis)
- ibis/backends/datafusion/__init__.py:429: error: Item "str" of "str | Any" has no attribute "names"  [union-attr]
- ibis/backends/datafusion/__init__.py:432: error: Item "str" of "str | Any" has no attribute "table"  [union-attr]

jax (https://github.com/google/jax)
- jax/_src/numpy/util.py:387: error: Argument 1 to "ndim" has incompatible type "int | float | complex | SupportsNdim"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]"  [arg-type]
- jax/_src/third_party/scipy/betaln.py:63: error: Unsupported operand types for > ("int" and "complex")  [operator]
- jax/_src/third_party/scipy/betaln.py:63: note: Left operand is of type "Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex"
- jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "str" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "str" of "str | PathLike[str]" has no attribute "iterdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:152: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "iterdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:156: error: Item "str" of "str | PathLike[str]" has no attribute "iterdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:156: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "iterdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:166: error: Item "str" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:166: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "str" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "str" of "str | PathLike[str]" has no attribute "iterdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:171: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "iterdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:193: error: Item "str" of "str | PathLike[str]" has no attribute "mkdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:193: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "mkdir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "str" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "exists"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "str" of "str | PathLike[str]" has no attribute "is_dir"  [union-attr]
- jax/experimental/array_serialization/pytree_serialization.py:194: error: Item "PathLike[str]" of "str | PathLike[str]" has no attribute "is_dir"  [union-attr]

PyGithub (https://github.com/PyGithub/PyGithub)
+ github/PaginatedList.py:455: error: Unused "type: ignore" comment  [unused-ignore]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/sandbox.py:570:5: error: Returning Any from function declared to return "int"  [no-any-return]

static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/index_datetime.py:150: error: Unused "type: ignore" comment  [unused-ignore]
+ static_frame/core/index_hierarchy.py:1523: error: Returning Any from function declared to return "int"  [no-any-return]
+ static_frame/core/index_hierarchy.py:2052: error: Returning Any from function declared to return "ndarray[Any, Any]"  [no-any-return]

apprise (https://github.com/caronc/apprise)
- apprise/utils/pem.py:323: error: "None" has no attribute "public_bytes"  [attr-defined]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/code.py:74: error: Unused "type: ignore" comment  [unused-ignore]
+ pymongo/synchronous/bulk.py:369: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners"  [arg-type]
+ pymongo/synchronous/bulk.py:404: error: Argument 3 to "_execute_batch" of "_Bulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]"  [arg-type]
+ pymongo/synchronous/bulk.py:424: error: Argument 3 to "_execute_batch_unack" of "_Bulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]"  [arg-type]
+ pymongo/synchronous/bulk.py:501: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners"  [arg-type]
+ pymongo/synchronous/bulk.py:516: error: Argument 3 to "_execute_batch_unack" of "_Bulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]"  [arg-type]
+ pymongo/asynchronous/bulk.py:369: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners"  [arg-type]
+ pymongo/asynchronous/bulk.py:404: error: Argument 3 to "_execute_batch" of "_AsyncBulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]"  [arg-type]
+ pymongo/asynchronous/bulk.py:424: error: Argument 3 to "_execute_batch_unack" of "_AsyncBulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]"  [arg-type]
+ pymongo/asynchronous/bulk.py:503: error: Argument 5 to "_BulkWriteContext" has incompatible type "_EventListeners | None"; expected "_EventListeners"  [arg-type]
+ pymongo/asynchronous/bulk.py:518: error: Argument 3 to "_execute_batch_unack" of "_AsyncBulk" has incompatible type "islice[Any]"; expected "list[Mapping[str, Any]]"  [arg-type]
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi
ilevkivskyi merged commit 41ddcdb into python:master Sep 28, 2026
25 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi
ilevkivskyi deleted the better-binder-any branch September 28, 2026 23:23
@cdce8p

cdce8p commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the ping @ilevkivskyi! I'm a bit preoccupied at the moment which is why I didn't see this earlier. In total this change results in 40 new error messages for Home Assistant, most are acceptable.

One pattern I saw repeatedly which will now raise an error is:

# mypy: warn_return_any
from typing import Any

def func() -> Any:
    ...

def do_something() -> int:
    var: int
    var = func()
    reveal_type(var)
    return var
note: Revealed type is "Any"
error: Returning Any from function declared to return "int"  [no-any-return]

I feel like if people go out of their way to annotate a variable beforehand, the type should stick and not be "overwritten" with Any, though I'm not sure if that can be implemented.

Note that var: int = func() would not raise an error. However that's not possible if var is assigned in different branches inside a conditional statement.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi

ilevkivskyi commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

@cdce8p Note the key point here is that if func() return type is unannotated (or from a missing import), then we still keep the int after assignment. I think a proper solution for situations like you show (with an explicit Any, which usually means "too dynamic to express") is to use assert isinstance(var, int) instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cdce8p

cdce8p commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

I think a proper solution for situations like you show (with an explicit Any, which usually means "too dynamic to express") is to use assert isinstance(var, int) instead.

While that works for simple types, it doesn't fully for generic ones. For Home Assistant it's about 20% of cases and it might be similar for other projects. Errors are good if they are helpful. However here they will likely just lead to additional (unnecessary) type ignores. As another data point, pyright will still infer it as int so we'd be deviating from that as well.

If you like to look at the examples yourself: cdce8p/ha-core@8cc2d31

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi

ilevkivskyi commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

@cdce8p

While that works for simple types, it doesn't fully for generic ones

I am not sure I follow: we only give the Returning Any from function only for plain Any, so a single isinstance() should ~always work. I think there is some misunderstanding about the logic behind --warn-return-any. The idea is to allow users to create more robust boundaries between unsafe/dynamic code and a fully statically-typed code. Taking one of your examples:

def async_get_devices_by_type(
    bootstrap: Bootstrap, device_type: ModelType
) -> dict[str, ProtectAdoptableDeviceModel]:
    """Get devices by type."""
    devices: dict[str, ProtectAdoptableDeviceModel]
    devices = getattr(bootstrap, device_type.devices_key)
    return devices  # type: ignore[no-any-return]

should instead be written like this instead:

def async_get_devices_by_type(
    bootstrap: Bootstrap, device_type: ModelType
) -> dict[str, ProtectAdoptableDeviceModel]:
    """Get devices by type."""
    devices = getattr(bootstrap, device_type.devices_key)
    assert isinstance(devices, dict)
    return devices

So I think all the examples in cdce8p/ha-core@8cc2d31 can be rewritten without type: ignores.

We may need to update the docs on no-any-return error code to better explain this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi ilevkivskyi mentioned this pull request Sep 29, 2026
Improve docs for no-any-return error code #22070
Merged
@cdce8p

cdce8p commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

While that works for simple types, it doesn't fully for generic ones

I was thinking about something like this though I've to admit that I didn't check it before posting my comment.

def do_something() -> list[str]:
    var = func()
    assert isinstance(var, list)
    reveal_type(var)  # should be list[str]
    return var

isinstance doesn't allow parameterized generics so at best this will be inferred as list[Any]. cast will work though.

--

So I think all the examples in cdce8p/ha-core@8cc2d31 can be rewritten without type: ignores.

Sure but that's usually not what happens. For typing asserts or casts it's sometimes also desired to guard them behind an if TYPE_CHECKING block for performance reasons which just increases the complexity. Additionally if the variable is assigned in different branches with returns in each, the check will need to be duplicated as well. All I'm trying to say is that this will increase churn while providing little benefit. In my personal opinion any assignment of Any to an annotated variable should be handled like the user explicitly opted-out of type checking for that one. Because that's why the variable annotations were added there in the first place, to avoid having to use assert or cast.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ilevkivskyi

ilevkivskyi commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

All I'm trying to say is that this will increase churn while providing little benefit

My point is exactly the opposite, writing a type twice doesn't make code any safer. While knowing a minimal set of places where isinstance() are needed to make the code safer is actually beneficial. Anyway, I think we are going in circles here, I opened #22070 to hopefully make this a bit more clear.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ilevkivskyi added a commit that referenced this pull request Sep 30, 2026
@ilevkivskyi
Improve docs for no-any-return error code (#22070)
25d86c6
See discussion in #22050 for context.
@zhengdaodeguL zhengdaodeguL mentioned this pull request Nov 19, 2026
mypy seems to forget inferred type after asigning an Any typed variable #22518
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JukkaL JukkaL JukkaL approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ilevkivskyi @cdce8p @JukkaL
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.