Skip to content

Commit b53be84

Browse files
committed
Renaming JSONClient -> ClientWithProject.
Done via: $ git grep -l JSONClient | xargs sed -i s/JSONClient/ClientWithProject/g Also fixing test b0rken by previous commit.
1 parent 1b14e5b commit b53be84

File tree

11 files changed

+22
-25
lines changed

11 files changed

+22
-25
lines changed

bigquery/google/cloud/bigquery/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""Client for interacting with the Google BigQuery API."""
1616

1717

18-
from google.cloud.client import JSONClient
18+
from google.cloud.client import ClientWithProject
1919
from google.cloud.bigquery._http import Connection
2020
from google.cloud.bigquery.dataset import Dataset
2121
from google.cloud.bigquery.job import CopyJob
@@ -50,7 +50,7 @@ def from_api_repr(cls, resource):
5050
resource['id'], resource['numericId'], resource['friendlyName'])
5151

5252

53-
class Client(JSONClient):
53+
class Client(ClientWithProject):
5454
"""Client to bundle configuration needed for API requests.
5555
5656
:type project: str

core/google/cloud/client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,8 @@ def _determine_default(project):
129129
return _determine_default_project(project)
130130

131131

132-
class JSONClient(Client, _ClientProjectMixin):
133-
"""Client for Google JSON-based API.
134-
135-
Assumes such APIs use the ``project`` and the client needs to store this
136-
value.
132+
class ClientWithProject(Client, _ClientProjectMixin):
133+
"""Client that also stores a project.
137134
138135
:type project: str
139136
:param project: the project which the client acts on behalf of. If not

core/unit_tests/test__helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ def mock_channel(*args, **kwargs):
789789
credentials = object()
790790
user_agent = 'you-sir-age-int'
791791
host = 'localhost'
792-
extra_options = {'extra_options': None}
792+
extra_options = {'extra_options': ()}
793793
with _Monkey(MUT, make_secure_channel=mock_channel):
794794
stub = self._call_fut(credentials, user_agent,
795795
stub_class, host)

core/unit_tests/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ def test_from_service_account_json_bad_args(self):
104104
mock.sentinel.filename, credentials=mock.sentinel.credentials)
105105

106106

107-
class TestJSONClient(unittest.TestCase):
107+
class TestClientWithProject(unittest.TestCase):
108108

109109
@staticmethod
110110
def _get_target_class():
111-
from google.cloud.client import JSONClient
111+
from google.cloud.client import ClientWithProject
112112

113-
return JSONClient
113+
return ClientWithProject
114114

115115
def _make_one(self, *args, **kw):
116116
return self._get_target_class()(*args, **kw)

dns/google/cloud/dns/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"""Client for interacting with the Google Cloud DNS API."""
1616

1717

18-
from google.cloud.client import JSONClient
18+
from google.cloud.client import ClientWithProject
1919
from google.cloud.dns.connection import Connection
2020
from google.cloud.dns.zone import ManagedZone
2121
from google.cloud.iterator import HTTPIterator
2222

2323

24-
class Client(JSONClient):
24+
class Client(ClientWithProject):
2525
"""Client to bundle configuration needed for API requests.
2626
2727
:type project: str

logging/google/cloud/logging/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
else:
3030
_HAVE_GAX = True
3131

32-
from google.cloud.client import JSONClient
32+
from google.cloud.client import ClientWithProject
3333
from google.cloud.environment_vars import DISABLE_GRPC
3434
from google.cloud.logging._http import Connection
3535
from google.cloud.logging._http import _LoggingAPI as JSONLoggingAPI
@@ -59,7 +59,7 @@
5959
"""Environment variable set in a Google Container Engine environment."""
6060

6161

62-
class Client(JSONClient):
62+
class Client(ClientWithProject):
6363
"""Client to bundle configuration needed for API requests.
6464
6565
:type project: str

monitoring/google/cloud/monitoring/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import datetime
3232

3333
from google.cloud._helpers import _datetime_to_rfc3339
34-
from google.cloud.client import JSONClient
34+
from google.cloud.client import ClientWithProject
3535
from google.cloud.monitoring.connection import Connection
3636
from google.cloud.monitoring.group import Group
3737
from google.cloud.monitoring.metric import Metric
@@ -47,7 +47,7 @@
4747
_UTCNOW = datetime.datetime.utcnow # To be replaced by tests.
4848

4949

50-
class Client(JSONClient):
50+
class Client(ClientWithProject):
5151
"""Client to bundle configuration needed for API requests.
5252
5353
:type project: str

pubsub/google/cloud/pubsub/client.py

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

1717
import os
1818

19-
from google.cloud.client import JSONClient
19+
from google.cloud.client import ClientWithProject
2020
from google.cloud.environment_vars import DISABLE_GRPC
2121
from google.cloud.pubsub._http import Connection
2222
from google.cloud.pubsub._http import _PublisherAPI as JSONPublisherAPI
@@ -43,7 +43,7 @@
4343
_USE_GAX = _HAVE_GAX and not _DISABLE_GAX
4444

4545

46-
class Client(JSONClient):
46+
class Client(ClientWithProject):
4747
"""Client to bundle configuration needed for API requests.
4848
4949
:type project: str

runtimeconfig/google/cloud/runtimeconfig/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"""Client for interacting with the Google Cloud RuntimeConfig API."""
1616

1717

18-
from google.cloud.client import JSONClient
18+
from google.cloud.client import ClientWithProject
1919
from google.cloud.runtimeconfig.connection import Connection
2020
from google.cloud.runtimeconfig.config import Config
2121

2222

23-
class Client(JSONClient):
23+
class Client(ClientWithProject):
2424
"""Client to bundle configuration needed for API requests.
2525
2626
:type project: str

storage/google/cloud/storage/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717

1818
from google.cloud._helpers import _LocalStack
19-
from google.cloud.client import JSONClient
19+
from google.cloud.client import ClientWithProject
2020
from google.cloud.exceptions import NotFound
2121
from google.cloud.iterator import HTTPIterator
2222
from google.cloud.storage._http import Connection
2323
from google.cloud.storage.batch import Batch
2424
from google.cloud.storage.bucket import Bucket
2525

2626

27-
class Client(JSONClient):
27+
class Client(ClientWithProject):
2828
"""Client to bundle configuration needed for API requests.
2929
3030
:type project: str

0 commit comments

Comments
 (0)