From e3ca2e005e8cb019ebd486f54cc08a030d87ea53 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Thu, 16 Feb 2017 16:10:52 -0800 Subject: [PATCH] Renaming all remaining connection.py modules as _http.py. --- .../google/cloud/speech/__init__.py | 1 - .../google/cloud/speech/_http.py | 18 ++++++++++ .../google/cloud/speech/client.py | 2 +- .../google/cloud/speech/connection.py | 34 ------------------- .../{test_connection.py => test__http.py} | 2 +- google-cloud-speech/unit_tests/test_client.py | 2 +- 6 files changed, 21 insertions(+), 38 deletions(-) delete mode 100644 google-cloud-speech/google/cloud/speech/connection.py rename google-cloud-speech/unit_tests/{test_connection.py => test__http.py} (94%) diff --git a/google-cloud-speech/google/cloud/speech/__init__.py b/google-cloud-speech/google/cloud/speech/__init__.py index 2d0ba94b738c..0c4f7542e02f 100644 --- a/google-cloud-speech/google/cloud/speech/__init__.py +++ b/google-cloud-speech/google/cloud/speech/__init__.py @@ -16,6 +16,5 @@ from google.cloud.speech.alternative import Alternative from google.cloud.speech.client import Client -from google.cloud.speech.connection import Connection from google.cloud.speech.encoding import Encoding from google.cloud.speech.operation import Operation diff --git a/google-cloud-speech/google/cloud/speech/_http.py b/google-cloud-speech/google/cloud/speech/_http.py index f8bd209bf2c4..a4755f6f89ff 100644 --- a/google-cloud-speech/google/cloud/speech/_http.py +++ b/google-cloud-speech/google/cloud/speech/_http.py @@ -18,11 +18,29 @@ from google.cloud._helpers import _bytes_to_unicode from google.cloud._helpers import _to_bytes +from google.cloud import _http from google.cloud.speech.result import Result from google.cloud.speech.operation import Operation +class Connection(_http.JSONConnection): + """A connection to Google Cloud Speech JSON REST API. + + :type client: :class:`~google.cloud.speech.client.Client` + :param client: The client that owns the current connection. + """ + + API_BASE_URL = 'https://speech.googleapis.com' + """The base of the API call URL.""" + + API_VERSION = 'v1beta1' + """The version of the API, used in building the API call's URL.""" + + API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}' + """A template for the URL of a particular API call.""" + + class HTTPSpeechAPI(object): """Speech API for interacting with the HTTP version of the API. diff --git a/google-cloud-speech/google/cloud/speech/client.py b/google-cloud-speech/google/cloud/speech/client.py index 2ae34784558b..f534ab63d1b4 100644 --- a/google-cloud-speech/google/cloud/speech/client.py +++ b/google-cloud-speech/google/cloud/speech/client.py @@ -20,8 +20,8 @@ from google.cloud.environment_vars import DISABLE_GRPC from google.cloud.speech._gax import GAPICSpeechAPI +from google.cloud.speech._http import Connection from google.cloud.speech._http import HTTPSpeechAPI -from google.cloud.speech.connection import Connection from google.cloud.speech.sample import Sample diff --git a/google-cloud-speech/google/cloud/speech/connection.py b/google-cloud-speech/google/cloud/speech/connection.py deleted file mode 100644 index 0067cc0aae7d..000000000000 --- a/google-cloud-speech/google/cloud/speech/connection.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2016 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Create / interact with Google Cloud Speech connections.""" - -from google.cloud import _http - - -class Connection(_http.JSONConnection): - """A connection to Google Cloud Speech JSON REST API. - - :type client: :class:`~google.cloud.speech.client.Client` - :param client: The client that owns the current connection. - """ - - API_BASE_URL = 'https://speech.googleapis.com' - """The base of the API call URL.""" - - API_VERSION = 'v1beta1' - """The version of the API, used in building the API call's URL.""" - - API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}' - """A template for the URL of a particular API call.""" diff --git a/google-cloud-speech/unit_tests/test_connection.py b/google-cloud-speech/unit_tests/test__http.py similarity index 94% rename from google-cloud-speech/unit_tests/test_connection.py rename to google-cloud-speech/unit_tests/test__http.py index f7b2d618b831..fec987a07f37 100644 --- a/google-cloud-speech/unit_tests/test_connection.py +++ b/google-cloud-speech/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.speech.connection import Connection + from google.cloud.speech._http import Connection return Connection diff --git a/google-cloud-speech/unit_tests/test_client.py b/google-cloud-speech/unit_tests/test_client.py index b8a87e8b0b55..03c348a8165f 100644 --- a/google-cloud-speech/unit_tests/test_client.py +++ b/google-cloud-speech/unit_tests/test_client.py @@ -85,7 +85,7 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_ctor(self): - from google.cloud.speech.connection import Connection + from google.cloud.speech._http import Connection creds = _make_credentials() http = object()