Skip to content

Commit 90de0fe

Browse files
committed
Re-mapping aliased imports so that handwritten classes are used.
1 parent 049fc36 commit 90de0fe

File tree

5 files changed

+70
-67
lines changed

5 files changed

+70
-67
lines changed

pubsub/google/cloud/pubsub.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
__all__ = (
2222
'types',
2323
'PublisherClient',
24-
'SubscriberClient', )
24+
'SubscriberClient',
25+
)

pubsub/google/cloud/pubsub_v1/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@
1515
from __future__ import absolute_import
1616

1717
from google.cloud.pubsub_v1 import types
18-
from google.cloud.pubsub_v1.gapic import publisher_client
19-
from google.cloud.pubsub_v1.gapic import subscriber_client
18+
from google.cloud.pubsub_v1 import publisher
19+
from google.cloud.pubsub_v1 import subscriber
2020

2121

22-
class PublisherClient(publisher_client.PublisherClient):
23-
__doc__ = publisher_client.PublisherClient.__doc__
22+
class PublisherClient(publisher.Client):
23+
__doc__ = publisher.Client.__doc__
2424

2525

26-
class SubscriberClient(subscriber_client.SubscriberClient):
27-
__doc__ = subscriber_client.SubscriberClient.__doc__
26+
class SubscriberClient(subscriber.Client):
27+
__doc__ = subscriber.Client.__doc__
2828

2929

3030
__all__ = (
3131
'types',
3232
'PublisherClient',
33-
'SubscriberClient', )
33+
'SubscriberClient',
34+
)

pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
from google.iam.v1 import policy_pb2
3939
from google.protobuf import field_mask_pb2
4040

41+
4142
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
42-
'google-cloud-pubsub', ).version
43+
'google-cloud-pubsub').version
4344

4445

4546
class PublisherClient(object):

pubsub/tests/unit/gapic/v1/test_publisher_client_v1.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import pytest
1717

18-
from google.cloud import pubsub_v1
18+
from google.cloud.pubsub_v1.gapic import publisher_client
1919
from google.cloud.pubsub_v1.proto import pubsub_pb2
2020
from google.iam.v1 import iam_policy_pb2
2121
from google.iam.v1 import policy_pb2
@@ -71,7 +71,7 @@ def test_create_topic(self):
7171

7272
# Mock the API response
7373
channel = ChannelStub(responses=[expected_response])
74-
client = pubsub_v1.PublisherClient(channel=channel)
74+
client = publisher_client.PublisherClient(channel=channel)
7575

7676
# Setup Request
7777
name = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -87,7 +87,7 @@ def test_create_topic(self):
8787
def test_create_topic_exception(self):
8888
# Mock the API response
8989
channel = ChannelStub(responses=[CustomException()])
90-
client = pubsub_v1.PublisherClient(channel=channel)
90+
client = publisher_client.PublisherClient(channel=channel)
9191

9292
# Setup request
9393
name = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -103,7 +103,7 @@ def test_update_topic(self):
103103

104104
# Mock the API response
105105
channel = ChannelStub(responses=[expected_response])
106-
client = pubsub_v1.PublisherClient(channel=channel)
106+
client = publisher_client.PublisherClient(channel=channel)
107107

108108
# Setup Request
109109
topic = {}
@@ -121,7 +121,7 @@ def test_update_topic(self):
121121
def test_update_topic_exception(self):
122122
# Mock the API response
123123
channel = ChannelStub(responses=[CustomException()])
124-
client = pubsub_v1.PublisherClient(channel=channel)
124+
client = publisher_client.PublisherClient(channel=channel)
125125

126126
# Setup request
127127
topic = {}
@@ -139,7 +139,7 @@ def test_publish(self):
139139

140140
# Mock the API response
141141
channel = ChannelStub(responses=[expected_response])
142-
client = pubsub_v1.PublisherClient(channel=channel)
142+
client = publisher_client.PublisherClient(channel=channel)
143143

144144
# Setup Request
145145
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -159,7 +159,7 @@ def test_publish(self):
159159
def test_publish_exception(self):
160160
# Mock the API response
161161
channel = ChannelStub(responses=[CustomException()])
162-
client = pubsub_v1.PublisherClient(channel=channel)
162+
client = publisher_client.PublisherClient(channel=channel)
163163

164164
# Setup request
165165
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -178,7 +178,7 @@ def test_get_topic(self):
178178

179179
# Mock the API response
180180
channel = ChannelStub(responses=[expected_response])
181-
client = pubsub_v1.PublisherClient(channel=channel)
181+
client = publisher_client.PublisherClient(channel=channel)
182182

183183
# Setup Request
184184
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -194,7 +194,7 @@ def test_get_topic(self):
194194
def test_get_topic_exception(self):
195195
# Mock the API response
196196
channel = ChannelStub(responses=[CustomException()])
197-
client = pubsub_v1.PublisherClient(channel=channel)
197+
client = publisher_client.PublisherClient(channel=channel)
198198

199199
# Setup request
200200
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -215,7 +215,7 @@ def test_list_topics(self):
215215

216216
# Mock the API response
217217
channel = ChannelStub(responses=[expected_response])
218-
client = pubsub_v1.PublisherClient(channel=channel)
218+
client = publisher_client.PublisherClient(channel=channel)
219219

220220
# Setup Request
221221
project = client.project_path('[PROJECT]')
@@ -233,7 +233,7 @@ def test_list_topics(self):
233233

234234
def test_list_topics_exception(self):
235235
channel = ChannelStub(responses=[CustomException()])
236-
client = pubsub_v1.PublisherClient(channel=channel)
236+
client = publisher_client.PublisherClient(channel=channel)
237237

238238
# Setup request
239239
project = client.project_path('[PROJECT]')
@@ -256,7 +256,7 @@ def test_list_topic_subscriptions(self):
256256

257257
# Mock the API response
258258
channel = ChannelStub(responses=[expected_response])
259-
client = pubsub_v1.PublisherClient(channel=channel)
259+
client = publisher_client.PublisherClient(channel=channel)
260260

261261
# Setup Request
262262
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -275,7 +275,7 @@ def test_list_topic_subscriptions(self):
275275

276276
def test_list_topic_subscriptions_exception(self):
277277
channel = ChannelStub(responses=[CustomException()])
278-
client = pubsub_v1.PublisherClient(channel=channel)
278+
client = publisher_client.PublisherClient(channel=channel)
279279

280280
# Setup request
281281
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -286,7 +286,7 @@ def test_list_topic_subscriptions_exception(self):
286286

287287
def test_delete_topic(self):
288288
channel = ChannelStub()
289-
client = pubsub_v1.PublisherClient(channel=channel)
289+
client = publisher_client.PublisherClient(channel=channel)
290290

291291
# Setup Request
292292
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -301,7 +301,7 @@ def test_delete_topic(self):
301301
def test_delete_topic_exception(self):
302302
# Mock the API response
303303
channel = ChannelStub(responses=[CustomException()])
304-
client = pubsub_v1.PublisherClient(channel=channel)
304+
client = publisher_client.PublisherClient(channel=channel)
305305

306306
# Setup request
307307
topic = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -318,7 +318,7 @@ def test_set_iam_policy(self):
318318

319319
# Mock the API response
320320
channel = ChannelStub(responses=[expected_response])
321-
client = pubsub_v1.PublisherClient(channel=channel)
321+
client = publisher_client.PublisherClient(channel=channel)
322322

323323
# Setup Request
324324
resource = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -336,7 +336,7 @@ def test_set_iam_policy(self):
336336
def test_set_iam_policy_exception(self):
337337
# Mock the API response
338338
channel = ChannelStub(responses=[CustomException()])
339-
client = pubsub_v1.PublisherClient(channel=channel)
339+
client = publisher_client.PublisherClient(channel=channel)
340340

341341
# Setup request
342342
resource = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -354,7 +354,7 @@ def test_get_iam_policy(self):
354354

355355
# Mock the API response
356356
channel = ChannelStub(responses=[expected_response])
357-
client = pubsub_v1.PublisherClient(channel=channel)
357+
client = publisher_client.PublisherClient(channel=channel)
358358

359359
# Setup Request
360360
resource = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -371,7 +371,7 @@ def test_get_iam_policy(self):
371371
def test_get_iam_policy_exception(self):
372372
# Mock the API response
373373
channel = ChannelStub(responses=[CustomException()])
374-
client = pubsub_v1.PublisherClient(channel=channel)
374+
client = publisher_client.PublisherClient(channel=channel)
375375

376376
# Setup request
377377
resource = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -387,7 +387,7 @@ def test_test_iam_permissions(self):
387387

388388
# Mock the API response
389389
channel = ChannelStub(responses=[expected_response])
390-
client = pubsub_v1.PublisherClient(channel=channel)
390+
client = publisher_client.PublisherClient(channel=channel)
391391

392392
# Setup Request
393393
resource = client.topic_path('[PROJECT]', '[TOPIC]')
@@ -405,7 +405,7 @@ def test_test_iam_permissions(self):
405405
def test_test_iam_permissions_exception(self):
406406
# Mock the API response
407407
channel = ChannelStub(responses=[CustomException()])
408-
client = pubsub_v1.PublisherClient(channel=channel)
408+
client = publisher_client.PublisherClient(channel=channel)
409409

410410
# Setup request
411411
resource = client.topic_path('[PROJECT]', '[TOPIC]')

0 commit comments

Comments
 (0)