Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
Pick up fixes in GAPIC generator. (#6490)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and tseaver committed Nov 14, 2018
1 parent 75464ba commit 26bf773
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 40 deletions.
17 changes: 12 additions & 5 deletions google/cloud/automl_v1beta1/gapic/auto_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=auto_ml_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -168,13 +168,20 @@ def __init__(self,
your own client library.
"""
# Raise deprecation warnings for things we want to go away.
if client_config:
warnings.warn('The `client_config` argument is deprecated.',
PendingDeprecationWarning)
if client_config is not None:
warnings.warn(
'The `client_config` argument is deprecated.',
PendingDeprecationWarning,
stacklevel=2)
else:
client_config = auto_ml_client_config.config

if channel:
warnings.warn(
'The `channel` argument is deprecated; use '
'`transport` instead.', PendingDeprecationWarning)
'`transport` instead.',
PendingDeprecationWarning,
stacklevel=2)

# Instantiate the transport.
# The transport is responsible for handling serialization and
Expand Down
17 changes: 12 additions & 5 deletions google/cloud/automl_v1beta1/gapic/prediction_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=prediction_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -115,13 +115,20 @@ def __init__(self,
your own client library.
"""
# Raise deprecation warnings for things we want to go away.
if client_config:
warnings.warn('The `client_config` argument is deprecated.',
PendingDeprecationWarning)
if client_config is not None:
warnings.warn(
'The `client_config` argument is deprecated.',
PendingDeprecationWarning,
stacklevel=2)
else:
client_config = prediction_service_client_config.config

if channel:
warnings.warn(
'The `channel` argument is deprecated; use '
'`transport` instead.', PendingDeprecationWarning)
'`transport` instead.',
PendingDeprecationWarning,
stacklevel=2)

# Instantiate the transport.
# The transport is responsible for handling serialization and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def __init__(self,
credentials=credentials,
)

self._channel = channel

# gRPC uses objects called "stubs" that are bound to the
# channel and provide a basic method for each RPC.
self._stubs = {
Expand Down Expand Up @@ -98,6 +100,15 @@ def create_channel(cls,
scopes=cls._OAUTH_SCOPES,
)

@property
def channel(self):
"""The gRPC channel used by the transport.
Returns:
grpc.Channel: A gRPC channel object.
"""
return self._channel

@property
def create_dataset(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def __init__(self,
credentials=credentials,
)

self._channel = channel

# gRPC uses objects called "stubs" that are bound to the
# channel and provide a basic method for each RPC.
self._stubs = {
Expand Down Expand Up @@ -92,6 +94,15 @@ def create_channel(cls,
scopes=cls._OAUTH_SCOPES,
)

@property
def channel(self):
"""The gRPC channel used by the transport.
Returns:
grpc.Channel: A gRPC channel object.
"""
return self._channel

@property
def predict(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Loading

0 comments on commit 26bf773

Please sign in to comment.