From 59a7798ce08336e028a92394b334d5e36962fca9 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Tue, 8 Aug 2017 12:37:24 -0700 Subject: [PATCH] Make exclude_from_indexes a set, and public API. (#3756) --- datastore/google/cloud/datastore/entity.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/datastore/google/cloud/datastore/entity.py b/datastore/google/cloud/datastore/entity.py index dc8a60b038bef..e74d5aa640eeb 100644 --- a/datastore/google/cloud/datastore/entity.py +++ b/datastore/google/cloud/datastore/entity.py @@ -129,8 +129,9 @@ class Entity(dict): def __init__(self, key=None, exclude_from_indexes=()): super(Entity, self).__init__() self.key = key - self._exclude_from_indexes = set(_ensure_tuple_or_list( + self.exclude_from_indexes = set(_ensure_tuple_or_list( 'exclude_from_indexes', exclude_from_indexes)) + """Names of fields which are *not* to be indexed for this entity.""" # NOTE: This will be populated when parsing a protobuf in # google.cloud.datastore.helpers.entity_from_protobuf. self._meanings = {} @@ -148,7 +149,7 @@ def __eq__(self, other): return False return (self.key == other.key and - self._exclude_from_indexes == other._exclude_from_indexes and + self.exclude_from_indexes == other.exclude_from_indexes and self._meanings == other._meanings and super(Entity, self).__eq__(other)) @@ -176,15 +177,6 @@ def kind(self): if self.key: return self.key.kind - @property - def exclude_from_indexes(self): - """Names of fields which are *not* to be indexed for this entity. - - :rtype: sequence of field names - :returns: The set of fields excluded from indexes. - """ - return frozenset(self._exclude_from_indexes) - def __repr__(self): if self.key: return '' % (self.key._flat_path,