Skip to content

Commit

Permalink
Renaming JSONClient -> ClientWithProject.
Browse files Browse the repository at this point in the history
Done via:
$ git grep -l JSONClient | xargs sed -i s/JSONClient/ClientWithProject/g

Also fixing test b0rken by previous commit.
  • Loading branch information
dhermes committed Jan 26, 2017
1 parent 1b14e5b commit b53be84
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 25 deletions.
4 changes: 2 additions & 2 deletions bigquery/google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""Client for interacting with the Google BigQuery API."""


from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.bigquery._http import Connection
from google.cloud.bigquery.dataset import Dataset
from google.cloud.bigquery.job import CopyJob
Expand Down Expand Up @@ -50,7 +50,7 @@ def from_api_repr(cls, resource):
resource['id'], resource['numericId'], resource['friendlyName'])


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down
7 changes: 2 additions & 5 deletions core/google/cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ def _determine_default(project):
return _determine_default_project(project)


class JSONClient(Client, _ClientProjectMixin):
"""Client for Google JSON-based API.
Assumes such APIs use the ``project`` and the client needs to store this
value.
class ClientWithProject(Client, _ClientProjectMixin):
"""Client that also stores a project.
:type project: str
:param project: the project which the client acts on behalf of. If not
Expand Down
2 changes: 1 addition & 1 deletion core/unit_tests/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def mock_channel(*args, **kwargs):
credentials = object()
user_agent = 'you-sir-age-int'
host = 'localhost'
extra_options = {'extra_options': None}
extra_options = {'extra_options': ()}
with _Monkey(MUT, make_secure_channel=mock_channel):
stub = self._call_fut(credentials, user_agent,
stub_class, host)
Expand Down
6 changes: 3 additions & 3 deletions core/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def test_from_service_account_json_bad_args(self):
mock.sentinel.filename, credentials=mock.sentinel.credentials)


class TestJSONClient(unittest.TestCase):
class TestClientWithProject(unittest.TestCase):

@staticmethod
def _get_target_class():
from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject

return JSONClient
return ClientWithProject

def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)
Expand Down
4 changes: 2 additions & 2 deletions dns/google/cloud/dns/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"""Client for interacting with the Google Cloud DNS API."""


from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.dns.connection import Connection
from google.cloud.dns.zone import ManagedZone
from google.cloud.iterator import HTTPIterator


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down
4 changes: 2 additions & 2 deletions logging/google/cloud/logging/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
else:
_HAVE_GAX = True

from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.environment_vars import DISABLE_GRPC
from google.cloud.logging._http import Connection
from google.cloud.logging._http import _LoggingAPI as JSONLoggingAPI
Expand Down Expand Up @@ -59,7 +59,7 @@
"""Environment variable set in a Google Container Engine environment."""


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down
4 changes: 2 additions & 2 deletions monitoring/google/cloud/monitoring/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import datetime

from google.cloud._helpers import _datetime_to_rfc3339
from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.monitoring.connection import Connection
from google.cloud.monitoring.group import Group
from google.cloud.monitoring.metric import Metric
Expand All @@ -47,7 +47,7 @@
_UTCNOW = datetime.datetime.utcnow # To be replaced by tests.


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down
4 changes: 2 additions & 2 deletions pubsub/google/cloud/pubsub/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import os

from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.environment_vars import DISABLE_GRPC
from google.cloud.pubsub._http import Connection
from google.cloud.pubsub._http import _PublisherAPI as JSONPublisherAPI
Expand All @@ -43,7 +43,7 @@
_USE_GAX = _HAVE_GAX and not _DISABLE_GAX


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down
4 changes: 2 additions & 2 deletions runtimeconfig/google/cloud/runtimeconfig/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"""Client for interacting with the Google Cloud RuntimeConfig API."""


from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.runtimeconfig.connection import Connection
from google.cloud.runtimeconfig.config import Config


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down
4 changes: 2 additions & 2 deletions storage/google/cloud/storage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@


from google.cloud._helpers import _LocalStack
from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.exceptions import NotFound
from google.cloud.iterator import HTTPIterator
from google.cloud.storage._http import Connection
from google.cloud.storage.batch import Batch
from google.cloud.storage.bucket import Bucket


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
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 @@ -16,7 +16,7 @@

import os

from google.cloud.client import JSONClient
from google.cloud.client import ClientWithProject
from google.cloud.environment_vars import DISABLE_GRPC

from google.cloud.vision._gax import _GAPICVisionAPI
Expand All @@ -28,7 +28,7 @@
_USE_GAX = not os.getenv(DISABLE_GRPC, False)


class Client(JSONClient):
class Client(ClientWithProject):
"""Client to bundle configuration needed for API requests.
:type project: str
Expand Down

0 comments on commit b53be84

Please sign in to comment.