Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions google/cloud/bigtable/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,12 @@ def delete(self):
def _to_pb(self):
"""Create cluster proto buff message for API calls"""
client = self._instance._client
location = client.instance_admin_client.common_location_path(
client.project, self.location_id
)
if self.location_id:
location = client.instance_admin_client.common_location_path(
client.project, self.location_id
)
else:
location = None
Comment on lines +514 to +519

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This if/else block can be written more concisely by initializing location to None and then conditionally updating it.

Suggested change
if self.location_id:
location = client.instance_admin_client.common_location_path(
client.project, self.location_id
)
else:
location = None
location = None
if self.location_id:
location = client.instance_admin_client.common_location_path(
client.project, self.location_id
)


cluster_pb = instance.Cluster(
location=location,
Expand Down
Loading