Skip to content
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

Make exclude_from_indexes a set, and public API. #3756

Merged
merged 1 commit into from
Aug 8, 2017
Merged
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
14 changes: 3 additions & 11 deletions datastore/google/cloud/datastore/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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))

Expand Down Expand Up @@ -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 '<Entity%s %s>' % (self.key._flat_path,
Expand Down