Skip to content

Commit a52010e

Browse files
authored
Merge pull request #2690 from dhermes/make-connection-non-public
Renaming connection module as _http in 5 packages.
2 parents 8b899d1 + d31f65e commit a52010e

File tree

32 files changed

+57
-117
lines changed

32 files changed

+57
-117
lines changed

bigquery/google/cloud/bigquery/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424

2525

2626
from google.cloud.bigquery.client import Client
27-
from google.cloud.bigquery.connection import Connection
2827
from google.cloud.bigquery.dataset import AccessGrant
2928
from google.cloud.bigquery.dataset import Dataset
3029
from google.cloud.bigquery.schema import SchemaField
3130
from google.cloud.bigquery.table import Table
32-
33-
34-
SCOPE = Connection.SCOPE
File renamed without changes.

bigquery/google/cloud/bigquery/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
from google.cloud.client import JSONClient
19-
from google.cloud.bigquery.connection import Connection
19+
from google.cloud.bigquery._http import Connection
2020
from google.cloud.bigquery.dataset import Dataset
2121
from google.cloud.bigquery.job import CopyJob
2222
from google.cloud.bigquery.job import ExtractTableToStorageJob
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class TestConnection(unittest.TestCase):
1919

2020
def _getTargetClass(self):
21-
from google.cloud.bigquery.connection import Connection
21+
from google.cloud.bigquery._http import Connection
2222
return Connection
2323

2424
def _makeOne(self, *args, **kw):

bigquery/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _makeOne(self, *args, **kw):
2525
return self._getTargetClass()(*args, **kw)
2626

2727
def test_ctor(self):
28-
from google.cloud.bigquery.connection import Connection
28+
from google.cloud.bigquery._http import Connection
2929
PROJECT = 'PROJECT'
3030
creds = _Credentials()
3131
http = object()

datastore/google/cloud/datastore/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
2828
The main concepts with this API are:
2929
30-
- :class:`~google.cloud.datastore.connection.Connection`
31-
which represents a connection between your machine and the Cloud Datastore
32-
API.
33-
3430
- :class:`~google.cloud.datastore.client.Client`
3531
which represents a project (string) and namespace (string) bundled with
3632
a connection and has convenience methods for constructing objects with that
@@ -54,12 +50,8 @@
5450

5551

5652
from google.cloud.datastore.batch import Batch
57-
from google.cloud.datastore.connection import Connection
5853
from google.cloud.datastore.client import Client
5954
from google.cloud.datastore.entity import Entity
6055
from google.cloud.datastore.key import Key
6156
from google.cloud.datastore.query import Query
6257
from google.cloud.datastore.transaction import Transaction
63-
64-
65-
SCOPE = Connection.SCOPE

datastore/google/cloud/datastore/connection.py renamed to datastore/google/cloud/datastore/_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class _DatastoreAPIOverHttp(object):
7171
Methods make bare API requests without any helpers for constructing
7272
the requests or parsing the responses.
7373
74-
:type connection: :class:`google.cloud.datastore.connection.Connection`
74+
:type connection: :class:`Connection`
7575
:param connection: A connection object that contains helpful
7676
information for making requests.
7777
"""
@@ -268,7 +268,7 @@ class _DatastoreAPIOverGRPC(object):
268268
Methods make bare API requests without any helpers for constructing
269269
the requests or parsing the responses.
270270
271-
:type connection: :class:`google.cloud.datastore.connection.Connection`
271+
:type connection: :class:`Connection`
272272
:param connection: A connection object that contains helpful
273273
information for making requests.
274274

datastore/google/cloud/datastore/batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def namespace(self):
107107
def connection(self):
108108
"""Getter for connection over which the batch will run.
109109
110-
:rtype: :class:`google.cloud.datastore.connection.Connection`
110+
:rtype: :class:`google.cloud.datastore._http.Connection`
111111
:returns: The connection over which the batch will run.
112112
"""
113113
return self._client.connection

datastore/google/cloud/datastore/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
_determine_default_project as _base_default_project)
2121
from google.cloud.client import _ClientProjectMixin
2222
from google.cloud.client import Client as _BaseClient
23+
from google.cloud.datastore._http import Connection
2324
from google.cloud.datastore import helpers
24-
from google.cloud.datastore.connection import Connection
2525
from google.cloud.datastore.batch import Batch
2626
from google.cloud.datastore.entity import Entity
2727
from google.cloud.datastore.key import Key
@@ -72,7 +72,7 @@ def _extended_lookup(connection, project, key_pbs,
7272
7373
Helper function for :meth:`Client.get_multi`.
7474
75-
:type connection: :class:`google.cloud.datastore.connection.Connection`
75+
:type connection: :class:`google.cloud.datastore._http.Connection`
7676
:param connection: The connection used to connect to datastore.
7777
7878
:type project: str
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
import unittest
1616

17-
from google.cloud.datastore.connection import _HAVE_GRPC
17+
from google.cloud.datastore._http import _HAVE_GRPC
1818

1919

2020
class Test_DatastoreAPIOverHttp(unittest.TestCase):
2121

2222
def _getTargetClass(self):
23-
from google.cloud.datastore.connection import _DatastoreAPIOverHttp
23+
from google.cloud.datastore._http import _DatastoreAPIOverHttp
2424
return _DatastoreAPIOverHttp
2525

2626
def _makeOne(self, *args, **kw):
@@ -110,7 +110,7 @@ def test__request_not_200(self):
110110
class Test__grpc_catch_rendezvous(unittest.TestCase):
111111

112112
def _callFUT(self):
113-
from google.cloud.datastore.connection import _grpc_catch_rendezvous
113+
from google.cloud.datastore._http import _grpc_catch_rendezvous
114114
return _grpc_catch_rendezvous()
115115

116116
@staticmethod
@@ -175,12 +175,12 @@ def test_commit_failure_non_grpc_err(self):
175175
class Test_DatastoreAPIOverGRPC(unittest.TestCase):
176176

177177
def _getTargetClass(self):
178-
from google.cloud.datastore.connection import _DatastoreAPIOverGRPC
178+
from google.cloud.datastore._http import _DatastoreAPIOverGRPC
179179
return _DatastoreAPIOverGRPC
180180

181181
def _makeOne(self, stub, connection=None, secure=True, mock_args=None):
182182
from google.cloud._testing import _Monkey
183-
from google.cloud.datastore import connection as MUT
183+
from google.cloud.datastore import _http as MUT
184184

185185
if connection is None:
186186
connection = _Connection(None)
@@ -202,7 +202,7 @@ def mock_make_stub(*args):
202202
return self._getTargetClass()(connection, secure)
203203

204204
def test_constructor(self):
205-
from google.cloud.datastore import connection as MUT
205+
from google.cloud.datastore import _http as MUT
206206

207207
conn = _Connection(None)
208208
conn.credentials = object()
@@ -222,7 +222,7 @@ def test_constructor(self):
222222
)])
223223

224224
def test_constructor_insecure(self):
225-
from google.cloud.datastore import connection as MUT
225+
from google.cloud.datastore import _http as MUT
226226

227227
conn = _Connection(None)
228228
conn.credentials = object()
@@ -351,7 +351,7 @@ def test_allocate_ids(self):
351351
class TestConnection(unittest.TestCase):
352352

353353
def _getTargetClass(self):
354-
from google.cloud.datastore.connection import Connection
354+
from google.cloud.datastore._http import Connection
355355

356356
return Connection
357357

@@ -370,7 +370,7 @@ def _make_query_pb(self, kind):
370370

371371
def _makeOne(self, credentials=None, http=None, use_grpc=False):
372372
from google.cloud._testing import _Monkey
373-
from google.cloud.datastore import connection as MUT
373+
from google.cloud.datastore import _http as MUT
374374
with _Monkey(MUT, _USE_GRPC=use_grpc):
375375
return self._getTargetClass()(credentials=credentials, http=http)
376376

@@ -408,7 +408,7 @@ def test_ctor_defaults(self):
408408

409409
def test_ctor_without_grpc(self):
410410
from google.cloud._testing import _Monkey
411-
from google.cloud.datastore import connection as MUT
411+
from google.cloud.datastore import _http as MUT
412412

413413
connections = []
414414
return_val = object()
@@ -426,7 +426,7 @@ def mock_api(connection):
426426

427427
def test_ctor_with_grpc(self):
428428
from google.cloud._testing import _Monkey
429-
from google.cloud.datastore import connection as MUT
429+
from google.cloud.datastore import _http as MUT
430430

431431
api_args = []
432432
return_val = object()
@@ -921,7 +921,7 @@ def test_begin_transaction(self):
921921
def test_commit_wo_transaction(self):
922922
from google.cloud._testing import _Monkey
923923
from google.cloud.datastore._generated import datastore_pb2
924-
from google.cloud.datastore import connection as MUT
924+
from google.cloud.datastore import _http as MUT
925925
from google.cloud.datastore.helpers import _new_value_pb
926926

927927
PROJECT = 'PROJECT'
@@ -967,7 +967,7 @@ def mock_parse(response):
967967
def test_commit_w_transaction(self):
968968
from google.cloud._testing import _Monkey
969969
from google.cloud.datastore._generated import datastore_pb2
970-
from google.cloud.datastore import connection as MUT
970+
from google.cloud.datastore import _http as MUT
971971
from google.cloud.datastore.helpers import _new_value_pb
972972

973973
PROJECT = 'PROJECT'
@@ -1091,7 +1091,7 @@ def test_allocate_ids_non_empty(self):
10911091
class Test__parse_commit_response(unittest.TestCase):
10921092

10931093
def _callFUT(self, commit_response_pb):
1094-
from google.cloud.datastore.connection import _parse_commit_response
1094+
from google.cloud.datastore._http import _parse_commit_response
10951095
return _parse_commit_response(commit_response_pb)
10961096

10971097
def test_it(self):

0 commit comments

Comments
 (0)