Skip to content

Commit eb783ac

Browse files
authored
Datastore: Entity doc consistency (#4641)
1 parent b066746 commit eb783ac

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

  • packages/google-cloud-datastore/google/cloud/datastore

packages/google-cloud-datastore/google/cloud/datastore/entity.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,28 +101,28 @@ class Entity(dict):
101101
102102
.. testsetup:: entity-dict
103103
104-
from google.cloud import datastore
104+
from google.cloud import datastore
105105
106-
entity = datastore.Entity()
107-
entity['age'] = 20
108-
entity['name'] = 'JJ'
106+
entity = datastore.Entity()
107+
entity['age'] = 20
108+
entity['name'] = 'JJ'
109109
110110
.. doctest:: entity-dict
111111
112-
>>> sorted(entity.keys())
113-
['age', 'name']
114-
>>> sorted(entity.items())
115-
[('age', 20), ('name', 'JJ')]
112+
>>> sorted(entity.keys())
113+
['age', 'name']
114+
>>> sorted(entity.items())
115+
[('age', 20), ('name', 'JJ')]
116116
117117
.. note::
118118
119-
When saving an entity to the backend, values which are "text"
120-
(``unicode`` in Python2, ``str`` in Python3) will be saved using
121-
the 'text_value' field, after being encoded to UTF-8. When
122-
retrieved from the back-end, such values will be decoded to "text"
123-
again. Values which are "bytes" (``str`` in Python2, ``bytes`` in
124-
Python3), will be saved using the 'blob_value' field, without
125-
any decoding / encoding step.
119+
When saving an entity to the backend, values which are "text"
120+
(``unicode`` in Python2, ``str`` in Python3) will be saved using
121+
the 'text_value' field, after being encoded to UTF-8. When
122+
retrieved from the back-end, such values will be decoded to "text"
123+
again. Values which are "bytes" (``str`` in Python2, ``bytes`` in
124+
Python3), will be saved using the 'blob_value' field, without
125+
any decoding / encoding step.
126126
127127
:type key: :class:`google.cloud.datastore.key.Key`
128128
:param key: Optional key to be set on entity.
@@ -175,10 +175,11 @@ def kind(self):
175175
"""Get the kind of the current entity.
176176
177177
.. note::
178-
This relies entirely on the :class:`google.cloud.datastore.key.Key`
179-
set on the entity. That means that we're not storing the kind
180-
of the entity at all, just the properties and a pointer to a
181-
Key which knows its Kind.
178+
179+
This relies entirely on the :class:`google.cloud.datastore.key.Key`
180+
set on the entity. That means that we're not storing the kind
181+
of the entity at all, just the properties and a pointer to a
182+
Key which knows its Kind.
182183
"""
183184
if self.key:
184185
return self.key.kind

0 commit comments

Comments
 (0)