-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add return type to Docker Container.logs #11888
Merged
srittau
merged 5 commits into
python:main
from
adamtheturtle:types-docker-container-logs
May 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ef9f962
Add return type to Docker Container.logs
adamtheturtle 96dbb34
Use 'CancellableStream' as a return type for docker logs call
adamtheturtle f4a54f6
Use @overload on Docker logs method to show different return types
adamtheturtle 5207eb6
Merge remote-tracking branch 'origin/master' into types-docker-contai…
adamtheturtle 8ccc147
Address review comments to handle overload correctly
adamtheturtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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.
It seems to me that it would make sense to use an overload based on
stream
anddemux
:CancellableStream
ifstream
isTrue
.Generator[tuple[bytes | None, bytes | None], None, None]
ifdemux
isTrue
.Generator[bytes, None, None]
otherwise.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.
Thank you. I'll have a go at creating an overload - though this is something I have not done before.
I believe
demux
is not related to this function.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.
@srittau - I have made an attempt to do this here (but not yet in the other file). I found it challenging to know what to do wrt e.g. an argument with a default followed by an argument without a default. I'd appreciate some tips / specific guidance on this change, and then I can apply it to the other file and hopefully to other changes I make to this repository.
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.
Arguments with defaults following arguments with defaults are a bit cumbersome, unfortunately. You need two overloads for that, one where all previous parameters are required, and one using the star import.
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.
Thank you!
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.
Also, I just noticed:
tail
should be annotated asLiteral["all"] | int
, but that may be outside the scope of this PR.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've submitted that change in #11906 and I will block this PR on that one to avoid conflicts.
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.
@srittau I'm working on the assumption that where you put e.g.
stream: True,
, that should bestream: Literal[True],