-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Improve pyright tests, refactor model decorators signatures
#10092
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
Conversation
Deploying pydantic-docs with
|
| Latest commit: |
4493ecc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://25ce9029.pydantic-docs.pages.dev |
| Branch Preview URL: | https://10078-1.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging #10092 will not alter performanceComparing Summary
|
Update documentation regarding invalid decorators
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
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.
Truly fantastic work here. It's awesome to see how comfortable you are with the typing in this space of the codebase, and great to see such significant improvements.
I've left a few questions / requests.
Great work expanding the pyright test suite. This is a great way to track typing support issues / features going forward!
|
|
||
| return dec | ||
| return dec # pyright: ignore[reportReturnType] |
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.
Part of the reason I'm wondering if we lost some specificity here...
pydantic/functional_serializers.py
Outdated
| @@ -363,14 +392,14 @@ def serialize_model(self): | |||
| The decorator function. | |||
| """ | |||
|
|
|||
| def dec(f: Callable[..., Any]) -> _decorators.PydanticDescriptorProxy[Any]: | |||
| def dec(f: AnyModelPlainSerializer | AnyModelWrapSerializer) -> _decorators.PydanticDescriptorProxy[Any]: | |||
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.
👀
ModelSerializer: TypeAlias = 'AnyModelPlainSerializer | AnyModelWrapSerializer'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.
Good catch
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.
Great work here. Thanks for explaining some of the nitty gritty typing patters here. Feel free to merge when you're ready 👍
Fixes #10078
Checklist