Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.6.1 (#239)
Browse files Browse the repository at this point in the history
* chore: update to gapic-generator-python 1.5.0

feat: add support for `google.cloud.<api>.__version__`
PiperOrigin-RevId: 484665853

Source-Link: googleapis/googleapis@8eb249a

Source-Link: googleapis/googleapis-gen@c8aa327
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update version in gapic_version.py

* add .release-please-manifest.json with correct version

* add owlbot.py to exclude generated gapic_version.py

* add release-please-config.json

* chore: Update to gapic-generator-python 1.6.0

feat(python): Add typing to proto.Message based class attributes

feat(python): Snippetgen handling of repeated enum field

PiperOrigin-RevId: 487326846

Source-Link: googleapis/googleapis@da380c7

Source-Link: googleapis/googleapis-gen@61ef576
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: new APIs added to reflect updates to the filestore service

- Add ENTERPRISE Tier
- Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot
- Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare
- Add ConnectMode to NetworkConfig (for Private Service Access support)
- New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING)
- Add SuspensionReason (for KMS related suspension)
- Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled

PiperOrigin-RevId: 487492758

Source-Link: googleapis/googleapis@5be5981

Source-Link: googleapis/googleapis-gen@ab0e217
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update path to snippet metadata json

* chore: Update gapic-generator-python to v1.6.1

PiperOrigin-RevId: 488036204

Source-Link: googleapis/googleapis@08f275f

Source-Link: googleapis/googleapis-gen@555c094
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* configure release-please to use manifest

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Nov 26, 2022
1 parent d9b2ff5 commit ce2c79a
Show file tree
Hide file tree
Showing 21 changed files with 242 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
releaseType: python
handleGHRelease: true
manifest: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.9.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Types for Google Cloud Mediatranslation v1beta1 API

.. automodule:: google.cloud.mediatranslation_v1beta1.types
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.mediatranslation import gapic_version as package_version

__version__ = package_version.__version__


from google.cloud.mediatranslation_v1beta1.services.speech_translation_service.async_client import (
SpeechTranslationServiceAsyncClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.9.4" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.mediatranslation import gapic_version as package_version

__version__ = package_version.__version__


from .services.speech_translation_service import (
SpeechTranslationServiceAsyncClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
Awaitable,
Dict,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Expand Down Expand Up @@ -174,9 +176,9 @@ def transport(self) -> SpeechTranslationServiceTransport:
def __init__(
self,
*,
credentials: ga_credentials.Credentials = None,
credentials: Optional[ga_credentials.Credentials] = None,
transport: Union[str, SpeechTranslationServiceTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_options: Optional[ClientOptions] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the speech translation service client.
Expand Down Expand Up @@ -220,12 +222,12 @@ def __init__(

def streaming_translate_speech(
self,
requests: AsyncIterator[
media_translation.StreamingTranslateSpeechRequest
requests: Optional[
AsyncIterator[media_translation.StreamingTranslateSpeechRequest]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> Awaitable[AsyncIterable[media_translation.StreamingTranslateSpeechResponse]]:
r"""Performs bidirectional streaming speech translation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
Iterable,
Iterator,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Type,
Union,
cast,
)

from google.api_core import client_options as client_options_lib
Expand Down Expand Up @@ -69,7 +72,7 @@ class SpeechTranslationServiceClientMeta(type):

def get_transport_class(
cls,
label: str = None,
label: Optional[str] = None,
) -> Type[SpeechTranslationServiceTransport]:
"""Returns an appropriate transport class.
Expand Down Expand Up @@ -322,8 +325,8 @@ def __init__(
self,
*,
credentials: Optional[ga_credentials.Credentials] = None,
transport: Union[str, SpeechTranslationServiceTransport, None] = None,
client_options: Optional[client_options_lib.ClientOptions] = None,
transport: Optional[Union[str, SpeechTranslationServiceTransport]] = None,
client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the speech translation service client.
Expand All @@ -337,7 +340,7 @@ def __init__(
transport (Union[str, SpeechTranslationServiceTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
client_options (google.api_core.client_options.ClientOptions): Custom options for the
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
Expand Down Expand Up @@ -367,6 +370,7 @@ def __init__(
client_options = client_options_lib.from_dict(client_options)
if client_options is None:
client_options = client_options_lib.ClientOptions()
client_options = cast(client_options_lib.ClientOptions, client_options)

api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(
client_options
Expand Down Expand Up @@ -419,10 +423,12 @@ def __init__(

def streaming_translate_speech(
self,
requests: Iterator[media_translation.StreamingTranslateSpeechRequest] = None,
requests: Optional[
Iterator[media_translation.StreamingTranslateSpeechRequest]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> Iterable[media_translation.StreamingTranslateSpeechResponse]:
r"""Performs bidirectional streaming speech translation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(
self,
*,
host: str = DEFAULT_HOST,
credentials: ga_credentials.Credentials = None,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def __init__(
self,
*,
host: str = "mediatranslation.googleapis.com",
credentials: ga_credentials.Credentials = None,
credentials_file: str = None,
scopes: Sequence[str] = None,
channel: grpc.Channel = None,
api_mtls_endpoint: str = None,
client_cert_source: Callable[[], Tuple[bytes, bytes]] = None,
ssl_channel_credentials: grpc.ChannelCredentials = None,
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
channel: Optional[grpc.Channel] = None,
api_mtls_endpoint: Optional[str] = None,
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
Expand Down Expand Up @@ -180,8 +180,8 @@ def __init__(
def create_channel(
cls,
host: str = "mediatranslation.googleapis.com",
credentials: ga_credentials.Credentials = None,
credentials_file: str = None,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
**kwargs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SpeechTranslationServiceGrpcAsyncIOTransport(SpeechTranslationServiceTrans
def create_channel(
cls,
host: str = "mediatranslation.googleapis.com",
credentials: ga_credentials.Credentials = None,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
Expand Down Expand Up @@ -91,15 +91,15 @@ def __init__(
self,
*,
host: str = "mediatranslation.googleapis.com",
credentials: ga_credentials.Credentials = None,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
channel: aio.Channel = None,
api_mtls_endpoint: str = None,
client_cert_source: Callable[[], Tuple[bytes, bytes]] = None,
ssl_channel_credentials: grpc.ChannelCredentials = None,
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
quota_project_id=None,
channel: Optional[aio.Channel] = None,
api_mtls_endpoint: Optional[str] = None,
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import MutableMapping, MutableSequence

from google.rpc import status_pb2 # type: ignore
import proto # type: ignore

Expand Down Expand Up @@ -96,23 +98,23 @@ class TranslateSpeechConfig(proto.Message):
model.
"""

audio_encoding = proto.Field(
audio_encoding: str = proto.Field(
proto.STRING,
number=1,
)
source_language_code = proto.Field(
source_language_code: str = proto.Field(
proto.STRING,
number=2,
)
target_language_code = proto.Field(
target_language_code: str = proto.Field(
proto.STRING,
number=3,
)
sample_rate_hertz = proto.Field(
sample_rate_hertz: int = proto.Field(
proto.INT32,
number=4,
)
model = proto.Field(
model: str = proto.Field(
proto.STRING,
number=5,
)
Expand Down Expand Up @@ -147,12 +149,12 @@ class StreamingTranslateSpeechConfig(proto.Message):
previous response is true).
"""

audio_config = proto.Field(
audio_config: "TranslateSpeechConfig" = proto.Field(
proto.MESSAGE,
number=1,
message="TranslateSpeechConfig",
)
single_utterance = proto.Field(
single_utterance: bool = proto.Field(
proto.BOOL,
number=2,
)
Expand Down Expand Up @@ -197,13 +199,13 @@ class StreamingTranslateSpeechRequest(proto.Message):
This field is a member of `oneof`_ ``streaming_request``.
"""

streaming_config = proto.Field(
streaming_config: "StreamingTranslateSpeechConfig" = proto.Field(
proto.MESSAGE,
number=1,
oneof="streaming_request",
message="StreamingTranslateSpeechConfig",
)
audio_content = proto.Field(
audio_content: bytes = proto.Field(
proto.BYTES,
number=2,
oneof="streaming_request",
Expand Down Expand Up @@ -240,16 +242,16 @@ class TextTranslationResult(proto.Message):
the transcript and corresponding audio.
"""

translation = proto.Field(
translation: str = proto.Field(
proto.STRING,
number=1,
)
is_final = proto.Field(
is_final: bool = proto.Field(
proto.BOOL,
number=2,
)

text_translation_result = proto.Field(
text_translation_result: TextTranslationResult = proto.Field(
proto.MESSAGE,
number=1,
oneof="result",
Expand Down Expand Up @@ -279,17 +281,17 @@ class SpeechEventType(proto.Enum):
SPEECH_EVENT_TYPE_UNSPECIFIED = 0
END_OF_SINGLE_UTTERANCE = 1

error = proto.Field(
error: status_pb2.Status = proto.Field(
proto.MESSAGE,
number=1,
message=status_pb2.Status,
)
result = proto.Field(
result: "StreamingTranslateSpeechResult" = proto.Field(
proto.MESSAGE,
number=2,
message="StreamingTranslateSpeechResult",
)
speech_event_type = proto.Field(
speech_event_type: SpeechEventType = proto.Field(
proto.ENUM,
number=3,
enum=SpeechEventType,
Expand Down
56 changes: 56 additions & 0 deletions packages/google-cloud-media-translation/owlbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
from pathlib import Path
import shutil

import synthtool as s
import synthtool.gcp as gcp
from synthtool.languages import python

# ----------------------------------------------------------------------------
# Copy the generated client from the owl-bot staging directory
# ----------------------------------------------------------------------------

clean_up_generated_samples = True

# Load the default version defined in .repo-metadata.json.
default_version = json.load(open(".repo-metadata.json", "rt")).get(
"default_version"
)

for library in s.get_staging_dirs(default_version):
if clean_up_generated_samples:
shutil.rmtree("samples/generated_samples", ignore_errors=True)
clean_up_generated_samples = False
s.move([library], excludes=["**/gapic_version.py"])
s.remove_staging_dirs()

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------

templated_files = gcp.CommonTemplates().py_library(
cov_level=100,
microgenerator=True,
versions=gcp.common.detect_versions(path="./google", default_first=True),
)
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"])

python.py_samples(skip_readmes=True)

# run format session for all directories which have a noxfile
for noxfile in Path(".").glob("**/noxfile.py"):
s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False)
Loading

0 comments on commit ce2c79a

Please sign in to comment.