-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove 'Bucket.__iter__' and 'Bucket.__contains__'. #877
Remove 'Bucket.__iter__' and 'Bucket.__contains__'. #877
Conversation
Big time test failure here. Do you know why? |
I ran the tests in a different shell, which I closed accidentally before committing. :( I will rebase / fix after merging #876. |
@dhermes rebased. |
super(Bucket, self).__init__(name=name) | ||
self._connection = connection |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
So the reason I asked you to peel this off from #876 was really so we could discuss if this should happen. I have never really liked the methods, but some may like them. So let's discuss? |
To clarify what we are discussiing: first, we are removing: if blob_name in bucket:
do_something() which is a syntactic alias for: blob = Blob(blob_name, bucket)
if blob.exists():
do_something() Note that Second, we are removing: for blob in bucket:
do_something(blob) which is a syntactic alias for: for blob in bucket.list_blobs():
do_something(blob) Here, the |
Both are 'sugar' over other methods, but do not allow passing an explicit connection. In addition, 'Bucket.__iter__' has scaling issues, which cannot be mitigated using the filtering parameters accepted by 'Bucket.list_blobs'.
@jgeewax Are you OK with us removing this? I am on-board with this change. |
I'm down with removing the methods, but we need to update the docs in the same PR, right? (https://googlecloudplatform.github.io/gcloud-python/latest/storage-buckets.html refers to |
+1 |
…nd___contains__ Remove 'Bucket.__iter__' and 'Bucket.__contains__'.
Both are "sugar" over other methods, but do not allow passing an explicit connection.
In addition,
Bucket.__iter__
has scaling issues, which cannot be mitigated using the filtering parameters accepted byBucket.list_blobs
.Moved to a new PR from #876.