Skip to content

Commit

Permalink
Merge pull request #3033 from dhermes/no-more-connection-modules
Browse files Browse the repository at this point in the history
Renaming all remaining connection.py modules as _http.py.
  • Loading branch information
dhermes authored Feb 17, 2017
2 parents 0a311f7 + 24e7096 commit c79fc92
Show file tree
Hide file tree
Showing 47 changed files with 84 additions and 189 deletions.
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
7 changes: 0 additions & 7 deletions docs/dns-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ DNS Client
.. automodule:: google.cloud.dns.client
:members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.dns.connection
:members:
:show-inheritance:
7 changes: 0 additions & 7 deletions docs/language-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ Natural Language Client
.. automodule:: google.cloud.language.client
:members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.language.connection
:members:
:show-inheritance:
7 changes: 0 additions & 7 deletions docs/monitoring-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ Stackdriver Monitoring Client
.. automodule:: google.cloud.monitoring.client
:members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.monitoring.connection
:members:
:show-inheritance:
7 changes: 0 additions & 7 deletions docs/resource-manager-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,3 @@ Client
.. automodule:: google.cloud.resource_manager.client
:members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.resource_manager.connection
:members:
:show-inheritance:
7 changes: 0 additions & 7 deletions docs/runtimeconfig-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ Runtime Configuration Client
.. automodule:: google.cloud.runtimeconfig.client
:members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.runtimeconfig.connection
:members:
:show-inheritance:
8 changes: 0 additions & 8 deletions docs/speech-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ Speech Client
:members:
:undoc-members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.speech.connection
:members:
:undoc-members:
:show-inheritance:
8 changes: 0 additions & 8 deletions docs/translate-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ Translation Client
:members:
:undoc-members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.translate.connection
:members:
:undoc-members:
:show-inheritance:
8 changes: 0 additions & 8 deletions docs/vision-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,3 @@ Client
:members:
:undoc-members:
:show-inheritance:

Connection
~~~~~~~~~~

.. automodule:: google.cloud.vision.connection
:members:
:undoc-members:
:show-inheritance:
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
Loading

0 comments on commit c79fc92

Please sign in to comment.