88class Key (object ):
99 """
1010 An immutable representation of a datastore Key.
11+
12+ .. automethod:: __init__
1113 """
1214
1315 def __init__ (self , dataset = None , namespace = None , path = None ):
@@ -52,7 +54,7 @@ def from_protobuf(cls, pb, dataset=None):
5254
5355 :type dataset: :class:`gcloud.datastore.dataset.Dataset`
5456 :param dataset: A dataset instance. If not passed, defaults to an
55- instance whose ID is derived from pb.
57+ instance whose ID is derived from pb.
5658
5759 :rtype: :class:`gcloud.datastore.key.Key`
5860 :returns: a new `Key` instance
@@ -116,17 +118,18 @@ def to_protobuf(self):
116118 def from_path (cls , * args , ** kwargs ):
117119 """Factory method for creating a key based on a path.
118120
119- :type args: :class:`tuple
120- :param args: sequence of even length, where the first of each
121- pair is a string representing the 'kind' of the path element, and the
122- second of the pair is either a string (for the path element's name)
123- or an integer (for its id).
121+ :type args: :class:`tuple`
122+ :param args: sequence of even length, where the first of each pair is a
123+ string representing the 'kind' of the path element, and the
124+ second of the pair is either a string (for the path
125+ element's name) or an integer (for its id).
124126
125127 :type kwargs: :class:`dict`
126- :param kwargs: Other named parameters which can be passed to `__init__()`.
128+ :param kwargs: Other named parameters which can be passed to
129+ :func:`Key.__init__`.
127130
128131 :rtype: :class:`gcloud.datastore.key.Key`
129- :returns: a new `Key` instance
132+ :returns: a new :class: `Key` instance
130133 """
131134 if len (args ) % 2 :
132135 raise ValueError ('Must pass an even number of args.' )
@@ -150,7 +153,7 @@ def is_partial(self):
150153
151154 :rtype: :class:`bool`
152155 :returns: True if the last element of the key's path does not have an 'id'
153- or a 'name'.
156+ or a 'name'.
154157 """
155158 return (self .id_or_name () is None )
156159
@@ -194,11 +197,11 @@ def path(self, path=None):
194197
195198 :type path: sequence of dicts
196199 :param path: Each dict must have keys 'kind' (a string) and optionally
197- 'name' (a string) or 'id' (an integer).
200+ 'name' (a string) or 'id' (an integer).
198201
199202 :rtype: :class:`Key` (for setter); or :class:`str` (for getter)
200203 :returns: a new key, cloned from self., with the given path (setter);
201- or self's path (getter).
204+ or self's path (getter).
202205 """
203206 if path :
204207 clone = self ._clone ()
@@ -263,7 +266,7 @@ def id_or_name(self):
263266
264267 :rtype: :class:`int` (if 'id' is set); or :class:`str` (the 'name')
265268 :returns: True if the last element of the key's path has either an 'id'
266- or a 'name'.
269+ or a 'name'.
267270 """
268271 return self .id () or self .name ()
269272
@@ -272,7 +275,8 @@ def parent(self): # pragma NO COVER
272275
273276 :rtype: :class:`gcloud.datastore.key.Key`
274277 :returns: a new `Key` instance, whose path consists of all but the last
275- element of self's path. If self has only one path element, return None.
278+ element of self's path. If self has only one path element,
279+ return None.
276280 """
277281 if len (self ._path ) <= 1 :
278282 return None
0 commit comments