Skip to content

Commit 5e2300f

Browse files
committed
Renaming all remaining connection.py modules as _http.py.
1 parent 0a311f7 commit 5e2300f

File tree

39 files changed

+84
-130
lines changed

39 files changed

+84
-130
lines changed

dns/google/cloud/dns/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
from google.cloud.dns.zone import Changes
2929
from google.cloud.dns.client import Client
30-
from google.cloud.dns.connection import Connection
3130
from google.cloud.dns.zone import ManagedZone
3231
from google.cloud.dns.resource_record_set import ResourceRecordSet
3332

File renamed without changes.

dns/google/cloud/dns/client.py

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

1717

1818
from google.cloud.client import ClientWithProject
19-
from google.cloud.dns.connection import Connection
19+
20+
from google.cloud.dns._http import Connection
2021
from google.cloud.dns.zone import ManagedZone
2122
from google.cloud.iterator import HTTPIterator
2223

dns/unit_tests/test_connection.py renamed to dns/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.dns.connection import Connection
22+
from google.cloud.dns._http import Connection
2323

2424
return Connection
2525

dns/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _make_one(self, *args, **kw):
3838
return self._get_target_class()(*args, **kw)
3939

4040
def test_ctor(self):
41-
from google.cloud.dns.connection import Connection
41+
from google.cloud.dns._http import Connection
4242

4343
creds = _make_credentials()
4444
http = object()

language/google/cloud/language/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
import warnings
1919

2020
from google.cloud import client as client_module
21-
from google.cloud.language.connection import Connection
21+
22+
from google.cloud.language._http import Connection
2223
from google.cloud.language.document import Document
2324

2425

language/unit_tests/test_connection.py renamed to language/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.language.connection import Connection
22+
from google.cloud.language._http import Connection
2323

2424
return Connection
2525

language/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def _make_one(self, *args, **kw):
3636
return self._get_target_class()(*args, **kw)
3737

3838
def test_ctor(self):
39-
from google.cloud.language.connection import Connection
39+
from google.cloud.language._http import Connection
4040

4141
creds = make_mock_credentials()
4242
http = object()

language/unit_tests/test_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _get_entities(include_entities):
9797

9898
def make_mock_client(response):
9999
import mock
100-
from google.cloud.language.connection import Connection
100+
from google.cloud.language._http import Connection
101101
from google.cloud.language.client import Client
102102

103103
connection = mock.Mock(spec=Connection)

monitoring/google/cloud/monitoring/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"""Google Stackdriver Monitoring API wrapper."""
1616

1717
from google.cloud.monitoring.client import Client
18-
from google.cloud.monitoring.connection import Connection
1918
from google.cloud.monitoring.group import Group
2019
from google.cloud.monitoring.label import LabelDescriptor
2120
from google.cloud.monitoring.label import LabelValueType
@@ -33,7 +32,6 @@
3332

3433
__all__ = (
3534
'Client',
36-
'Connection',
3735
'Group',
3836
'LabelDescriptor', 'LabelValueType',
3937
'Metric', 'MetricDescriptor', 'MetricKind', 'ValueType',

monitoring/google/cloud/monitoring/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232

3333
from google.cloud._helpers import _datetime_to_rfc3339
3434
from google.cloud.client import ClientWithProject
35-
from google.cloud.monitoring.connection import Connection
35+
36+
from google.cloud.monitoring._http import Connection
3637
from google.cloud.monitoring.group import Group
3738
from google.cloud.monitoring.metric import Metric
3839
from google.cloud.monitoring.metric import MetricDescriptor
@@ -44,6 +45,7 @@
4445
from google.cloud.monitoring.timeseries import Point
4546
from google.cloud.monitoring.timeseries import TimeSeries
4647

48+
4749
_UTCNOW = datetime.datetime.utcnow # To be replaced by tests.
4850

4951

monitoring/unit_tests/test_connection.py renamed to monitoring/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.monitoring.connection import Connection
22+
from google.cloud.monitoring._http import Connection
2323

2424
return Connection
2525

resource_manager/google/cloud/resource_manager/__init__.py

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

1717

1818
from google.cloud.resource_manager.client import Client
19-
from google.cloud.resource_manager.connection import Connection
2019
from google.cloud.resource_manager.project import Project
2120

2221

resource_manager/google/cloud/resource_manager/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
from google.cloud.client import Client as BaseClient
1919
from google.cloud.iterator import HTTPIterator
20-
from google.cloud.resource_manager.connection import Connection
20+
21+
from google.cloud.resource_manager._http import Connection
2122
from google.cloud.resource_manager.project import Project
2223

2324

resource_manager/unit_tests/test_connection.py renamed to resource_manager/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.resource_manager.connection import Connection
22+
from google.cloud.resource_manager._http import Connection
2323

2424
return Connection
2525

resource_manager/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _make_one(self, *args, **kw):
3535
return self._get_target_class()(*args, **kw)
3636

3737
def test_constructor(self):
38-
from google.cloud.resource_manager.connection import Connection
38+
from google.cloud.resource_manager._http import Connection
3939

4040
http = object()
4141
credentials = _make_credentials()

runtimeconfig/google/cloud/runtimeconfig/client.py

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

1717

1818
from google.cloud.client import ClientWithProject
19-
from google.cloud.runtimeconfig.connection import Connection
19+
20+
from google.cloud.runtimeconfig._http import Connection
2021
from google.cloud.runtimeconfig.config import Config
2122

2223

runtimeconfig/unit_tests/test_connection.py renamed to runtimeconfig/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.runtimeconfig.connection import Connection
22+
from google.cloud.runtimeconfig._http import Connection
2323

2424
return Connection
2525

speech/google/cloud/speech/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616

1717
from google.cloud.speech.alternative import Alternative
1818
from google.cloud.speech.client import Client
19-
from google.cloud.speech.connection import Connection
2019
from google.cloud.speech.encoding import Encoding
2120
from google.cloud.speech.operation import Operation

speech/google/cloud/speech/_http.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,29 @@
1818

1919
from google.cloud._helpers import _bytes_to_unicode
2020
from google.cloud._helpers import _to_bytes
21+
from google.cloud import _http
2122

2223
from google.cloud.speech.result import Result
2324
from google.cloud.speech.operation import Operation
2425

2526

27+
class Connection(_http.JSONConnection):
28+
"""A connection to Google Cloud Speech JSON REST API.
29+
30+
:type client: :class:`~google.cloud.speech.client.Client`
31+
:param client: The client that owns the current connection.
32+
"""
33+
34+
API_BASE_URL = 'https://speech.googleapis.com'
35+
"""The base of the API call URL."""
36+
37+
API_VERSION = 'v1beta1'
38+
"""The version of the API, used in building the API call's URL."""
39+
40+
API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}'
41+
"""A template for the URL of a particular API call."""
42+
43+
2644
class HTTPSpeechAPI(object):
2745
"""Speech API for interacting with the HTTP version of the API.
2846

speech/google/cloud/speech/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
from google.cloud.environment_vars import DISABLE_GRPC
2121

2222
from google.cloud.speech._gax import GAPICSpeechAPI
23+
from google.cloud.speech._http import Connection
2324
from google.cloud.speech._http import HTTPSpeechAPI
24-
from google.cloud.speech.connection import Connection
2525
from google.cloud.speech.sample import Sample
2626

2727

speech/google/cloud/speech/connection.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

speech/unit_tests/test_connection.py renamed to speech/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.speech.connection import Connection
22+
from google.cloud.speech._http import Connection
2323

2424
return Connection
2525

speech/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _make_one(self, *args, **kw):
8585
return self._get_target_class()(*args, **kw)
8686

8787
def test_ctor(self):
88-
from google.cloud.speech.connection import Connection
88+
from google.cloud.speech._http import Connection
8989

9090
creds = _make_credentials()
9191
http = object()

translate/google/cloud/translate/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@
1717
from google.cloud.translate.client import BASE
1818
from google.cloud.translate.client import Client
1919
from google.cloud.translate.client import NMT
20-
from google.cloud.translate.connection import Connection

translate/google/cloud/translate/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
from google.cloud._helpers import _to_bytes
2121
from google.cloud.client import Client as BaseClient
22-
from google.cloud.translate.connection import Connection
22+
23+
from google.cloud.translate._http import Connection
2324

2425

2526
ENGLISH_ISO_639 = 'en'

translate/unit_tests/test_connection.py renamed to translate/unit_tests/test__http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):
1919

2020
@staticmethod
2121
def _get_target_class():
22-
from google.cloud.translate.connection import Connection
22+
from google.cloud.translate._http import Connection
2323

2424
return Connection
2525

translate/unit_tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _make_one(self, *args, **kw):
2727
return self._get_target_class()(*args, **kw)
2828

2929
def test_constructor(self):
30-
from google.cloud.translate.connection import Connection
30+
from google.cloud.translate._http import Connection
3131
from google.cloud.translate.client import ENGLISH_ISO_639
3232

3333
http = object()
@@ -38,7 +38,7 @@ def test_constructor(self):
3838
self.assertEqual(client.target_language, ENGLISH_ISO_639)
3939

4040
def test_constructor_non_default(self):
41-
from google.cloud.translate.connection import Connection
41+
from google.cloud.translate._http import Connection
4242

4343
http = object()
4444
target = 'es'

vision/google/cloud/vision/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
# limitations under the License.
1414

1515
"""Google Cloud Vision API package."""
16+
1617
from google.cloud.vision.client import Client

vision/google/cloud/vision/_http.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,29 @@
1414

1515
"""HTTP Client for interacting with the Google Cloud Vision API."""
1616

17+
from google.cloud import _http
18+
1719
from google.cloud.vision.annotations import Annotations
1820
from google.cloud.vision.feature import Feature
1921

2022

23+
class Connection(_http.JSONConnection):
24+
"""A connection to Google Cloud Vision via the JSON REST API.
25+
26+
:type client: :class:`~google.cloud.vision.client.Client`
27+
:param client: The client that owns the current connection.
28+
"""
29+
30+
API_BASE_URL = 'https://vision.googleapis.com'
31+
"""The base of the API call URL."""
32+
33+
API_VERSION = 'v1'
34+
"""The version of the API, used in building the API call's URL."""
35+
36+
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
37+
"""A template for the URL of a particular API call."""
38+
39+
2140
class _HTTPVisionAPI(object):
2241
"""Vision API for interacting with the JSON/HTTP version of Vision
2342

vision/google/cloud/vision/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
from google.cloud.environment_vars import DISABLE_GRPC
2121

2222
from google.cloud.vision._gax import _GAPICVisionAPI
23+
from google.cloud.vision._http import _HTTPVisionAPI
24+
from google.cloud.vision._http import Connection
2325
from google.cloud.vision.batch import Batch
24-
from google.cloud.vision.connection import Connection
2526
from google.cloud.vision.image import Image
26-
from google.cloud.vision._http import _HTTPVisionAPI
2727

2828

2929
_USE_GAX = not os.getenv(DISABLE_GRPC, False)

vision/google/cloud/vision/connection.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy