Skip to content

Commit 0372d90

Browse files
committed
Making datastore.datastore_v1_pb2 a private module.
1 parent 8a42ef5 commit 0372d90

17 files changed

Lines changed: 98 additions & 102 deletions

gcloud/datastore/batch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Local(object):
2121

2222
from gcloud.datastore import _implicit_environ
2323
from gcloud.datastore import helpers
24-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
24+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
2525

2626

2727
class _Batches(Local):
@@ -159,7 +159,7 @@ def mutation(self):
159159
This getter returns the Mutation protobuf that
160160
has been built-up so far.
161161
162-
:rtype: :class:`gcloud.datastore.datastore_v1_pb2.Mutation`
162+
:rtype: :class:`gcloud.datastore._datastore_v1_pb2.Mutation`
163163
:returns: The Mutation protobuf to be sent in the commit request.
164164
"""
165165
return self._mutation
@@ -281,7 +281,7 @@ def _assign_entity_to_mutation(mutation_pb, entity, auto_id_entities):
281281
282282
Helper method for ``Batch.put``.
283283
284-
:type mutation_pb: :class:`gcloud.datastore.datastore_v1_pb2.Mutation`
284+
:type mutation_pb: :class:`gcloud.datastore._datastore_v1_pb2.Mutation`
285285
:param mutation_pb; the Mutation protobuf for the batch / transaction.
286286
287287
:type entity: :class:`gcloud.datastore.entity.Entity`

gcloud/datastore/connection.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import six
1818

1919
from gcloud import connection
20-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
20+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
2121
from gcloud.datastore import helpers
2222

2323

@@ -148,7 +148,7 @@ def transaction(self, transaction=connection.Connection._EMPTY):
148148
def mutation(self):
149149
"""Getter for mutation usable with current connection.
150150
151-
:rtype: :class:`gcloud.datastore.datastore_v1_pb2.Mutation`.
151+
:rtype: :class:`gcloud.datastore._datastore_v1_pb2.Mutation`.
152152
:returns: The mutation instance associated with the current transaction
153153
(if one exists) or or a new mutation instance.
154154
"""
@@ -164,8 +164,8 @@ def lookup(self, dataset_id, key_pbs,
164164
Maps the ``DatastoreService.Lookup`` protobuf RPC.
165165
166166
This method deals only with protobufs
167-
(:class:`gcloud.datastore.datastore_v1_pb2.Key` and
168-
:class:`gcloud.datastore.datastore_v1_pb2.Entity`) and is used
167+
(:class:`gcloud.datastore._datastore_v1_pb2.Key` and
168+
:class:`gcloud.datastore._datastore_v1_pb2.Entity`) and is used
169169
under the hood in :func:`gcloud.datastore.get`:
170170
171171
>>> from gcloud import datastore
@@ -182,7 +182,7 @@ def lookup(self, dataset_id, key_pbs,
182182
:type dataset_id: string
183183
:param dataset_id: The ID of the dataset to look up the keys.
184184
185-
:type key_pbs: list of :class:`gcloud.datastore.datastore_v1_pb2.Key`
185+
:type key_pbs: list of :class:`gcloud.datastore._datastore_v1_pb2.Key`
186186
(or a single Key)
187187
:param key_pbs: The key (or keys) to retrieve from the datastore.
188188
@@ -202,7 +202,7 @@ def lookup(self, dataset_id, key_pbs,
202202
consistency. If the connection has a current
203203
transaction, this value *must* be false.
204204
205-
:rtype: list of :class:`gcloud.datastore.datastore_v1_pb2.Entity`
205+
:rtype: list of :class:`gcloud.datastore._datastore_v1_pb2.Entity`
206206
(or a single Entity)
207207
:returns: The entities corresponding to the keys provided.
208208
If a single key was provided and no results matched,
@@ -284,7 +284,7 @@ def run_query(self, dataset_id, query_pb, namespace=None, eventual=False):
284284
:type dataset_id: string
285285
:param dataset_id: The ID of the dataset over which to run the query.
286286
287-
:type query_pb: :class:`gcloud.datastore.datastore_v1_pb2.Query`
287+
:type query_pb: :class:`gcloud.datastore._datastore_v1_pb2.Query`
288288
:param query_pb: The Protobuf representing the query to run.
289289
290290
:type namespace: string
@@ -325,7 +325,7 @@ def begin_transaction(self, dataset_id, serializable=False):
325325
transaction should be SERIALIZABLE (True) or
326326
SNAPSHOT (False).
327327
328-
:rtype: :class:`.datastore_v1_pb2.BeginTransactionResponse`
328+
:rtype: :class:`._datastore_v1_pb2.BeginTransactionResponse`
329329
:returns': the result protobuf for the begin transaction request.
330330
"""
331331
if self.transaction():
@@ -354,10 +354,10 @@ def commit(self, dataset_id, mutation_pb):
354354
:type dataset_id: string
355355
:param dataset_id: The ID dataset to which the transaction applies.
356356
357-
:type mutation_pb: :class:`gcloud.datastore.datastore_v1_pb2.Mutation`.
357+
:type mutation_pb: :class:`datastore_pb.Mutation`.
358358
:param mutation_pb: The protobuf for the mutations being saved.
359359
360-
:rtype: :class:`gcloud.datastore.datastore_v1_pb2.MutationResult`.
360+
:rtype: :class:`gcloud.datastore._datastore_v1_pb2.MutationResult`.
361361
:returns': the result protobuf for the mutation.
362362
"""
363363
request = datastore_pb.CommitRequest()
@@ -403,10 +403,10 @@ def allocate_ids(self, dataset_id, key_pbs):
403403
:param dataset_id: The ID of the dataset to which the transaction
404404
belongs.
405405
406-
:type key_pbs: list of :class:`gcloud.datastore.datastore_v1_pb2.Key`
406+
:type key_pbs: list of :class:`gcloud.datastore._datastore_v1_pb2.Key`
407407
:param key_pbs: The keys for which the backend should allocate IDs.
408408
409-
:rtype: list of :class:`gcloud.datastore.datastore_v1_pb2.Key`
409+
:rtype: list of :class:`gcloud.datastore._datastore_v1_pb2.Key`
410410
:returns: An equal number of keys, with IDs filled in by the backend.
411411
"""
412412
request = datastore_pb.AllocateIdsRequest()
@@ -432,7 +432,7 @@ def save_entity(self, dataset_id, key_pb, properties,
432432
:type dataset_id: string
433433
:param dataset_id: The ID of the dataset in which to save the entity.
434434
435-
:type key_pb: :class:`gcloud.datastore.datastore_v1_pb2.Key`
435+
:type key_pb: :class:`gcloud.datastore._datastore_v1_pb2.Key`
436436
:param key_pb: The complete or partial key for the entity.
437437
438438
:type properties: dict
@@ -441,7 +441,7 @@ def save_entity(self, dataset_id, key_pb, properties,
441441
:type exclude_from_indexes: sequence of string
442442
:param exclude_from_indexes: Names of properties *not* to be indexed.
443443
444-
:type mutation: :class:`gcloud.datastore.datastore_v1_pb2.Mutation`
444+
:type mutation: :class:`gcloud.datastore._datastore_v1_pb2.Mutation`
445445
or None.
446446
:param mutation: If passed, the mutation protobuf into which the
447447
entity will be saved. If None, use th result
@@ -497,17 +497,17 @@ def delete_entities(self, dataset_id, key_pbs, mutation=None):
497497
"""Delete keys from a dataset in the Cloud Datastore.
498498
499499
This method deals only with
500-
:class:`gcloud.datastore.datastore_v1_pb2.Key` protobufs and not
500+
:class:`gcloud.datastore._datastore_v1_pb2.Key` protobufs and not
501501
with any of the other abstractions. For example, it's used
502502
under the hood in :func:`gcloud.datastore.api.delete`.
503503
504504
:type dataset_id: string
505505
:param dataset_id: The ID of the dataset from which to delete the keys.
506506
507-
:type key_pbs: list of :class:`gcloud.datastore.datastore_v1_pb2.Key`
507+
:type key_pbs: list of :class:`gcloud.datastore._datastore_v1_pb2.Key`
508508
:param key_pbs: The keys to delete from the datastore.
509509
510-
:type mutation: :class:`gcloud.datastore.datastore_v1_pb2.Mutation`
510+
:type mutation: :class:`gcloud.datastore._datastore_v1_pb2.Mutation`
511511
or None.
512512
:param mutation: If passed, the mutation protobuf into which the
513513
deletion will be saved. If None, use th result

gcloud/datastore/helpers.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import pytz
2626
import six
2727

28-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
28+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
2929
from gcloud.datastore.entity import Entity
3030
from gcloud.datastore.key import Key
3131

@@ -38,7 +38,7 @@ def entity_from_protobuf(pb):
3838
The protobuf should be one returned from the Cloud Datastore
3939
Protobuf API.
4040
41-
:type pb: :class:`gcloud.datastore.datastore_v1_pb2.Entity`
41+
:type pb: :class:`gcloud.datastore._datastore_v1_pb2.Entity`
4242
:param pb: The Protobuf representing the entity.
4343
4444
:rtype: :class:`gcloud.datastore.entity.Entity`
@@ -60,7 +60,7 @@ def key_from_protobuf(pb):
6060
The protobuf should be one returned from the Cloud Datastore
6161
Protobuf API.
6262
63-
:type pb: :class:`gcloud.datastore.datastore_v1_pb2.Key`
63+
:type pb: :class:`gcloud.datastore._datastore_v1_pb2.Key`
6464
:param pb: The Protobuf representing the key.
6565
6666
:rtype: :class:`gcloud.datastore.key.Key`
@@ -161,7 +161,7 @@ def _get_value_from_value_pb(value_pb):
161161
Some work is done to coerce the return value into a more useful type
162162
(particularly in the case of a timestamp value, or a key value).
163163
164-
:type value_pb: :class:`gcloud.datastore.datastore_v1_pb2.Value`
164+
:type value_pb: :class:`gcloud.datastore._datastore_v1_pb2.Value`
165165
:param value_pb: The Value Protobuf.
166166
167167
:returns: The value provided by the Protobuf.
@@ -210,7 +210,7 @@ def _get_value_from_property_pb(property_pb):
210210
Some work is done to coerce the return value into a more useful type
211211
(particularly in the case of a timestamp value, or a key value).
212212
213-
:type property_pb: :class:`gcloud.datastore.datastore_v1_pb2.Property`
213+
:type property_pb: :class:`gcloud.datastore._datastore_v1_pb2.Property`
214214
:param property_pb: The Property Protobuf.
215215
216216
:returns: The value provided by the Protobuf.
@@ -224,7 +224,7 @@ def _set_protobuf_property(property_pb, name, value, indexed):
224224
Some value (empty list) cannot be directly assigned; this function handles
225225
them correctly.
226226
227-
:type property_pb: :class:`gcloud.datastore.datastore_v1_pb2.Property`
227+
:type property_pb: :class:`gcloud.datastore._datastore_v1_pb2.Property`
228228
:param property_pb: The value protobuf to which the value is being
229229
assigned.
230230
@@ -265,7 +265,7 @@ def _set_protobuf_value(value_pb, val):
265265
Some value types (entities, keys, lists) cannot be directly
266266
assigned; this function handles them correctly.
267267
268-
:type value_pb: :class:`gcloud.datastore.datastore_v1_pb2.Value`
268+
:type value_pb: :class:`gcloud.datastore._datastore_v1_pb2.Value`
269269
:param value_pb: The value protobuf to which the value is being assigned.
270270
271271
:type val: `datetime.datetime`, boolean, float, integer, string,
@@ -302,10 +302,10 @@ def _set_protobuf_value(value_pb, val):
302302
def _prepare_key_for_request(key_pb):
303303
"""Add protobuf keys to a request object.
304304
305-
:type key_pb: :class:`gcloud.datastore.datastore_v1_pb2.Key`
305+
:type key_pb: :class:`gcloud.datastore._datastore_v1_pb2.Key`
306306
:param key_pb: A key to be added to a request.
307307
308-
:rtype: :class:`gcloud.datastore.datastore_v1_pb2.Key`
308+
:rtype: :class:`gcloud.datastore._datastore_v1_pb2.Key`
309309
:returns: A key which will be added to a request. It will be the
310310
original if nothing needs to be changed.
311311
"""
@@ -332,7 +332,7 @@ def _add_keys_to_request(request_field_pb, key_pbs):
332332
:type request_field_pb: `RepeatedCompositeFieldContainer`
333333
:param request_field_pb: A repeated proto field that contains keys.
334334
335-
:type key_pbs: list of :class:`gcloud.datastore.datastore_v1_pb2.Key`
335+
:type key_pbs: list of :class:`gcloud.datastore._datastore_v1_pb2.Key`
336336
:param key_pbs: The keys to add to a request.
337337
"""
338338
for key_pb in key_pbs:

gcloud/datastore/key.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import six
2020

2121
from gcloud.datastore import _implicit_environ
22-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
22+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
2323

2424

2525
class Key(object):
@@ -197,7 +197,7 @@ def completed_key(self, id_or_name):
197197
def to_protobuf(self):
198198
"""Return a protobuf corresponding to the key.
199199
200-
:rtype: :class:`gcloud.datastore.datastore_v1_pb2.Key`
200+
:rtype: :class:`gcloud.datastore._datastore_v1_pb2.Key`
201201
:returns: The protobuf representing the key.
202202
"""
203203
key = datastore_pb.Key()

gcloud/datastore/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import base64
1818

1919
from gcloud.datastore import _implicit_environ
20-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
20+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
2121
from gcloud.datastore import helpers
2222
from gcloud.datastore.key import Key
2323

@@ -428,7 +428,7 @@ def _pb_from_query(query):
428428
:type query: :class:`Query`
429429
:param query: The source query.
430430
431-
:rtype: :class:`gcloud.datastore.datastore_v1_pb2.Query`
431+
:rtype: :class:`gcloud.datastore._datastore_v1_pb2.Query`
432432
:returns: A protobuf that can be sent to the protobuf API. N.b. that
433433
it does not contain "in-flight" fields for ongoing query
434434
executions (cursors, offset, limit).

gcloud/datastore/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_get_miss(self):
112112
self.assertEqual(results, [])
113113

114114
def test_get_miss_w_missing(self):
115-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
115+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
116116
from gcloud.datastore.key import Key
117117
from gcloud.datastore.test_connection import _Connection
118118

@@ -158,7 +158,7 @@ def test_get_miss_w_deferred(self):
158158

159159
def _make_entity_pb(self, dataset_id, kind, integer_id,
160160
name=None, str_val=None):
161-
from gcloud.datastore import datastore_v1_pb2 as datastore_pb
161+
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
162162

163163
entity_pb = datastore_pb.Entity()
164164
entity_pb.key.partition_id.dataset_id = dataset_id

gcloud/datastore/test_batch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_ctor_missing_required(self):
6666
self.assertRaises(ValueError, self._makeOne, connection=object())
6767

6868
def test_ctor_explicit(self):
69-
from gcloud.datastore.datastore_v1_pb2 import Mutation
69+
from gcloud.datastore._datastore_v1_pb2 import Mutation
7070
_DATASET = 'DATASET'
7171
connection = _Connection()
7272
batch = self._makeOne(dataset_id=_DATASET, connection=connection)
@@ -79,7 +79,7 @@ def test_ctor_explicit(self):
7979
def test_ctor_implicit(self):
8080
from gcloud._testing import _Monkey
8181
from gcloud.datastore import _implicit_environ
82-
from gcloud.datastore.datastore_v1_pb2 import Mutation
82+
from gcloud.datastore._datastore_v1_pb2 import Mutation
8383
DATASET_ID = 'DATASET'
8484
CONNECTION = _Connection()
8585

@@ -374,8 +374,8 @@ def is_partial(self):
374374
return self._id is None
375375

376376
def to_protobuf(self):
377-
from gcloud.datastore import datastore_v1_pb2
378-
key = self._key = datastore_v1_pb2.Key()
377+
from gcloud.datastore import _datastore_v1_pb2
378+
key = self._key = _datastore_v1_pb2.Key()
379379
# Don't assign it, because it will just get ripped out
380380
# key.partition_id.dataset_id = self.dataset_id
381381

0 commit comments

Comments
 (0)