Skip to content

Commit

Permalink
fix: Call repr for non built-in type objects only
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-baptiste authored and François BAPTISTE committed May 25, 2020
1 parent 73addd0 commit 1028c86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions google/cloud/bigquery/table.py
Expand Up @@ -2128,9 +2128,11 @@ def to_api_repr(self):
return self._properties

def _key(self):
# because we are only "renaming" top level keys shallow copy is sufficient here.
properties = self._properties.copy()
if "type" in properties.keys():
properties["type_"] = properties.pop("type")
# calling repr for non built-in type objects.
properties["type_"] = repr(properties.pop("type"))
if "requirePartitionFilter" in properties.keys():
properties["require_partition_filter"] = properties.pop("requirePartitionFilter")
if "expirationMs" in properties.keys():
Expand All @@ -2149,7 +2151,7 @@ def __hash__(self):
return hash(self._key())

def __repr__(self):
key_vals = ["{}={}".format(key, repr(val)) for key, val in self._key()]
key_vals = ["{}={}".format(key, val) for key, val in self._key()]
return "TimePartitioning({})".format(",".join(key_vals))


Expand Down

0 comments on commit 1028c86

Please sign in to comment.