Repository navigation
More typeddict fixes - #5756
Open
yangdanny97 wants to merge 3 commits into
Open
More typeddict fixes#5756yangdanny97 wants to merge 3 commits into
yangdanny97 wants to merge 3 commits into
Conversation
|
✅ This PR meets all requirements from our pull request checklist. Optional recommendations:
Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour. |
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D134402139. (Because this pull request was imported automatically, there will not be any future comments.) |
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +11 new errors, -0 fixed errors
By preset: +11/-0 (default), +11/-0 (strict)
Projects with changes (4):
discord.py: +2 -0
strawberry: +4 -0
steam.py: +4 -0
aiohttp: +1 -0
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
discord.py (https://github.com/Rapptz/discord.py)
+ ERROR discord/ext/commands/core.py:1775:5-12: Implementation signature `(name: str = ..., cls: type[Command[Any, ..., Any]] = ..., **attrs: Unpack[_CommandDecoratorKwargs]) -> Any` does not accept all arguments that overload signature `(name: str = ..., **attrs: Unpack[_CommandDecoratorKwargs]) -> _CommandDecorator` accepts [inconsistent-overload]
+ ERROR discord/ext/commands/core.py:1835:5-10: Implementation signature `(name: str = ..., cls: type[Group[Any, ..., Any]] = ..., **attrs: Unpack[_GroupDecoratorKwargs]) -> Any` does not accept all arguments that overload signature `(name: str = ..., **attrs: Unpack[_GroupDecoratorKwargs]) -> _GroupDecorator` accepts [inconsistent-overload]
strawberry (https://github.com/strawberry-graphql/strawberry)
+ ERROR strawberry/federation/field.py:75:5-10: Implementation signature `(resolver: ((...) -> Awaitable[Any]) | ((...) -> Coroutine[Any, Any, Any]) | ((...) -> Any) | StrawberryResolver[Any] | classmethod[Any, ..., Any] | staticmethod[..., Any] | None = None, *, name: str | None = None, is_subscription: bool = False, description: str | None = None, permission_classes: list[type[BasePermission]] | None = None, deprecation_reason: str | None = None, default: Any = _MISSING_TYPE.MISSING, default_factory: ((...) -> object) | object = _MISSING_TYPE.MISSING, metadata: Mapping[Any, Any] | None = None, directives: Sequence[object] | None = ..., extensions: list[FieldExtension] | None = None, graphql_type: Any | None = None, init: bool | None = None, **federation_kwargs: Unpack[FederationFieldParams]) -> Any` does not accept all arguments that overload signature `(*, name: str | None = None, is_subscription: bool = False, description: str | None = None, init: Literal[True] = True, permission_classes: list[type[BasePermission]] | None = None, deprecation_reason: str | None = None, default: Any = _MISSING_TYPE.MISSING, default_factory: ((...) -> object) | object = _MISSING_TYPE.MISSING, metadata: Mapping[Any, Any] | None = None, directives: Sequence[object] | None = ..., extensions: list[FieldExtension] | None = None, graphql_type: Any | None = None, **federation_kwargs: Unpack[FederationFieldParams]) -> Any` accepts [inconsistent-overload]
+ ERROR strawberry/federation/object_type.py:81:5-9: Implementation signature `(cls: T | None = None, *, name: str | None = None, description: str | None = None, directives: Iterable[object] = ..., **federation_kwargs: Unpack[FederationTypeParams]) -> Unknown` does not accept all arguments that overload signature `(*, name: str | None = None, description: str | None = None, directives: Iterable[object] = ..., **federation_kwargs: Unpack[FederationTypeParams]) -> [T: type[Any]](T) -> T` accepts [inconsistent-overload]
+ ERROR strawberry/federation/object_type.py:186:5-14: Implementation signature `(cls: T | None = None, *, name: str | None = None, description: str | None = None, directives: Iterable[object] = ..., **federation_kwargs: Unpack[FederationInterfaceParams]) -> Unknown` does not accept all arguments that overload signature `(*, name: str | None = None, description: str | None = None, directives: Iterable[object] = ..., **federation_kwargs: Unpack[FederationInterfaceParams]) -> [T: type[Any]](T) -> T` accepts [inconsistent-overload]
+ ERROR strawberry/federation/object_type.py:235:5-21: Implementation signature `(cls: T | None = None, *, name: str | None = None, description: str | None = None, directives: Iterable[object] = ..., **federation_kwargs: Unpack[FederationInterfaceParams]) -> Unknown` does not accept all arguments that overload signature `(*, name: str | None = None, description: str | None = None, directives: Iterable[object] = ..., **federation_kwargs: Unpack[FederationInterfaceParams]) -> [T: type[Any]](T) -> T` accepts [inconsistent-overload]
steam.py (https://github.com/Gobot1234/steam.py)
+ ERROR steam/ext/commands/commands.py:695:9-16: Implementation signature `(self: Self@GroupMixin, callback: CoroFuncT | None = None, /, *, name: str | None = None, cls: type[C] = ..., **attrs: Any) -> ((CoroFuncT) -> C) | C` does not accept all arguments that overload signature `(self: Self@GroupMixin, **kwargs: Unpack[CommandKwargsNoCls]) -> [**P = ..., R = Any](CallbackT) -> Command[CogT, P, R]` accepts [inconsistent-overload]
+ ERROR steam/ext/commands/commands.py:741:9-14: Implementation signature `(self: Self@GroupMixin, callback: CoroFuncT | None = None, /, *, name: str | None = None, cls: type[G] | None = None, **attrs: Any) -> ((CoroFuncT) -> G) | G` does not accept all arguments that overload signature `(self: Self@GroupMixin, **kwargs: Unpack[CommandKwargsNoCls]) -> [**P = ..., R = Any](CallbackT) -> Group[CogT, P, R]` accepts [inconsistent-overload]
+ ERROR steam/ext/commands/commands.py:795:5-12: Implementation signature `(callback: CoroFuncT | None = None, /, *, name: str | None = None, cls: type[C] = ..., **attrs: Any) -> ((CoroFuncT) -> C) | C` does not accept all arguments that overload signature `(**kwargs: Unpack[CommandKwargsNoCls]) -> [CogT: Bot | Cog | None = Bot | Cog | None, **P = ..., R = Any](CallbackT) -> Command[CogT, P, R]` accepts [inconsistent-overload]
+ ERROR steam/ext/commands/commands.py:844:5-10: Implementation signature `(callback: CoroFuncT | None = None, /, *, name: str | None = None, cls: type[G] | None = None, **attrs: Any) -> ((CoroFuncT) -> G) | G` does not accept all arguments that overload signature `(**kwargs: Unpack[CommandKwargsNoCls]) -> [CogT: Bot | Cog | None = Bot | Cog | None, **P = ..., R = Any](CallbackT) -> Group[CogT, P, R]` accepts [inconsistent-overload]
aiohttp (https://github.com/aio-libs/aiohttp)
+ ERROR aiohttp/web_server.py:50:9-17: Implementation signature `(self: Self@Server, handler: (_Request) -> Awaitable[StreamResponse], *, request_factory: ((RawRequestMessage | Unknown, StreamReader, RequestHandler[_Request], AbstractStreamWriter, Task[None], HTTPBadRequest | None) -> _Request) | None = None, debug: bool | None = None, handler_cancellation: bool = False, **kwargs: Unpack[_RequestHandlerKwargs]) -> None` does not accept all arguments that overload signature `(self: Server[BaseRequest], handler: (_Request) -> Awaitable[StreamResponse], *, debug: bool | None = None, handler_cancellation: bool = False, **kwargs: Unpack[_RequestHandlerKwargs]) -> None` accepts [inconsistent-overload] |
stroxler
approved these changes
Nov 25, 2026
stroxler
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This branch has not been deployed
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
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.
Summary
Adds 2 more test cases for David Halter's comments on python/typing#2338 (comment)
In the following excerpt below (see linked comment for context)
Pyrefly currently does not error on 1; this PR also fixes that behavior
The PR only adds one rule: the target's extra-kwarg type must also be assignable to every source keyword parameter the target doesn't name.
The actual delta is larger because Claude found a simpler representation of the rules that uses fewer match cases
Test Plan
test.py
primer - the new errors should be correct per the implemented rules, the fix would be to mark the relevant TypedDicts as closed