Chore: refactor blob.upload_from_file#1063
Merged
andrewsg merged 10 commits intogoogleapis:tm-metricsfrom Jul 10, 2023
Merged
Conversation
Contributor
MiaCY
commented
Jun 21, 2023
- Create new method blob._prep_and_do_upload
- Refactor business logic of blob.upload_from_file into blob._prep_and_do_upload
- Refactor blob.upload_from_file and blob.upload_from_filename to call blob._prep_and_do_upload
…rage into transfer_manager_usage_metrics
…nto transfer_manager_usage_metrics
…rage into transfer_manager_usage_metrics
andrewsg
requested changes
Jun 29, 2023
Contributor
andrewsg
left a comment
There was a problem hiding this comment.
Oh, this is a straightforward and minimal approach. I think this is a good idea. Consider reducing the size of the private method's docstring a bit, possibly just by saying "see upload_from_file docstring for more info" if needed. Compare it to the other major private methods we have - is the docstring way too complex compared to those or is it similar? If it's similar or you think it would be confusing to reduce the size, we can just leave it as is.
I'm going to have to make unrelated changes to this area of the code soonish, so on the week of the 10th of July, let's look at merging the upload and download refactors into the main branch so there are no conflicts.
andrewsg
pushed a commit
that referenced
this pull request
Sep 18, 2023
* Refactor client.download_blob_to_file * Chore: clean up code * refactor blob and client unit tests * lint reformat * Rename _prep_and_do_download * Refactor blob.upload_from_file * Lint reformat
cojenco
added a commit
that referenced
this pull request
Oct 19, 2023
* Chore: refactor client.download_blob_to_file (#1052) * Refactor client.download_blob_to_file * Chore: clean up code * refactor blob and client unit tests * lint reformat * Rename _prep_and_do_download * Chore: refactor blob.upload_from_file (#1063) * Refactor client.download_blob_to_file * Chore: clean up code * refactor blob and client unit tests * lint reformat * Rename _prep_and_do_download * Refactor blob.upload_from_file * Lint reformat * feature: add 'command' argument to private upload/download interface (#1082) * Refactor client.download_blob_to_file * Chore: clean up code * refactor blob and client unit tests * lint reformat * Rename _prep_and_do_download * Refactor blob.upload_from_file * Lint reformat * feature: add 'command' argument to private upload/download interface * lint reformat * reduce duplication and edit docstring * feat: add support for custom headers starting with metadata op * add custom headers to downloads in client blob modules * add custom headers to uploads with tests * update mocks and tests * test custom headers support tm mpu uploads * update tm test * update test --------- Co-authored-by: MiaCY <97990237+MiaCY@users.noreply.github.com>
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.