-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
docs: add explain on return #4351
Conversation
@@ -147,7 +147,7 @@ class MyExecutor(Executor): | |||
@requests | |||
async def foo( | |||
self, docs: DocumentArray, parameters: Dict, docs_matrix: List[DocumentArray] | |||
) -> Optional[Union[DocumentArray, Dict]]: | |||
) -> Union[DocumentArray, Dict, None]: |
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.
) -> Union[DocumentArray, Dict, None]: | |
) -> Optional[Union[DocumentArray, Dict]]: |
This is by definition Optional and is much more standard
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.
actually it is the oppsite, if you look typing
, pydantic
or dataclass, they all get translate Optional
into Union[..., None]
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.
Here this usage can better map to what I later said, "there are 3 ways of returning", Union[1,2,3] -> 3 ways
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
Co-authored-by: Johannes Messner <44071807+JohannesMessner@users.noreply.github.com>
📝 Docs are deployed on https://fix-docs-return--jina-docs.netlify.app 🎉 |
Pull Request Title
Description
Please describe what your PR is doing and why. Are there any parts which need extra attention during review? Are there any dependencies from other PRs or projcts? Is this a breaking change?
Is this PR ready or work in progress (WIP)? Ready means it can be reviewed and merged from the author's perspective. If the PR is WIP: Make it a draft PR and state open questions and TODO items.
Closes # (issue)