Skip to content

Commit

Permalink
Videointelligence: pick up fixes to GAPIC generator. (#6578)
Browse files Browse the repository at this point in the history
Includes fixes from these PRs:

- googleapis/gapic-generator#2407 (closing googleapis/gapic-generator#2389)
- googleapis/gapic-generator#2396 (for #5523 and dupes).

Includes changes to generated tests.

Closes #6512.
  • Loading branch information
tseaver authored Nov 19, 2018
1 parent 143f59c commit ca20aaf
Show file tree
Hide file tree
Showing 16 changed files with 349 additions and 65 deletions.
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 @@ -99,6 +101,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 annotate_video(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=video_intelligence_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -106,13 +106,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 = video_intelligence_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 @@ -99,6 +101,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 annotate_video(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=video_intelligence_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -106,13 +106,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 = video_intelligence_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 @@ -99,6 +101,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 annotate_video(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=video_intelligence_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -106,13 +106,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 = video_intelligence_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 @@ -99,6 +101,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 annotate_video(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=video_intelligence_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -106,13 +106,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 = video_intelligence_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 @@ -99,6 +101,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 annotate_video(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=video_intelligence_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -106,13 +106,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 = video_intelligence_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
27 changes: 19 additions & 8 deletions videointelligence/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import synthtool as s
from synthtool import gcp


gapic = gcp.GAPICGenerator()

versions = ['v1beta1', 'v1beta2', 'v1p1beta1', 'v1p2beta1', 'v1']
Expand All @@ -32,15 +33,25 @@
s.move(
library,
excludes=[
'setup.py', 'README.rst', 'docs/index.rst',
'setup.py',
'nox*.py',
'README.rst',
'docs/index.rst',
f'tests/system/gapic/{version}/'
f'test_system_video_intelligence_service_{version}.py',
f'tests/unit/gapic/{version}/'
f'test_video_intelligence_service_client_{version}.py',
f'nox.py',
#f'tests/unit/gapic/{version}/'
#f'test_video_intelligence_service_client_{version}.py',
])

s.replace("**/*/video_intelligence_service_client.py",
"'google-cloud-video-intelligence', \).version",
"'google-cloud-videointelligence', ).version")

s.replace(
"**/*/video_intelligence_service_client.py",
"'google-cloud-video-intelligence', \).version",
"'google-cloud-videointelligence', ).version",
)

s.replace(
"tests/unit/gapic/**/test_video_intelligence_service_client_*.py",
"^(\s+)expected_request = video_intelligence_pb2.AnnotateVideoRequest\(\)",
"\g<1>expected_request = video_intelligence_pb2.AnnotateVideoRequest(\n"
"\g<1> input_uri=input_uri, features=features)",
)
Loading

0 comments on commit ca20aaf

Please sign in to comment.