docs(storage): add samples for file archive generation and cors config#2
Draft
HemangChothani wants to merge 8 commits intomasterfrom
Draft
docs(storage): add samples for file archive generation and cors config#2HemangChothani wants to merge 8 commits intomasterfrom
HemangChothani wants to merge 8 commits intomasterfrom
Conversation
mf2199
requested changes
Apr 27, 2020
Collaborator
mf2199
left a comment
There was a problem hiding this comment.
I'd watch for excessive line lengths and make capitalization consistent.
Comment on lines
280
to
284
| storage_delete_file_archived_generation.delete_file_archived_generation(test_blob.bucket.name, test_blob.name, | ||
| test_blob.generation) | ||
| out, _ = capsys.readouterr() | ||
| assert "blob " + test_blob.name + " was deleted" in out | ||
| assert test_blob.bucket.get_blob(test_blob.name, generation=test_blob.generation) is None |
Collaborator
There was a problem hiding this comment.
Suggested format:
storage_delete_file_archived_generation.delete_file_archived_generation(
test_blob.bucket.name,
test_blob.name,
test_blob.generation
)
out, _ = capsys.readouterr()
assert "blob " + test_blob.name + " was deleted" in out
blob = test_blob.bucket.get_blob(
test_blob.name,
generation=test_blob.generation
)
assert blob is None
|
|
||
|
|
||
| def test_change_file_storage_class(test_blob, capsys): | ||
| blob = storage_change_file_storage_class.change_file_storage_class(test_blob.bucket.name, test_blob.name) |
Collaborator
There was a problem hiding this comment.
Another one:
blob = storage_change_file_storage_class.change_file_storage_class(
test_blob.bucket.name,
test_blob.name
)
etc.
| ) | ||
|
|
||
| print( | ||
| "Generation {} of the Blob {} in bucket {} copied to blob {} in bucket {}.".format( |
Collaborator
There was a problem hiding this comment.
Either capitalize all Blob or leave lowercase, but be consistent.
|
|
||
| bucket = storage_client.get_bucket(bucket_name) | ||
| bucket.delete_blob(blob_name, generation=generation) | ||
| print("Generation {} of blob {} was deleted from ".format(generation, blob_name, bucket_name)) |
Collaborator
There was a problem hiding this comment.
Missing last {} in the format syntax.
| blobs = storage_client.list_blobs(bucket_name) | ||
|
|
||
| for blob in blobs: | ||
| print(blob.name + "," + str(blob.generation)) |
Collaborator
There was a problem hiding this comment.
I'd keep using format for consistency.
…n-docs-samples into storage_sample_docs_2
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.
Added Samples For
Change default storage class
Change file storage class
CORS configuration
List file archived generation
Delete file archived generation
Copy file archived generation