Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeVar defaults with None (PEP 696) #16859

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Feb 2, 2024

Ref: #14851

@cdce8p cdce8p added the topic-pep-696 TypeVar defaults label Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

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

steam.py (https://github.com/Gobot1234/steam.py)
- steam/badge.py:129: error: Argument 1 to "inventory" of "PartialUser" has incompatible type "tuple[str, int]"; expected "App[str]"  [arg-type]
+ steam/badge.py:129: error: Argument 1 to "inventory" of "PartialUser" has incompatible type "tuple[str, int]"; expected "App[str | None]"  [arg-type]
- steam/app.py:696: error: Argument 2 to "AppStats" has incompatible type "PartialApp[NameT]"; expected "App[str]"  [arg-type]
- steam/app.py:710: error: Argument 2 to "AppAchievement" has incompatible type "PartialApp[NameT]"; expected "PartialApp[str]"  [arg-type]
- steam/app.py:724: error: Type argument "Self" of "Leaderboard" must be a subtype of "App[str]"  [type-var]
- steam/app.py:736: error: Value of type variable "AppT" of "Leaderboard" cannot be "Self"  [type-var]
- steam/app.py:749: error: Type argument "Self" of "Leaderboard" must be a subtype of "App[str]"  [type-var]
- steam/app.py:765: error: Value of type variable "AppT" of "Leaderboard" cannot be "Self"  [type-var]
- steam/app.py:775: error: Type argument "Self" of "Leaderboard" must be a subtype of "App[str]"  [type-var]
- steam/app.py:786: error: Value of type variable "AppT" of "Leaderboard" cannot be "Self"  [type-var]
- steam/app.py:832: error: Argument 1 to "fetch_review" of "PartialUser" has incompatible type "PartialApp[NameT]"; expected "App[str]"  [arg-type]
- steam/app.py:1169: error: Type argument "Self" of "CommunityItem" must be a subtype of "PartialApp[str]"  [type-var]
- steam/app.py:1181: error: Value of type variable "AppT" of "CommunityItem" cannot be "Self"  [type-var]
- steam/app.py:1230: error: Type argument "Self" of "RewardItem" must be a subtype of "PartialApp[str]"  [type-var]
- steam/app.py:1240: error: Value of type variable "AppT" of "RewardItem" cannot be "Self"  [type-var]
- steam/app.py:1271: error: Value of type variable "AppT" of "AppBadge" cannot be "Self"  [type-var]
- steam/app.py:1300: error: Type argument "Self" of "RewardItem" must be a subtype of "PartialApp[str]"  [type-var]
- steam/app.py:1305: error: Type argument "Self" of "AppBadge" must be a subtype of "PartialApp[str]"  [type-var]
- steam/app.py:1316: error: Value of type variable "AppT" of "AppBadge" cannot be "Self"  [type-var]
- steam/app.py:1374: error: Argument 1 to "temporarily_play" of "ConnectionState" has incompatible type "PartialApp[NameT]"; expected "App[str]"  [arg-type]
- steam/profile.py:152: error: Argument 1 to "inventory" of "PartialUser" has incompatible type "tuple[str, int]"; expected "App[str]"  [arg-type]
+ steam/profile.py:152: error: Argument 1 to "inventory" of "PartialUser" has incompatible type "tuple[str, int]"; expected "App[str | None]"  [arg-type]
- steam/event.py:277: error: Incompatible types in assignment (expression has type "App[str] | PartialApp[str | None] | None", variable has type "PartialApp[str | None] | None")  [assignment]
+ steam/event.py:277: error: Incompatible types in assignment (expression has type "App[str | None] | None", variable has type "PartialApp[str | None] | None")  [assignment]
- steam/user_news.py:112: error: Argument 1 to "fetch_review" of "PartialUser" has incompatible type "PartialApp[str | None]"; expected "App[str]"  [arg-type]
- steam/ext/commands/commands.py:288: error: Incompatible types in assignment (expression has type "GroupMixin[Any] | Group[Any, [VarArg(Any), KwArg(Any)], Any] | None", variable has type "Self")  [assignment]
+ steam/ext/commands/commands.py:288: error: Incompatible types in assignment (expression has type "GroupMixin[Any | None] | Group[Any, [VarArg(Any), KwArg(Any)], Any] | None", variable has type "Self")  [assignment]
- steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str], *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str | None], *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str | None], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/csgo/models.py:179: note:          def inventory(self, App[str], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/csgo/models.py:179: note:          def inventory(self, App[str | None], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str | None], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/csgo/models.py:179: note:          def inventory(self, App[str], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/csgo/models.py:179: note:          def inventory(self, App[str | None], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/csgo/models.py:179: note:          def inventory(self, app: App[str | None], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str], *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str | None], *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str | None], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/tf2/client.py:36: note:          def inventory(self, App[str], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/tf2/client.py:36: note:          def inventory(self, App[str | None], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str | None], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/tf2/client.py:36: note:          def inventory(self, App[str], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/tf2/client.py:36: note:          def inventory(self, App[str | None], /, *, context_id: int | None = ..., language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
- steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]
+ steam/ext/tf2/client.py:36: note:          def inventory(self, app: App[str | None], *, language: Language | None = ...) -> Coroutine[Any, Any, Inventory[Item[ClientUser], ClientUser]]

@JelleZijlstra JelleZijlstra merged commit 3f58c2d into python:master Feb 2, 2024
18 checks passed
@cdce8p cdce8p deleted the TypeVar-10-fix-strict-optional branch February 2, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-pep-696 TypeVar defaults
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants