Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e42c61e

Browse filesBrowse files
committed
Removing pylint statements in datastore.entity.
Rolls back changes put in googleapis#189 that are no longer necessary.
1 parent 218447d commit e42c61e
Copy full SHA for e42c61e

File tree

Expand file treeCollapse file tree

1 file changed

+5
-18
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-18
lines changed

‎gcloud/datastore/entity.py

Copy file name to clipboardExpand all lines: gcloud/datastore/entity.py
+5-18Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from gcloud.datastore.key import Key
2020

2121

22-
class Entity(dict): # pylint: disable=too-many-public-methods
22+
class Entity(dict):
2323
""":type dataset: :class:`gcloud.datastore.dataset.Dataset`
2424
:param dataset: The dataset in which this entity belongs.
2525
@@ -91,7 +91,9 @@ def key(self, key=None):
9191
:type key: :class:`glcouddatastore.key.Key`
9292
:param key: The key you want to set on the entity.
9393
94-
:returns: Either the current key or the :class:`Entity`.
94+
:rtype: :class:`gcloud.datastore.key.Key` or :class:`Entity`.
95+
:returns: Either the current key (on get) or the current
96+
object (on set).
9597
9698
>>> entity.key(my_other_key) # This returns the original entity.
9799
<Entity[{'kind': 'OtherKeyKind', 'id': 1234}] {'property': 'value'}>
@@ -137,7 +139,7 @@ def from_key(cls, key):
137139
return cls().key(key)
138140

139141
@classmethod
140-
def from_protobuf(cls, pb, dataset=None): # pylint: disable=invalid-name
142+
def from_protobuf(cls, pb, dataset=None):
141143
"""Factory method for creating an entity based on a protobuf.
142144
143145
The protobuf should be one returned from the Cloud Datastore
@@ -176,9 +178,7 @@ def reload(self):
176178
"""
177179

178180
# Note that you must have a valid key, otherwise this makes no sense.
179-
# pylint: disable=maybe-no-member
180181
entity = self.dataset().get_entity(self.key().to_protobuf())
181-
# pylint: enable=maybe-no-member
182182

183183
if entity:
184184
self.update(entity)
@@ -190,26 +190,20 @@ def save(self):
190190
:rtype: :class:`gcloud.datastore.entity.Entity`
191191
:returns: The entity with a possibly updated Key.
192192
"""
193-
# pylint: disable=maybe-no-member
194193
key_pb = self.dataset().connection().save_entity(
195194
dataset_id=self.dataset().id(),
196195
key_pb=self.key().to_protobuf(), properties=dict(self))
197-
# pylint: enable=maybe-no-member
198196

199197
# If we are in a transaction and the current entity needs an
200198
# automatically assigned ID, tell the transaction where to put that.
201199
transaction = self.dataset().connection().transaction()
202-
# pylint: disable=maybe-no-member
203200
if transaction and self.key().is_partial():
204201
transaction.add_auto_id_entity(self)
205-
# pylint: enable=maybe-no-member
206202

207203
if isinstance(key_pb, datastore_pb.Key):
208204
updated_key = Key.from_protobuf(key_pb)
209205
# Update the path (which may have been altered).
210-
# pylint: disable=maybe-no-member
211206
key = self.key().path(updated_key.path())
212-
# pylint: enable=maybe-no-member
213207
self.key(key)
214208

215209
return self
@@ -222,20 +216,13 @@ def delete(self):
222216
set on the entity. Whatever is stored remotely using the key on the
223217
entity will be deleted.
224218
"""
225-
# NOTE: pylint thinks key() is an Entity, hence key().to_protobuf()
226-
# is not defined. This is because one branch of the return
227-
# in the key() definition returns self.
228-
# pylint: disable=maybe-no-member
229219
self.dataset().connection().delete_entity(
230220
dataset_id=self.dataset().id(), key_pb=self.key().to_protobuf())
231-
# pylint: enable=maybe-no-member
232221

233222
def __repr__(self):
234223
# An entity should have a key all the time (even if it's partial).
235224
if self.key():
236-
# pylint: disable=maybe-no-member
237225
return '<Entity%s %s>' % (self.key().path(),
238226
super(Entity, self).__repr__())
239-
# pylint: enable=maybe-no-member
240227
else:
241228
return '<Entity %s>' % (super(Entity, self).__repr__())

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.