Skip to content

Commit 8b950cf

Browse files
committed
Ditching :class: reference for builtins.
Making best attempt at being consistent (i.e. string, not str, boolean, not bool, etc.). Also adding a block for `id_or_name` in Key.completed_key.
1 parent 48bcddc commit 8b950cf

14 files changed

Lines changed: 54 additions & 51 deletions

File tree

gcloud/credentials.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ def get_for_service_account_p12(client_email, private_key_path, scope=None):
6868
known explicitly and detecting the environment implicitly would be
6969
superfluous.
7070
71-
:type client_email: :class:`str`
71+
:type client_email: string
7272
:param client_email: The e-mail attached to the service account.
7373
74-
:type private_key_path: :class:`str`
74+
:type private_key_path: string
7575
:param private_key_path: The path to a private key file (this file was
7676
given to you when you created the service
7777
account). This file must be in P12 format.
7878
79-
:type scope: :class:`str` or :class:`tuple` of :class:`str`
79+
:type scope: string or tuple of string
8080
:param scope: The scope against which to authenticate. (Different services
8181
require different scopes, check the documentation for which
8282
scope is required for the different levels of access to any

gcloud/datastore/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def set_default_dataset_id(dataset_id=None):
7474
Local environment variable used is:
7575
- GCLOUD_DATASET_ID
7676
77-
:type dataset_id: :class:`str`.
77+
:type dataset_id: string
7878
:param dataset_id: Optional. The dataset ID to use as default.
7979
"""
8080
if dataset_id is None:
@@ -120,10 +120,10 @@ def get_connection():
120120
def _require_dataset_id(dataset_id=None):
121121
"""Infer a dataset ID from the environment, if not passed explicitly.
122122
123-
:type dataset_id: :class:`str`.
123+
:type dataset_id: string
124124
:param dataset_id: Optional.
125125
126-
:rtype: :class:`str`
126+
:rtype: string
127127
:returns: A dataset ID based on the current environment.
128128
:raises: :class:`EnvironmentError` if ``dataset_id`` is ``None``,
129129
and cannot be inferred from the environment.
@@ -173,7 +173,7 @@ def get_entities(keys, missing=None, deferred=None,
173173
:type connection: :class:`gcloud.datastore.connection.Connection`
174174
:param connection: Optional. The connection used to connect to datastore.
175175
176-
:type dataset_id: :class:`str`.
176+
:type dataset_id: string
177177
:param dataset_id: Optional. The ID of the dataset.
178178
179179
:rtype: list of :class:`gcloud.datastore.entity.Entity`
@@ -211,13 +211,13 @@ def allocate_ids(incomplete_key, num_ids, connection=None, dataset_id=None):
211211
:type incomplete_key: A :class:`gcloud.datastore.key.Key`
212212
:param incomplete_key: Partial key to use as base for allocated IDs.
213213
214-
:type num_ids: :class:`int`.
214+
:type num_ids: integer
215215
:param num_ids: The number of IDs to allocate.
216216
217217
:type connection: :class:`gcloud.datastore.connection.Connection`
218218
:param connection: Optional. The connection used to connect to datastore.
219219
220-
:type dataset_id: :class:`str`.
220+
:type dataset_id: string
221221
:param dataset_id: Optional. The ID of the dataset.
222222
223223
:rtype: list of :class:`gcloud.datastore.key.Key`

gcloud/datastore/connection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def lookup(self, dataset_id, key_pbs,
198198
by the backend as "deferred" will be copied into it.
199199
Use only as a keyword param.
200200
201-
:type eventual: bool
201+
:type eventual: boolean
202202
:param eventual: If False (the default), request ``STRONG`` read
203203
consistency. If True, request ``EVENTUAL`` read
204204
consistency. If the connection has a current
@@ -294,7 +294,7 @@ def run_query(self, dataset_id, query_pb, namespace=None, eventual=False):
294294
:type namespace: string
295295
:param namespace: The namespace over which to run the query.
296296
297-
:type eventual: bool
297+
:type eventual: boolean
298298
:param eventual: If False (the default), request ``STRONG`` read
299299
consistency. If True, request ``EVENTUAL`` read
300300
consistency. If the connection has a current
@@ -324,7 +324,7 @@ def begin_transaction(self, dataset_id, serializable=False):
324324
:type dataset_id: string
325325
:param dataset_id: The ID dataset to which the transaction applies.
326326
327-
:type serializable: :class:`bool`
327+
:type serializable: boolean
328328
:param serializable: Boolean indicating if the isolation level of the
329329
transaction should be SERIALIZABLE (True) or
330330
SNAPSHOT (False).
@@ -438,10 +438,10 @@ def save_entity(self, dataset_id, key_pb, properties,
438438
:type properties: dict
439439
:param properties: The properties to store on the entity.
440440
441-
:type exclude_from_indexes: sequence of str
441+
:type exclude_from_indexes: sequence of string
442442
:param exclude_from_indexes: Names of properties *not* to be indexed.
443443
444-
:rtype: :class:`tuple`
444+
:rtype: tuple
445445
:returns: The pair (``assigned``, ``new_id``) where ``assigned`` is a
446446
boolean indicating if a new ID has been assigned and
447447
``new_id`` is either ``None`` or an integer that has been
@@ -508,7 +508,7 @@ def delete_entities(self, dataset_id, key_pbs):
508508
:type key_pbs: list of :class:`gcloud.datastore.datastore_v1_pb2.Key`
509509
:param key_pbs: The keys to delete from the datastore.
510510
511-
:rtype: :class:`bool`
511+
:rtype: boolean
512512
:returns: ``True``
513513
"""
514514
mutation = self.mutation()

gcloud/datastore/entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Entity(dict):
7373
:param key: Optional key to be set on entity. Required for :meth:`save()`
7474
or :meth:`reload()`.
7575
76-
:type exclude_from_indexes: :class:`tuple` of :class:`str`
76+
:type exclude_from_indexes: tuple of string
7777
:param exclude_from_indexes: Names of fields whose values are not to be
7878
indexed for this entity.
7979
"""

gcloud/datastore/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def _set_protobuf_value(value_pb, val):
230230
:type value_pb: :class:`gcloud.datastore.datastore_v1_pb2.Value`
231231
:param value_pb: The value protobuf to which the value is being assigned.
232232
233-
:type val: `datetime.datetime`, bool, float, integer, string
233+
:type val: `datetime.datetime`, boolean, float, integer, string,
234234
:class:`gcloud.datastore.key.Key`,
235235
:class:`gcloud.datastore.entity.Entity`,
236236
:param val: The value to be assigned.

gcloud/datastore/key.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ class Key(object):
5050
def __init__(self, *path_args, **kwargs):
5151
"""Constructor / initializer for a key.
5252
53-
:type path_args: :class:`tuple` of :class:`str` and :class:`int`
53+
:type path_args: tuple of string and integer
5454
:param path_args: May represent a partial (odd length) or full (even
5555
length) key path.
5656
57-
:type namespace: :class:`str`
57+
:type namespace: string
5858
:param namespace: A namespace identifier for the key. Can only be
5959
passed as a keyword argument.
6060
61-
:type dataset_id: :class:`str`
61+
:type dataset_id: string
6262
:param dataset_id: The dataset ID associated with the key. Required,
6363
unless the implicit dataset ID has been set. Can
6464
only be passed as a keyword argument.
@@ -80,7 +80,7 @@ def __init__(self, *path_args, **kwargs):
8080
def _parse_path(path_args):
8181
"""Parses positional arguments into key path with kinds and IDs.
8282
83-
:type path_args: :class:`tuple`
83+
:type path_args: tuple
8484
:param path_args: A tuple from positional arguments. Should be
8585
alternating list of kinds (string) and ID/name
8686
parts (int or string).
@@ -168,6 +168,9 @@ def _clone(self):
168168
def completed_key(self, id_or_name):
169169
"""Creates new key from existing partial key by adding final ID/name.
170170
171+
:type id_or_name: string or integer
172+
:param id_or_name: ID or name to be added to the key.
173+
171174
:rtype: :class:`gcloud.datastore.key.Key`
172175
:returns: A new ``Key`` instance with the same data as the current one
173176
and an extra ID or name added.
@@ -255,7 +258,7 @@ def delete(self, connection=None):
255258
def is_partial(self):
256259
"""Boolean indicating if the key has an ID (or name).
257260
258-
:rtype: :class:`bool`
261+
:rtype: boolean
259262
:returns: ``True`` if the last element of the key's path does not have
260263
an ``id`` or a ``name``.
261264
"""
@@ -265,7 +268,7 @@ def is_partial(self):
265268
def namespace(self):
266269
"""Namespace getter.
267270
268-
:rtype: :class:`str`
271+
:rtype: string
269272
:returns: The namespace of the current key.
270273
"""
271274
return self._namespace
@@ -285,7 +288,7 @@ def path(self):
285288
def flat_path(self):
286289
"""Getter for the key path as a tuple.
287290
288-
:rtype: :class:`tuple` of :class:`str` and :class:`int`
291+
:rtype: tuple of string and integer
289292
:returns: The tuple of elements in the path.
290293
"""
291294
return self._flat_path
@@ -294,7 +297,7 @@ def flat_path(self):
294297
def kind(self):
295298
"""Kind getter. Based on the last element of path.
296299
297-
:rtype: :class:`str`
300+
:rtype: string
298301
:returns: The kind of the current key.
299302
"""
300303
return self.path[-1]['kind']
@@ -303,7 +306,7 @@ def kind(self):
303306
def id(self):
304307
"""ID getter. Based on the last element of path.
305308
306-
:rtype: :class:`int`
309+
:rtype: integer
307310
:returns: The (integer) ID of the key.
308311
"""
309312
return self.path[-1].get('id')
@@ -312,7 +315,7 @@ def id(self):
312315
def name(self):
313316
"""Name getter. Based on the last element of path.
314317
315-
:rtype: :class:`str`
318+
:rtype: string
316319
:returns: The (string) name of the key.
317320
"""
318321
return self.path[-1].get('name')
@@ -321,7 +324,7 @@ def name(self):
321324
def id_or_name(self):
322325
"""Getter. Based on the last element of path.
323326
324-
:rtype: :class:`int` (if ``id``) or :class:`str` (if ``name``)
327+
:rtype: integer (if ``id``) or string (if ``name``)
325328
:returns: The last element of the key's path if it is either an ``id``
326329
or a ``name``.
327330
"""
@@ -331,7 +334,7 @@ def id_or_name(self):
331334
def dataset_id(self):
332335
"""Dataset ID getter.
333336
334-
:rtype: :class:`str`
337+
:rtype: string
335338
:returns: The key's dataset ID.
336339
"""
337340
return self._dataset_id

gcloud/datastore/query.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,31 @@ class Query(object):
2828
This class serves as an abstraction for creating a query over data
2929
stored in the Cloud Datastore.
3030
31-
:type kind: string.
31+
:type kind: string
3232
:param kind: The kind to query.
3333
34-
:type dataset_id: str
34+
:type dataset_id: string
3535
:param dataset_id: The ID of the dataset to query. If not passed,
3636
uses the implicit default.
3737
38-
:type namespace: string or None.
38+
:type namespace: string or None
3939
:param namespace: The namespace to which to restrict results.
4040
41-
:type ancestor: :class:`gcloud.datastore.key.Key` or None.
41+
:type ancestor: :class:`gcloud.datastore.key.Key` or None
4242
:param ancestor: key of the ancestor to which this query's results are
4343
restricted.
4444
45-
:type filters: sequence of (property_name, operator, value) tuples.
45+
:type filters: sequence of (property_name, operator, value) tuples
4646
:param filters: property filters applied by this query.
4747
48-
:type projection: sequence of string.
48+
:type projection: sequence of string
4949
:param projection: fields returned as part of query results.
5050
51-
:type order: sequence of string.
51+
:type order: sequence of string
5252
:param order: field names used to order query results. Prepend '-'
5353
to a field name to sort it in descending order.
5454
55-
:type group_by: sequence_of_string.
55+
:type group_by: sequence of string
5656
:param group_by: field names used to group query results.
5757
5858
:raises: ValueError if ``dataset_id`` is not passed and no implicit

gcloud/datastore/transaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class Transaction(object):
112112
Technically, it looks like the Protobuf API supports this type of
113113
pattern, however it makes the code particularly messy.
114114
115-
:type dataset_id: :class:`str`.
115+
:type dataset_id: string
116116
:param dataset_id: The ID of the dataset.
117117
118118
:type connection: :class:`gcloud.datastore.connection.Connection`
@@ -138,7 +138,7 @@ def __init__(self, dataset_id=None, connection=None):
138138
def dataset_id(self):
139139
"""Getter for dataset ID in which the transaction will run.
140140
141-
:rtype: :class:`str`
141+
:rtype: string
142142
:returns: The dataset ID in which the transaction will run.
143143
"""
144144
return self._dataset_id

gcloud/storage/acl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def has_entity(self, entity):
242242
:type entity: :class:`_ACLEntity`
243243
:param entity: The entity to check for existence in this ACL.
244244
245-
:rtype: bool
245+
:rtype: boolean
246246
:returns: True of the entity exists in the ACL.
247247
"""
248248
self._ensure_loaded()

gcloud/storage/bucket.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def delete(self, force=False):
256256
parameter set to true. This will iterate through the bucket's
257257
keys and delete the related objects, before deleting the bucket.
258258
259-
:type force: bool
259+
:type force: boolean
260260
:param full: If True, empties the bucket's objects then deletes it.
261261
262262
:raises: :class:`gcloud.storage.exceptions.NotFound` if the
@@ -636,7 +636,7 @@ def versioning_enabled(self, value):
636636
See: https://cloud.google.com/storage/docs/object-versioning for
637637
details.
638638
639-
:type value: convertible to bool
639+
:type value: convertible to boolean
640640
:param value: should versioning be anabled for the bucket?
641641
"""
642642
self._patch_properties({'versioning': {'enabled': bool(value)}})
@@ -694,11 +694,11 @@ def disable_website(self):
694694
def make_public(self, recursive=False, future=False):
695695
"""Make a bucket public.
696696
697-
:type recursive: bool
697+
:type recursive: boolean
698698
:param recursive: If True, this will make all keys inside the bucket
699699
public as well.
700700
701-
:type future: bool
701+
:type future: boolean
702702
:param future: If True, this will make all objects created in the
703703
future public as well.
704704
"""

0 commit comments

Comments
 (0)