-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix IncEx type alias definition
#10339
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: |
5ab7f38
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fa7af8a1.pydantic-docs.pages.dev |
| Branch Preview URL: | https://inc-ex-ann.pydantic-docs.pages.dev |
pydantic/main.py
Outdated
| # Keep these type aliases available at runtime: | ||
| TupleGenerator: TypeAlias = Generator[Tuple[str, Any], None, None] | ||
| # Keep this type alias in sync with the stub definition in `pydantic-core`: | ||
| IncEx: TypeAlias = 'set[int] | set[str] | dict[int, IncEx | bool] | dict[str, IncEx | bool]' |
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.
I removed the | None and added it in the relevant method signatures, as it makes more sense imo to keep the type alias scoped to what it represents, and then have consumers of this type alias make it optional or not.
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 call.
CodSpeed Performance ReportMerging #10339 will not alter performanceComparing Summary
|
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.
Looks good. What happened to ModelT?
pydantic/main.py
Outdated
| # Keep these type aliases available at runtime: | ||
| TupleGenerator: TypeAlias = Generator[Tuple[str, Any], None, None] | ||
| # Keep this type alias in sync with the stub definition in `pydantic-core`: | ||
| IncEx: TypeAlias = 'set[int] | set[str] | dict[int, IncEx | bool] | dict[str, IncEx | bool]' |
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 call.
I moved it just above the |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Change Summary
Fixes #10333
Requires pydantic/pydantic-core#1443
Ideally we would import
_IncExfrompydantic-core, but some external tools requires these annotations to be available at runtime :/Checklist