Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
fix(videointelligence): revert #9440; make features a keyword param…
Browse files Browse the repository at this point in the history
…eter (#9810)

* Makes `features` a keyword parameter to annotate_video

This reverts part of commit 853d612.
  • Loading branch information
busunkim96 committed Nov 15, 2019
1 parent 541d086 commit cc6fdcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -191,9 +191,9 @@ def __init__(
# Service calls
def annotate_video(
self,
features,
input_uri=None,
input_content=None,
features=None,
video_context=None,
output_uri=None,
location_id=None,
Expand All @@ -213,11 +213,11 @@ def annotate_video(
>>>
>>> client = videointelligence_v1.VideoIntelligenceServiceClient()
>>>
>>> input_uri = 'gs://cloud-samples-data/video/cat.mp4'
>>> features_element = enums.Feature.LABEL_DETECTION
>>> features = [features_element]
>>> input_uri = 'gs://cloud-samples-data/video/cat.mp4'
>>>
>>> response = client.annotate_video(features, input_uri=input_uri)
>>> response = client.annotate_video(input_uri=input_uri, features=features)
>>>
>>> def callback(operation_future):
... # Handle result.
Expand All @@ -229,7 +229,6 @@ def annotate_video(
>>> metadata = response.metadata()
Args:
features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features.
input_uri (str): Input video location. Currently, only `Google Cloud
Storage <https://cloud.google.com/storage/>`__ URIs are supported, which
must be specified in the following format: ``gs://bucket-id/object-id``
Expand All @@ -242,6 +241,7 @@ def annotate_video(
request as ``input_content``. If set, ``input_content`` should be unset.
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
via ``input_uri``. If set, ``input_uri`` should be unset.
features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features.
video_context (Union[dict, ~google.cloud.videointelligence_v1.types.VideoContext]): Additional video context and/or feature-specific parameters.
If a dict is provided, it must be of the same form as the protobuf
Expand Down Expand Up @@ -288,9 +288,9 @@ def annotate_video(
)

request = video_intelligence_pb2.AnnotateVideoRequest(
features=features,
input_uri=input_uri,
input_content=input_content,
features=features,
video_context=video_context,
output_uri=output_uri,
location_id=location_id,
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/gapic/v1/test_video_intelligence_service_client_v1.py
Expand Up @@ -83,17 +83,17 @@ def test_annotate_video(self):
client = videointelligence_v1.VideoIntelligenceServiceClient()

# Setup Request
input_uri = "gs://cloud-samples-data/video/cat.mp4"
features_element = enums.Feature.LABEL_DETECTION
features = [features_element]
input_uri = "gs://cloud-samples-data/video/cat.mp4"

response = client.annotate_video(features, input_uri=input_uri)
response = client.annotate_video(input_uri=input_uri, features=features)
result = response.result()
assert expected_response == result

assert len(channel.requests) == 1
expected_request = video_intelligence_pb2.AnnotateVideoRequest(
features=features, input_uri=input_uri
input_uri=input_uri, features=features
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
Expand All @@ -114,10 +114,10 @@ def test_annotate_video_exception(self):
client = videointelligence_v1.VideoIntelligenceServiceClient()

# Setup Request
input_uri = "gs://cloud-samples-data/video/cat.mp4"
features_element = enums.Feature.LABEL_DETECTION
features = [features_element]
input_uri = "gs://cloud-samples-data/video/cat.mp4"

response = client.annotate_video(features, input_uri=input_uri)
response = client.annotate_video(input_uri=input_uri, features=features)
exception = response.exception()
assert exception.errors[0] == error

0 comments on commit cc6fdcb

Please sign in to comment.