Skip to content

Commit 636c168

Browse files
yoshi-automationtseaver
authored andcommitted
Pick up fixes in GAPIC generator. (googleapis#6490)
Includes fixes from these PRs: - googleapis/gapic-generator#2407 - googleapis/gapic-generator#2396
1 parent 47bd4dc commit 636c168

6 files changed

Lines changed: 168 additions & 40 deletions

File tree

automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __init__(self,
135135
transport=None,
136136
channel=None,
137137
credentials=None,
138-
client_config=auto_ml_client_config.config,
138+
client_config=None,
139139
client_info=None):
140140
"""Constructor.
141141
@@ -168,13 +168,20 @@ def __init__(self,
168168
your own client library.
169169
"""
170170
# Raise deprecation warnings for things we want to go away.
171-
if client_config:
172-
warnings.warn('The `client_config` argument is deprecated.',
173-
PendingDeprecationWarning)
171+
if client_config is not None:
172+
warnings.warn(
173+
'The `client_config` argument is deprecated.',
174+
PendingDeprecationWarning,
175+
stacklevel=2)
176+
else:
177+
client_config = auto_ml_client_config.config
178+
174179
if channel:
175180
warnings.warn(
176181
'The `channel` argument is deprecated; use '
177-
'`transport` instead.', PendingDeprecationWarning)
182+
'`transport` instead.',
183+
PendingDeprecationWarning,
184+
stacklevel=2)
178185

179186
# Instantiate the transport.
180187
# The transport is responsible for handling serialization and

automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __init__(self,
8282
transport=None,
8383
channel=None,
8484
credentials=None,
85-
client_config=prediction_service_client_config.config,
85+
client_config=None,
8686
client_info=None):
8787
"""Constructor.
8888
@@ -115,13 +115,20 @@ def __init__(self,
115115
your own client library.
116116
"""
117117
# Raise deprecation warnings for things we want to go away.
118-
if client_config:
119-
warnings.warn('The `client_config` argument is deprecated.',
120-
PendingDeprecationWarning)
118+
if client_config is not None:
119+
warnings.warn(
120+
'The `client_config` argument is deprecated.',
121+
PendingDeprecationWarning,
122+
stacklevel=2)
123+
else:
124+
client_config = prediction_service_client_config.config
125+
121126
if channel:
122127
warnings.warn(
123128
'The `channel` argument is deprecated; use '
124-
'`transport` instead.', PendingDeprecationWarning)
129+
'`transport` instead.',
130+
PendingDeprecationWarning,
131+
stacklevel=2)
125132

126133
# Instantiate the transport.
127134
# The transport is responsible for handling serialization and

automl/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def __init__(self,
6363
credentials=credentials,
6464
)
6565

66+
self._channel = channel
67+
6668
# gRPC uses objects called "stubs" that are bound to the
6769
# channel and provide a basic method for each RPC.
6870
self._stubs = {
@@ -98,6 +100,15 @@ def create_channel(cls,
98100
scopes=cls._OAUTH_SCOPES,
99101
)
100102

103+
@property
104+
def channel(self):
105+
"""The gRPC channel used by the transport.
106+
107+
Returns:
108+
grpc.Channel: A gRPC channel object.
109+
"""
110+
return self._channel
111+
101112
@property
102113
def create_dataset(self):
103114
"""Return the gRPC stub for {$apiMethod.name}.

automl/google/cloud/automl_v1beta1/gapic/transports/prediction_service_grpc_transport.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def __init__(self,
6262
credentials=credentials,
6363
)
6464

65+
self._channel = channel
66+
6567
# gRPC uses objects called "stubs" that are bound to the
6668
# channel and provide a basic method for each RPC.
6769
self._stubs = {
@@ -92,6 +94,15 @@ def create_channel(cls,
9294
scopes=cls._OAUTH_SCOPES,
9395
)
9496

97+
@property
98+
def channel(self):
99+
"""The gRPC channel used by the transport.
100+
101+
Returns:
102+
grpc.Channel: A gRPC channel object.
103+
"""
104+
return self._channel
105+
95106
@property
96107
def predict(self):
97108
"""Return the gRPC stub for {$apiMethod.name}.

0 commit comments

Comments
 (0)