FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Don't erase type object args in diagnostics by hauntsaninja · Pull Request #18352 · python/mypy · GitHub

Repository navigation

Don't erase type object args in diagnostics - #18352

Merged
hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:eraser
Dec 28, 2024
Merged

hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:eraser

Conversation

Copy link
Copy Markdown
Collaborator

Fixes #16875

This comment has been minimized.

Copy link
Copy Markdown
Contributor

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

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/clients.py:2428: error: Argument 1 to "get_type_dependency" of "Client" has incompatible type "type[SingleStoreCache[Any]]"; expected "type[SingleStoreCache[Application]] | type[None]"  [arg-type]
+ tanjun/clients.py:2428: error: Argument 1 to "get_type_dependency" of "Client" has incompatible type "type[SingleStoreCache[AuthorizationApplication]]"; expected "type[SingleStoreCache[Application]] | type[None]"  [arg-type]

operator (https://github.com/canonical/operator)
- ops/charm.py:1756: error: Incompatible types in assignment (expression has type "object", variable has type "type[list[Any]]")  [assignment]
+ ops/charm.py:1756: error: Incompatible types in assignment (expression has type "object", variable has type "type[list[str]]")  [assignment]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/client.py:1276: error: Invalid self argument "type[TradeOffer[Any, Any, Any]]" to attribute function "_from_history" with type "Callable[[type[TradeOffer[MovedItem[UserT], MovedItem[ClientUser], UserT]], ConnectionState, TradeOfferHistoryTrade, Sequence[Description]], TradeOffer[MovedItem[UserT], MovedItem[ClientUser], UserT]]"  [misc]
+ steam/client.py:1276: error: Invalid self argument "type[TradeOffer[ReceivingAssetT, SendingAssetT, UserT]]" to attribute function "_from_history" with type "Callable[[type[TradeOffer[MovedItem[UserT], MovedItem[ClientUser], UserT]], ConnectionState, TradeOfferHistoryTrade, Sequence[Description]], TradeOffer[MovedItem[UserT], MovedItem[ClientUser], UserT]]"  [misc]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/operations/__init__.py:8: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[Any]]")  [assignment]
+ ibis/expr/operations/__init__.py:8: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[T]]")  [assignment]
- ibis/expr/operations/__init__.py:13: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[Any]]")  [assignment]
+ ibis/expr/operations/__init__.py:13: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[T]]")  [assignment]
- ibis/expr/operations/__init__.py:14: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[Any]]")  [assignment]
+ ibis/expr/operations/__init__.py:14: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[T]]")  [assignment]
- ibis/expr/operations/__init__.py:20: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[Any]]")  [assignment]
+ ibis/expr/operations/__init__.py:20: error: Incompatible import of "Literal" (imported name has type "<typing special form>", local name has type "type[Literal[T]]")  [assignment]
- ibis/expr/types/relations.py:4401: error: Argument 1 to "map" has incompatible type "type[tuple[Any, ...]]"; expected "Callable[[list[str]], str]"  [arg-type]
+ ibis/expr/types/relations.py:4401: error: Argument 1 to "map" has incompatible type "type[tuple[_T_co, ...]]"; expected "Callable[[list[str]], str]"  [arg-type]

werkzeug (https://github.com/pallets/werkzeug)
- tests/test_wrappers.py:1057: error: Incompatible types in assignment (expression has type "type[tuple[Any, ...]]", variable has type "type[list[Any]]")  [assignment]
+ tests/test_wrappers.py:1057: error: Incompatible types in assignment (expression has type "type[tuple[_T_co, ...]]", variable has type "type[list[Any]]")  [assignment]
- tests/test_wrappers.py:1059: error: Non-overlapping identity check (left operand type: "type[list[str]]", right operand type: "type[tuple[Any, ...]]")  [comparison-overlap]
+ tests/test_wrappers.py:1059: error: Non-overlapping identity check (left operand type: "type[list[str]]", right operand type: "type[tuple[_T_co, ...]]")  [comparison-overlap]
- tests/test_local.py:231: error: Non-overlapping identity check (left operand type: "type[list[Any]]", right operand type: "type[LocalProxy[Any]]")  [comparison-overlap]
+ tests/test_local.py:231: error: Non-overlapping identity check (left operand type: "type[list[Any]]", right operand type: "type[LocalProxy[T]]")  [comparison-overlap]

JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks fine, I wonder why we were using erase_type() in the first place.

Copy link
Copy Markdown
Collaborator Author

Dates to #3374 (comment)
I think this is fine, it's not worth the confusion. Other type checkers report similar diagnostics as mypy does with this PR.

hauntsaninja merged commit 44bf7e5 into python:master Dec 28, 2024
hauntsaninja deleted the eraser branch December 28, 2024 22:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Using numpy types conditionally gives confusing [assignment] error

2 participants


Back | FazBrowse Home | New Git URL