Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming all remaining connection.py modules as _http.py. #3033

Merged
merged 2 commits into from
Feb 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dns/google/cloud/dns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from google.cloud.dns.zone import Changes
from google.cloud.dns.client import Client
from google.cloud.dns.connection import Connection
from google.cloud.dns.zone import ManagedZone
from google.cloud.dns.resource_record_set import ResourceRecordSet

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion dns/google/cloud/dns/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@


from google.cloud.client import ClientWithProject
from google.cloud.dns.connection import Connection

from google.cloud.dns._http import Connection
from google.cloud.dns.zone import ManagedZone
from google.cloud.iterator import HTTPIterator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.dns.connection import Connection
from google.cloud.dns._http import Connection

return Connection

Expand Down
2 changes: 1 addition & 1 deletion dns/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_ctor(self):
from google.cloud.dns.connection import Connection
from google.cloud.dns._http import Connection

creds = _make_credentials()
http = object()
Expand Down
3 changes: 2 additions & 1 deletion language/google/cloud/language/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import warnings

from google.cloud import client as client_module
from google.cloud.language.connection import Connection

from google.cloud.language._http import Connection
from google.cloud.language.document import Document


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.language.connection import Connection
from google.cloud.language._http import Connection

return Connection

Expand Down
2 changes: 1 addition & 1 deletion language/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_ctor(self):
from google.cloud.language.connection import Connection
from google.cloud.language._http import Connection

creds = make_mock_credentials()
http = object()
Expand Down
2 changes: 1 addition & 1 deletion language/unit_tests/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _get_entities(include_entities):

def make_mock_client(response):
import mock
from google.cloud.language.connection import Connection
from google.cloud.language._http import Connection
from google.cloud.language.client import Client

connection = mock.Mock(spec=Connection)
Expand Down
2 changes: 0 additions & 2 deletions monitoring/google/cloud/monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Google Stackdriver Monitoring API wrapper."""

from google.cloud.monitoring.client import Client
from google.cloud.monitoring.connection import Connection
from google.cloud.monitoring.group import Group
from google.cloud.monitoring.label import LabelDescriptor
from google.cloud.monitoring.label import LabelValueType
Expand All @@ -33,7 +32,6 @@

__all__ = (
'Client',
'Connection',
'Group',
'LabelDescriptor', 'LabelValueType',
'Metric', 'MetricDescriptor', 'MetricKind', 'ValueType',
Expand Down
4 changes: 3 additions & 1 deletion monitoring/google/cloud/monitoring/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

from google.cloud._helpers import _datetime_to_rfc3339
from google.cloud.client import ClientWithProject
from google.cloud.monitoring.connection import Connection

from google.cloud.monitoring._http import Connection
from google.cloud.monitoring.group import Group
from google.cloud.monitoring.metric import Metric
from google.cloud.monitoring.metric import MetricDescriptor
Expand All @@ -44,6 +45,7 @@
from google.cloud.monitoring.timeseries import Point
from google.cloud.monitoring.timeseries import TimeSeries


_UTCNOW = datetime.datetime.utcnow # To be replaced by tests.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.monitoring.connection import Connection
from google.cloud.monitoring._http import Connection

return Connection

Expand Down
1 change: 0 additions & 1 deletion resource_manager/google/cloud/resource_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


from google.cloud.resource_manager.client import Client
from google.cloud.resource_manager.connection import Connection
from google.cloud.resource_manager.project import Project


Expand Down
3 changes: 2 additions & 1 deletion resource_manager/google/cloud/resource_manager/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

from google.cloud.client import Client as BaseClient
from google.cloud.iterator import HTTPIterator
from google.cloud.resource_manager.connection import Connection

from google.cloud.resource_manager._http import Connection
from google.cloud.resource_manager.project import Project


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.resource_manager.connection import Connection
from google.cloud.resource_manager._http import Connection

return Connection

Expand Down
2 changes: 1 addition & 1 deletion resource_manager/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_constructor(self):
from google.cloud.resource_manager.connection import Connection
from google.cloud.resource_manager._http import Connection

http = object()
credentials = _make_credentials()
Expand Down
3 changes: 2 additions & 1 deletion runtimeconfig/google/cloud/runtimeconfig/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@


from google.cloud.client import ClientWithProject
from google.cloud.runtimeconfig.connection import Connection

from google.cloud.runtimeconfig._http import Connection
from google.cloud.runtimeconfig.config import Config


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.runtimeconfig.connection import Connection
from google.cloud.runtimeconfig._http import Connection

return Connection

Expand Down
1 change: 0 additions & 1 deletion speech/google/cloud/speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions speech/google/cloud/speech/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion speech/google/cloud/speech/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
34 changes: 0 additions & 34 deletions speech/google/cloud/speech/connection.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion speech/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion translate/google/cloud/translate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@
from google.cloud.translate.client import BASE
from google.cloud.translate.client import Client
from google.cloud.translate.client import NMT
from google.cloud.translate.connection import Connection
3 changes: 2 additions & 1 deletion translate/google/cloud/translate/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

from google.cloud._helpers import _to_bytes
from google.cloud.client import Client as BaseClient
from google.cloud.translate.connection import Connection

from google.cloud.translate._http import Connection


ENGLISH_ISO_639 = 'en'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.translate.connection import Connection
from google.cloud.translate._http import Connection

return Connection

Expand Down
4 changes: 2 additions & 2 deletions translate/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_constructor(self):
from google.cloud.translate.connection import Connection
from google.cloud.translate._http import Connection
from google.cloud.translate.client import ENGLISH_ISO_639

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

def test_constructor_non_default(self):
from google.cloud.translate.connection import Connection
from google.cloud.translate._http import Connection

http = object()
target = 'es'
Expand Down
1 change: 1 addition & 0 deletions vision/google/cloud/vision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
# limitations under the License.

"""Google Cloud Vision API package."""

from google.cloud.vision.client import Client
19 changes: 19 additions & 0 deletions vision/google/cloud/vision/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,29 @@

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

from google.cloud import _http

from google.cloud.vision.annotations import Annotations
from google.cloud.vision.feature import Feature


class Connection(_http.JSONConnection):
"""A connection to Google Cloud Vision via the JSON REST API.

:type client: :class:`~google.cloud.vision.client.Client`
:param client: The client that owns the current connection.
"""

API_BASE_URL = 'https://vision.googleapis.com'
"""The base of the API call URL."""

API_VERSION = 'v1'
"""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 _HTTPVisionAPI(object):
"""Vision API for interacting with the JSON/HTTP version of Vision

Expand Down
4 changes: 2 additions & 2 deletions vision/google/cloud/vision/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from google.cloud.environment_vars import DISABLE_GRPC

from google.cloud.vision._gax import _GAPICVisionAPI
from google.cloud.vision._http import _HTTPVisionAPI
from google.cloud.vision._http import Connection
from google.cloud.vision.batch import Batch
from google.cloud.vision.connection import Connection
from google.cloud.vision.image import Image
from google.cloud.vision._http import _HTTPVisionAPI


_USE_GAX = not os.getenv(DISABLE_GRPC, False)
Expand Down
36 changes: 0 additions & 36 deletions vision/google/cloud/vision/connection.py

This file was deleted.

Loading