Support for optional as UnionType (Python >= 3.10)#739
Closed
mkomet wants to merge 1 commit intofastapi:masterfrom
Closed
Support for optional as UnionType (Python >= 3.10)#739mkomet wants to merge 1 commit intofastapi:masterfrom
mkomet wants to merge 1 commit intofastapi:masterfrom
Conversation
7bba6a7 to
92d1179
Compare
Signed-off-by: Meir Komet <mskomet1@gmail.com>
92d1179 to
311dfaa
Compare
|
Also closes Another PR that also address this issue |
| is_tuple = False | ||
| parameter_type: Any = None | ||
| is_flag = None | ||
| is_union_type = lenient_issubclass(type(main_type), UnionType) |
There was a problem hiding this comment.
Hi, I'm new to this kind of stuff, could you please clarify this for me please? From the variable name, it is a type already, why do we need to convert it to type() here? Is it just your preference or there are some edge cases being handled implicitly here?
svlandeg
reviewed
May 21, 2024
Member
svlandeg
left a comment
There was a problem hiding this comment.
Hi, thanks for this PR!
There's a few other PRs that address the same issue, of which I think #548 would be the prime candidate to merge. That PR uses existing functionality such as utils.needs_py310 and ._typing.is_union. If we merge #548, I think we can go ahead and close this one.
I'll leave the final decision with Tiangolo though.
7 tasks
This was
linked to
issues
May 21, 2024
Closed
Member
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.
This resolves the issue #533