Make TypeAdapter's typing compatible with special forms#8923
Merged
sydney-runkle merged 1 commit intomainfrom Feb 29, 2024
Merged
Make TypeAdapter's typing compatible with special forms#8923sydney-runkle merged 1 commit intomainfrom
sydney-runkle merged 1 commit intomainfrom
Conversation
Deploying with
|
| Latest commit: |
90f5d0b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://205bc39a.pydantic-docs2.pages.dev |
| Branch Preview URL: | https://type-adapter-typing.pydantic-docs2.pages.dev |
CodSpeed Performance ReportMerging #8923 will not alter performanceComparing Summary
|
sydney-runkle
approved these changes
Feb 29, 2024
Contributor
sydney-runkle
left a comment
There was a problem hiding this comment.
Nice, thanks for adding the comment as well 👍
13 tasks
1 task
1 task
blast-hardcheese
added a commit
to replit/river-python
that referenced
this pull request
Aug 19, 2024
Why === Any place we might encounter a `Union[...]`, we need `# type: ignore[arg-type]` to avoid mypy failing to typecheck, due to pydantic/pydantic#8923, acknowledging that while pyright seems to have good inference, mypy fails to typecheck. To better understand the issue and determine if there were any workarounds, I created https://github.com/blast-hardcheese/mypy-union-bug with the intent to report upstream, before finding the ongoing discussion threads linked here and in comments. What changed ============ ### Main - Reflow format strings to use multiline format strings and `indent(dedent(s, ...))`. This gives us more horizontal space instead of trying to use C-style line continuation to avoid the 88-character limit - Adding `# type: ignore[arg-type]` to possible `Union` slots ### 🧹 - Tracking type literals more closely - Reducing nested format strings for clarity - Bubble up string-formatted comma for intelligibility Test plan ========= Manually running against production schemas, gathering sources together for a sensible local test suite for codegen
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.
See python/typing#1618