Conversation
| policy = bucket.get_iam_policy() | ||
|
|
||
| for role in policy: | ||
| members = policy[role] |
There was a problem hiding this comment.
Why iterate over the keys and then do a dictionary lookup, instead of iterating over key, value using items()?
There was a problem hiding this comment.
Because it's not a dictionary, see https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/core/google/cloud/iam.py#L64
There was a problem hiding this comment.
Oh, ick.
If beginners like me are likely to read this code, maybe adding a comment about that here would prevent confusion. Up to you though, I don't have a lot of context yet.
storage/cloud-client/iam.py
Outdated
| bucket.set_iam_policy(policy) | ||
|
|
||
| print('Removed {} with role {} from {}.'.format( | ||
| role, member, bucket_name)) |
There was a problem hiding this comment.
should the order be 'member, role, bucket_name' instead ?
storage/cloud-client/iam.py
Outdated
| bucket.set_iam_policy(policy) | ||
|
|
||
| print('Added {} with role {} to {}.'.format( | ||
| role, member, bucket_name)) |
There was a problem hiding this comment.
should the order be 'member, role, bucket_name' instead ?
|
Failures unrelated (and reported to client library team). Merging. |
* test: make pyarrow sample less flaky * add comment
No description provided.