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

chore: use gapic-generator-python 0.58.4 #121

Merged
merged 9 commits into from
Feb 15, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)

elif credentials is None:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
Expand Down
8 changes: 4 additions & 4 deletions google/cloud/video/transcoder_v1/types/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ class AudioStream(proto.Message):
- ``sr`` - Side right channel
- ``fc`` - Front center channel
- ``lfe`` - Low frequency
mapping (Sequence[google.cloud.video.transcoder_v1.types.AudioStream.AudioMapping]):
mapping_ (Sequence[google.cloud.video.transcoder_v1.types.AudioStream.AudioMapping]):
The mapping for the ``Job.edit_list`` atoms with audio
``EditAtom.inputs``.
sample_rate_hertz (int):
Expand Down Expand Up @@ -1389,7 +1389,7 @@ class AudioMapping(proto.Message):
bitrate_bps = proto.Field(proto.INT32, number=2,)
channel_count = proto.Field(proto.INT32, number=3,)
channel_layout = proto.RepeatedField(proto.STRING, number=4,)
mapping = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioMapping,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioMapping,)
sample_rate_hertz = proto.Field(proto.INT32, number=6,)


Expand All @@ -1408,7 +1408,7 @@ class TextStream(proto.Message):
- ``cea608``
- ``cea708``
- ``webvtt``
mapping (Sequence[google.cloud.video.transcoder_v1.types.TextStream.TextMapping]):
mapping_ (Sequence[google.cloud.video.transcoder_v1.types.TextStream.TextMapping]):
The mapping for the ``Job.edit_list`` atoms with text
``EditAtom.inputs``.
"""
Expand All @@ -1433,7 +1433,7 @@ class TextMapping(proto.Message):
input_track = proto.Field(proto.INT32, number=3,)

codec = proto.Field(proto.STRING, number=1,)
mapping = proto.RepeatedField(proto.MESSAGE, number=3, message=TextMapping,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=3, message=TextMapping,)


class SegmentSettings(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)

elif credentials is None:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
Expand Down
8 changes: 4 additions & 4 deletions google/cloud/video/transcoder_v1beta1/types/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ class AudioStream(proto.Message):
- 'sr' - Side right channel
- 'fc' - Front center channel
- 'lfe' - Low frequency
mapping (Sequence[google.cloud.video.transcoder_v1beta1.types.AudioStream.AudioAtom]):
mapping_ (Sequence[google.cloud.video.transcoder_v1beta1.types.AudioStream.AudioAtom]):
The mapping for the ``Job.edit_list`` atoms with audio
``EditAtom.inputs``.
sample_rate_hertz (int):
Expand Down Expand Up @@ -1161,7 +1161,7 @@ class AudioChannelInput(proto.Message):
bitrate_bps = proto.Field(proto.INT32, number=2,)
channel_count = proto.Field(proto.INT32, number=3,)
channel_layout = proto.RepeatedField(proto.STRING, number=4,)
mapping = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioAtom,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioAtom,)
sample_rate_hertz = proto.Field(proto.INT32, number=6,)


Expand All @@ -1184,7 +1184,7 @@ class TextStream(proto.Message):
Required. The BCP-47 language code, such as ``"en-US"`` or
``"sr-Latn"``. For more information, see
https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
mapping (Sequence[google.cloud.video.transcoder_v1beta1.types.TextStream.TextAtom]):
mapping_ (Sequence[google.cloud.video.transcoder_v1beta1.types.TextStream.TextAtom]):
The mapping for the ``Job.edit_list`` atoms with text
``EditAtom.inputs``.
"""
Expand Down Expand Up @@ -1223,7 +1223,7 @@ class TextInput(proto.Message):

codec = proto.Field(proto.STRING, number=1,)
language_code = proto.Field(proto.STRING, number=2,)
mapping = proto.RepeatedField(proto.MESSAGE, number=3, message=TextAtom,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=3, message=TextAtom,)


class SegmentSettings(proto.Message):
Expand Down
31 changes: 7 additions & 24 deletions samples/snippets/create_job_with_embedded_captions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@


def create_job_with_embedded_captions(
project_id,
location,
input_video_uri,
input_captions_uri,
output_uri,
project_id, location, input_video_uri, input_captions_uri, output_uri,
):
"""Creates a job based on an ad-hoc job configuration that embeds captions in the output video.

Expand All @@ -57,19 +53,12 @@ def create_job_with_embedded_captions(
job.output_uri = output_uri
job.config = transcoder_v1.types.JobConfig(
inputs=[
transcoder_v1.types.Input(
key="input0",
uri=input_video_uri,
),
transcoder_v1.types.Input(
key="caption-input0",
uri=input_captions_uri,
),
transcoder_v1.types.Input(key="input0", uri=input_video_uri,),
transcoder_v1.types.Input(key="caption-input0", uri=input_captions_uri,),
],
edit_list=[
transcoder_v1.types.EditAtom(
key="atom0",
inputs=["input0", "caption-input0"],
key="atom0", inputs=["input0", "caption-input0"],
),
],
elementary_streams=[
Expand Down Expand Up @@ -131,9 +120,7 @@ def create_job_with_embedded_captions(
elementary_streams=["video-stream0", "audio-stream0"],
),
transcoder_v1.types.MuxStream(
key="sd-dash",
container="fmp4",
elementary_streams=["video-stream0"],
key="sd-dash", container="fmp4", elementary_streams=["video-stream0"],
),
transcoder_v1.types.MuxStream(
key="audio-dash",
Expand All @@ -143,9 +130,7 @@ def create_job_with_embedded_captions(
],
manifests=[
transcoder_v1.types.Manifest(
file_name="manifest.m3u8",
type_="HLS",
mux_streams=["sd-hls"],
file_name="manifest.m3u8", type_="HLS", mux_streams=["sd-hls"],
),
transcoder_v1.types.Manifest(
file_name="manifest.mpd",
Expand All @@ -165,9 +150,7 @@ def create_job_with_embedded_captions(
parser = argparse.ArgumentParser()
parser.add_argument("--project_id", help="Your Cloud project ID.", required=True)
parser.add_argument(
"--location",
help="The location to start this job in.",
default="us-central1",
"--location", help="The location to start this job in.", default="us-central1",
)
parser.add_argument(
"--input_video_uri",
Expand Down
27 changes: 6 additions & 21 deletions samples/snippets/create_job_with_standalone_captions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@


def create_job_with_standalone_captions(
project_id,
location,
input_video_uri,
input_captions_uri,
output_uri,
project_id, location, input_video_uri, input_captions_uri, output_uri,
):
"""Creates a job based on an ad-hoc job configuration that can use captions from a standalone file.

Expand All @@ -58,19 +54,12 @@ def create_job_with_standalone_captions(
job.output_uri = output_uri
job.config = transcoder_v1.types.JobConfig(
inputs=[
transcoder_v1.types.Input(
key="input0",
uri=input_video_uri,
),
transcoder_v1.types.Input(
key="caption-input0",
uri=input_captions_uri,
),
transcoder_v1.types.Input(key="input0", uri=input_video_uri,),
transcoder_v1.types.Input(key="caption-input0", uri=input_captions_uri,),
],
edit_list=[
transcoder_v1.types.EditAtom(
key="atom0",
inputs=["input0", "caption-input0"],
key="atom0", inputs=["input0", "caption-input0"],
),
],
elementary_streams=[
Expand Down Expand Up @@ -136,9 +125,7 @@ def create_job_with_standalone_captions(
container="vtt",
elementary_streams=["vtt-stream0"],
segment_settings=transcoder_v1.types.SegmentSettings(
segment_duration=duration.Duration(
seconds=6,
),
segment_duration=duration.Duration(seconds=6,),
individual_segments=True,
),
),
Expand All @@ -162,9 +149,7 @@ def create_job_with_standalone_captions(
parser = argparse.ArgumentParser()
parser.add_argument("--project_id", help="Your Cloud project ID.", required=True)
parser.add_argument(
"--location",
help="The location to start this job in.",
default="us-central1",
"--location", help="The location to start this job in.", default="us-central1",
)
parser.add_argument(
"--input_video_uri",
Expand Down
24 changes: 9 additions & 15 deletions samples/snippets/job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@
output_uri_for_animated_overlay = (
f"gs://{output_bucket_name}/test-output-animated-overlay/"
)
output_uri_for_embedded_captions = f"gs://{output_bucket_name}/test-output-embedded-captions/"
output_uri_for_standalone_captions = f"gs://{output_bucket_name}/test-output-standalone-captions/"
output_uri_for_embedded_captions = (
f"gs://{output_bucket_name}/test-output-embedded-captions/"
)
output_uri_for_standalone_captions = (
f"gs://{output_bucket_name}/test-output-standalone-captions/"
)

small_spritesheet_file_prefix = "small-sprite-sheet"
large_spritesheet_file_prefix = "large-sprite-sheet"
Expand Down Expand Up @@ -267,10 +271,7 @@ def test_create_job_with_animated_overlay(capsys, test_bucket):

def test_create_job_with_set_number_spritesheet(capsys, test_bucket):
create_job_with_set_number_images_spritesheet.create_job_with_set_number_images_spritesheet(
project_id,
location,
input_uri,
output_uri_for_set_number_spritesheet,
project_id, location, input_uri, output_uri_for_set_number_spritesheet,
)
out, _ = capsys.readouterr()
job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/"
Expand Down Expand Up @@ -318,10 +319,7 @@ def test_create_job_with_set_number_spritesheet(capsys, test_bucket):

def test_create_job_with_periodic_spritesheet(capsys, test_bucket):
create_job_with_periodic_images_spritesheet.create_job_with_periodic_images_spritesheet(
project_id,
location,
input_uri,
output_uri_for_periodic_spritesheet,
project_id, location, input_uri, output_uri_for_periodic_spritesheet,
)
out, _ = capsys.readouterr()
job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/"
Expand Down Expand Up @@ -409,11 +407,7 @@ def test_create_job_with_concatenated_inputs(capsys, test_bucket):

def test_create_job_with_embedded_captions(capsys, test_bucket):
create_job_with_embedded_captions.create_job_with_embedded_captions(
project_id,
location,
input_uri,
captions_uri,
output_uri_for_embedded_captions,
project_id, location, input_uri, captions_uri, output_uri_for_embedded_captions,
)
out, _ = capsys.readouterr()
job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/"
Expand Down
1 change: 1 addition & 0 deletions samples/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
backoff==1.11.1
google-cloud-storage==1.43.0
pytest==6.2.4
proto-plus>=1.20.1
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.4.0",
# Require proto-plus >= 1.20.1 which includes
# a fix to mitigate collisions in field names, specifically
# the `mapping` term which is a reserved term in proto-plus.
# https://github.com/googleapis/proto-plus-python/pull/295
"proto-plus >= 1.20.1",
),
python_requires=">=3.6",
classifiers=[
Expand Down
2 changes: 1 addition & 1 deletion testing/constraints-3.6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==1.28.0
proto-plus==1.4.0
proto-plus==1.20.1
Loading