From 558585ee92b3e0cebc652ea545da9e225af83b12 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 19 Jan 2022 00:11:10 +0100 Subject: [PATCH 01/13] chore(deps): update dependency google-cloud-speech to v2.12.0 (#307) --- samples/microphone/requirements.txt | 2 +- samples/snippets/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/microphone/requirements.txt b/samples/microphone/requirements.txt index 172facb6..181d568e 100644 --- a/samples/microphone/requirements.txt +++ b/samples/microphone/requirements.txt @@ -1,4 +1,4 @@ -google-cloud-speech==2.11.1 +google-cloud-speech==2.12.0 pyaudio==0.2.11 six==1.16.0 diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index bbdf9107..71b67878 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-speech==2.11.1 +google-cloud-speech==2.12.0 google-cloud-storage==2.0.0 From 84b05b663f8624b66be7d19fbfe2502a5d300152 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 20:32:39 -0500 Subject: [PATCH 02/13] chore(python): Noxfile recognizes that tests can live in a folder (#308) Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/microphone/noxfile.py | 1 + samples/snippets/noxfile.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index eecb84c2..52d79c11 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 + digest: sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 diff --git a/samples/microphone/noxfile.py b/samples/microphone/noxfile.py index 3bbef5d5..20cdfc62 100644 --- a/samples/microphone/noxfile.py +++ b/samples/microphone/noxfile.py @@ -187,6 +187,7 @@ def _session_tests( ) -> None: # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + test_list.extend(glob.glob("tests")) if len(test_list) == 0: print("No tests found, skipping directory.") else: diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 3bbef5d5..20cdfc62 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -187,6 +187,7 @@ def _session_tests( ) -> None: # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + test_list.extend(glob.glob("tests")) if len(test_list) == 0: print("No tests found, skipping directory.") else: From fa896bed53e4a844410133648848a85a19a8b291 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 20 Jan 2022 09:07:19 -0500 Subject: [PATCH 03/13] ci(python): run lint / unit tests / docs as GH actions (#310) * ci(python): run lint / unit tests / docs as GH actions Source-Link: https://github.com/googleapis/synthtool/commit/57be0cdb0b94e1669cee0ca38d790de1dfdbcd44 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 * add commit to trigger gh actions Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 16 +++++++++- .github/workflows/docs.yml | 38 +++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++++ .github/workflows/unittest.yml | 57 ++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 52d79c11..b668c04d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,17 @@ +# 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. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 + digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..f7b8344c --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - main +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..1e8b05c3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - main +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 00000000..074ee250 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - main +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=100 From b8888edd4dc9560304d87755a9c19d845c6ca60a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 22 Jan 2022 09:53:40 -0500 Subject: [PATCH 04/13] chore(python): set coverage level to 100% (#311) * chore(python): use cov_level in unittest gh action Source-Link: https://github.com/googleapis/synthtool/commit/e5aaa84b1dda1829c54d4696827817f133ed9780 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 * set coverage to 100% Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 3 +-- noxfile.py | 2 +- owlbot.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b668c04d..39ad3cec 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 - + digest: sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 diff --git a/noxfile.py b/noxfile.py index de41c6bf..2a2001c4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -175,7 +175,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=99") + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") diff --git a/owlbot.py b/owlbot.py index 2b1152a9..c2d71c6b 100644 --- a/owlbot.py +++ b/owlbot.py @@ -55,7 +55,7 @@ class SpeechClient(SpeechHelpers, SpeechClient): templated_files = common.py_library( samples=True, # set to True only if there are samples microgenerator=True, - cov_level=99, + cov_level=100, ) s.move( templated_files, excludes=[".coveragerc"] From 64a62b33b3b9ae09d5834e9aefc7802d3220ba15 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:08:04 -0700 Subject: [PATCH 05/13] chore: make samples 3.6 check optional (#312) --- .github/sync-repo-settings.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 3e98ae70..37438d33 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -10,6 +10,5 @@ branchProtectionRules: - 'Kokoro' - 'cla/google' - 'Samples - Lint' - - 'Samples - Python 3.6' - 'Samples - Python 3.7' - 'Samples - Python 3.8' From 86fe8ea626c95b9dd98345777739013b9fd1b0f3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 10:23:45 -0500 Subject: [PATCH 06/13] feat: add api key support (#313) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: upgrade gapic-generator-java, gax-java and gapic-generator-python PiperOrigin-RevId: 423842556 Source-Link: https://github.com/googleapis/googleapis/commit/a616ca08f4b1416abbac7bc5dd6d61c791756a81 Source-Link: https://github.com/googleapis/googleapis-gen/commit/29b938c58c1e51d019f2ee539d55dc0a3c86a905 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjliOTM4YzU4YzFlNTFkMDE5ZjJlZTUzOWQ1NWRjMGEzYzg2YTkwNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../speech_v1/services/speech/async_client.py | 37 +++++ .../cloud/speech_v1/services/speech/client.py | 127 ++++++++++++------ .../services/adaptation/async_client.py | 38 +++++- .../services/adaptation/client.py | 127 ++++++++++++------ .../services/speech/async_client.py | 37 +++++ .../services/speech/client.py | 127 ++++++++++++------ tests/unit/gapic/speech_v1/test_speech.py | 122 +++++++++++++++++ .../gapic/speech_v1p1beta1/test_adaptation.py | 124 +++++++++++++++++ .../gapic/speech_v1p1beta1/test_speech.py | 122 +++++++++++++++++ 9 files changed, 731 insertions(+), 130 deletions(-) diff --git a/google/cloud/speech_v1/services/speech/async_client.py b/google/cloud/speech_v1/services/speech/async_client.py index fc6976e3..b141bac6 100644 --- a/google/cloud/speech_v1/services/speech/async_client.py +++ b/google/cloud/speech_v1/services/speech/async_client.py @@ -18,6 +18,7 @@ import re from typing import ( Dict, + Optional, AsyncIterable, Awaitable, AsyncIterator, @@ -110,6 +111,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return SpeechClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> SpeechTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/speech_v1/services/speech/client.py b/google/cloud/speech_v1/services/speech/client.py index 94879ecd..53a1c526 100644 --- a/google/cloud/speech_v1/services/speech/client.py +++ b/google/cloud/speech_v1/services/speech/client.py @@ -251,6 +251,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -301,57 +368,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, SpeechTransport): # transport is a SpeechTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -363,6 +395,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py index e3c91e76..ad6b58b8 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -104,6 +104,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return AdaptationClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> AdaptationTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/client.py b/google/cloud/speech_v1p1beta1/services/adaptation/client.py index d0d8f699..684e5632 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/client.py @@ -250,6 +250,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -300,57 +367,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, AdaptationTransport): # transport is a AdaptationTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -362,6 +394,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, diff --git a/google/cloud/speech_v1p1beta1/services/speech/async_client.py b/google/cloud/speech_v1p1beta1/services/speech/async_client.py index cd931499..d12d919c 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/async_client.py @@ -18,6 +18,7 @@ import re from typing import ( Dict, + Optional, AsyncIterable, Awaitable, AsyncIterator, @@ -110,6 +111,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return SpeechClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> SpeechTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/speech_v1p1beta1/services/speech/client.py b/google/cloud/speech_v1p1beta1/services/speech/client.py index 8d973cb5..6cdeb113 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/client.py @@ -251,6 +251,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -301,57 +368,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, SpeechTransport): # transport is a SpeechTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -363,6 +395,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, diff --git a/tests/unit/gapic/speech_v1/test_speech.py b/tests/unit/gapic/speech_v1/test_speech.py index 54afc385..c87cee4c 100644 --- a/tests/unit/gapic/speech_v1/test_speech.py +++ b/tests/unit/gapic/speech_v1/test_speech.py @@ -376,6 +376,81 @@ def test_speech_client_mtls_env_auto( ) +@pytest.mark.parametrize("client_class", [SpeechClient, SpeechAsyncClient]) +@mock.patch.object( + SpeechClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SpeechClient) +) +@mock.patch.object( + SpeechAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SpeechAsyncClient) +) +def test_speech_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -891,6 +966,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.SpeechGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = SpeechClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = SpeechClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.SpeechGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -1490,3 +1582,33 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (SpeechClient, transports.SpeechGrpcTransport), + (SpeechAsyncClient, transports.SpeechGrpcAsyncIOTransport), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py b/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py index 0601620b..2c30a9ec 100644 --- a/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py +++ b/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py @@ -386,6 +386,83 @@ def test_adaptation_client_mtls_env_auto( ) +@pytest.mark.parametrize("client_class", [AdaptationClient, AdaptationAsyncClient]) +@mock.patch.object( + AdaptationClient, "DEFAULT_ENDPOINT", modify_default_endpoint(AdaptationClient) +) +@mock.patch.object( + AdaptationAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(AdaptationAsyncClient), +) +def test_adaptation_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -2970,6 +3047,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.AdaptationGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = AdaptationClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = AdaptationClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.AdaptationGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -3545,3 +3639,33 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (AdaptationClient, transports.AdaptationGrpcTransport), + (AdaptationAsyncClient, transports.AdaptationGrpcAsyncIOTransport), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/speech_v1p1beta1/test_speech.py b/tests/unit/gapic/speech_v1p1beta1/test_speech.py index 5518ca0e..e2143eaf 100644 --- a/tests/unit/gapic/speech_v1p1beta1/test_speech.py +++ b/tests/unit/gapic/speech_v1p1beta1/test_speech.py @@ -376,6 +376,81 @@ def test_speech_client_mtls_env_auto( ) +@pytest.mark.parametrize("client_class", [SpeechClient, SpeechAsyncClient]) +@mock.patch.object( + SpeechClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SpeechClient) +) +@mock.patch.object( + SpeechAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(SpeechAsyncClient) +) +def test_speech_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -891,6 +966,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.SpeechGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = SpeechClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = SpeechClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.SpeechGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -1490,3 +1582,33 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (SpeechClient, transports.SpeechGrpcTransport), + (SpeechAsyncClient, transports.SpeechGrpcAsyncIOTransport), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) From 1348765cbf8d682ba49983a3e991cb408d59171e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 20:27:47 -0500 Subject: [PATCH 07/13] fix: resolve DuplicateCredentialArgs error when using credentials_file (#318) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: parthea PiperOrigin-RevId: 425964861 Source-Link: https://github.com/googleapis/googleapis/commit/84b1a5a4f6fb2d04905be58e586b8a7a4310a8cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/4fb761bbd8506ac156f49bac5f18306aa8eb3aa8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../speech_v1/services/speech/async_client.py | 4 +- .../cloud/speech_v1/services/speech/client.py | 4 +- .../services/speech/transports/grpc.py | 7 +- .../speech/transports/grpc_asyncio.py | 7 +- .../services/adaptation/async_client.py | 20 ++--- .../services/adaptation/client.py | 20 ++--- .../services/adaptation/transports/grpc.py | 5 +- .../adaptation/transports/grpc_asyncio.py | 5 +- .../services/speech/async_client.py | 4 +- .../services/speech/client.py | 4 +- .../services/speech/transports/grpc.py | 7 +- .../speech/transports/grpc_asyncio.py | 7 +- tests/unit/gapic/speech_v1/test_speech.py | 76 ++++++++++++++++++- .../gapic/speech_v1p1beta1/test_adaptation.py | 69 ++++++++++++++++- .../gapic/speech_v1p1beta1/test_speech.py | 76 ++++++++++++++++++- 15 files changed, 266 insertions(+), 49 deletions(-) diff --git a/google/cloud/speech_v1/services/speech/async_client.py b/google/cloud/speech_v1/services/speech/async_client.py index b141bac6..6dff633f 100644 --- a/google/cloud/speech_v1/services/speech/async_client.py +++ b/google/cloud/speech_v1/services/speech/async_client.py @@ -253,7 +253,7 @@ async def recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: @@ -350,7 +350,7 @@ async def long_running_recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: diff --git a/google/cloud/speech_v1/services/speech/client.py b/google/cloud/speech_v1/services/speech/client.py index 53a1c526..eebe295b 100644 --- a/google/cloud/speech_v1/services/speech/client.py +++ b/google/cloud/speech_v1/services/speech/client.py @@ -462,7 +462,7 @@ def recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: @@ -549,7 +549,7 @@ def long_running_recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: diff --git a/google/cloud/speech_v1/services/speech/transports/grpc.py b/google/cloud/speech_v1/services/speech/transports/grpc.py index f788b693..d77ef0e8 100644 --- a/google/cloud/speech_v1/services/speech/transports/grpc.py +++ b/google/cloud/speech_v1/services/speech/transports/grpc.py @@ -161,8 +161,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -235,7 +238,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsClient(self.grpc_channel) diff --git a/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py b/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py index 6069826d..faf20e54 100644 --- a/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py +++ b/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py @@ -206,8 +206,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -237,7 +240,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py index ad6b58b8..2d969647 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py @@ -266,7 +266,7 @@ async def create_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, phrase_set, phrase_set_id]) if request is not None and has_flattened_params: @@ -351,7 +351,7 @@ async def get_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -434,7 +434,7 @@ async def list_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -529,7 +529,7 @@ async def update_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([phrase_set, update_mask]) if request is not None and has_flattened_params: @@ -599,7 +599,7 @@ async def delete_phrase_set( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -701,7 +701,7 @@ async def create_custom_class( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, custom_class, custom_class_id]) if request is not None and has_flattened_params: @@ -783,7 +783,7 @@ async def get_custom_class( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -866,7 +866,7 @@ async def list_custom_classes( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -965,7 +965,7 @@ async def update_custom_class( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([custom_class, update_mask]) if request is not None and has_flattened_params: @@ -1043,7 +1043,7 @@ async def delete_custom_class( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/client.py b/google/cloud/speech_v1p1beta1/services/adaptation/client.py index 684e5632..6ba63177 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/client.py @@ -481,7 +481,7 @@ def create_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, phrase_set, phrase_set_id]) if request is not None and has_flattened_params: @@ -566,7 +566,7 @@ def get_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -649,7 +649,7 @@ def list_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -744,7 +744,7 @@ def update_phrase_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([phrase_set, update_mask]) if request is not None and has_flattened_params: @@ -814,7 +814,7 @@ def delete_phrase_set( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -916,7 +916,7 @@ def create_custom_class( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, custom_class, custom_class_id]) if request is not None and has_flattened_params: @@ -998,7 +998,7 @@ def get_custom_class( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1081,7 +1081,7 @@ def list_custom_classes( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1180,7 +1180,7 @@ def update_custom_class( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([custom_class, update_mask]) if request is not None and has_flattened_params: @@ -1258,7 +1258,7 @@ def delete_custom_class( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py index 081655d1..71e19e7f 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py @@ -160,8 +160,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py index 5bb1c88f..f6fa38a3 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py @@ -205,8 +205,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/speech_v1p1beta1/services/speech/async_client.py b/google/cloud/speech_v1p1beta1/services/speech/async_client.py index d12d919c..c8edb1cc 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/async_client.py @@ -253,7 +253,7 @@ async def recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: @@ -350,7 +350,7 @@ async def long_running_recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: diff --git a/google/cloud/speech_v1p1beta1/services/speech/client.py b/google/cloud/speech_v1p1beta1/services/speech/client.py index 6cdeb113..9700bc79 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/client.py @@ -462,7 +462,7 @@ def recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: @@ -549,7 +549,7 @@ def long_running_recognize( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([config, audio]) if request is not None and has_flattened_params: diff --git a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py index 1a5ffc82..243a248d 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py +++ b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py @@ -161,8 +161,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -235,7 +238,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsClient(self.grpc_channel) diff --git a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py index 666eff0c..b43fdf0e 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py +++ b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py @@ -206,8 +206,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -237,7 +240,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel diff --git a/tests/unit/gapic/speech_v1/test_speech.py b/tests/unit/gapic/speech_v1/test_speech.py index c87cee4c..c3fe28b0 100644 --- a/tests/unit/gapic/speech_v1/test_speech.py +++ b/tests/unit/gapic/speech_v1/test_speech.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import operation from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 from google.api_core import path_template @@ -479,17 +480,23 @@ def test_speech_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (SpeechClient, transports.SpeechGrpcTransport, "grpc"), - (SpeechAsyncClient, transports.SpeechGrpcAsyncIOTransport, "grpc_asyncio"), + (SpeechClient, transports.SpeechGrpcTransport, "grpc", grpc_helpers), + ( + SpeechAsyncClient, + transports.SpeechGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), ], ) def test_speech_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -523,6 +530,67 @@ def test_speech_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + (SpeechClient, transports.SpeechGrpcTransport, "grpc", grpc_helpers), + ( + SpeechAsyncClient, + transports.SpeechGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_speech_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "speech.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="speech.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [cloud_speech.RecognizeRequest, dict,]) def test_recognize(request_type, transport: str = "grpc"): client = SpeechClient( diff --git a/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py b/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py index 2c30a9ec..df2bdb04 100644 --- a/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py +++ b/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py @@ -495,21 +495,23 @@ def test_adaptation_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (AdaptationClient, transports.AdaptationGrpcTransport, "grpc"), + (AdaptationClient, transports.AdaptationGrpcTransport, "grpc", grpc_helpers), ( AdaptationAsyncClient, transports.AdaptationGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_adaptation_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -543,6 +545,67 @@ def test_adaptation_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + (AdaptationClient, transports.AdaptationGrpcTransport, "grpc", grpc_helpers), + ( + AdaptationAsyncClient, + transports.AdaptationGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_adaptation_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "speech.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="speech.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "request_type", [cloud_speech_adaptation.CreatePhraseSetRequest, dict,] ) diff --git a/tests/unit/gapic/speech_v1p1beta1/test_speech.py b/tests/unit/gapic/speech_v1p1beta1/test_speech.py index e2143eaf..bd0471c2 100644 --- a/tests/unit/gapic/speech_v1p1beta1/test_speech.py +++ b/tests/unit/gapic/speech_v1p1beta1/test_speech.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import operation from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 from google.api_core import path_template @@ -479,17 +480,23 @@ def test_speech_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (SpeechClient, transports.SpeechGrpcTransport, "grpc"), - (SpeechAsyncClient, transports.SpeechGrpcAsyncIOTransport, "grpc_asyncio"), + (SpeechClient, transports.SpeechGrpcTransport, "grpc", grpc_helpers), + ( + SpeechAsyncClient, + transports.SpeechGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), ], ) def test_speech_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -523,6 +530,67 @@ def test_speech_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + (SpeechClient, transports.SpeechGrpcTransport, "grpc", grpc_helpers), + ( + SpeechAsyncClient, + transports.SpeechGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_speech_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "speech.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="speech.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [cloud_speech.RecognizeRequest, dict,]) def test_recognize(request_type, transport: str = "grpc"): client = SpeechClient( From ca99f96d081eed4d2d1409fc5e688a243fa78ae3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:12:54 -0700 Subject: [PATCH 08/13] docs: add generated snippets (#321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: https://github.com/googleapis/googleapis/commit/55b9e1e0b3106c850d13958352bc0751147b6b15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../speech_v1/services/speech/async_client.py | 92 ++ .../cloud/speech_v1/services/speech/client.py | 95 ++ .../services/adaptation/async_client.py | 187 +++ .../services/adaptation/client.py | 197 +++ .../services/speech/async_client.py | 92 ++ .../services/speech/client.py | 95 ++ .../snippet_metadata_speech_v1.json | 271 ++++ .../snippet_metadata_speech_v1p1beta1.json | 1153 +++++++++++++++++ ..._v1_speech_long_running_recognize_async.py | 56 + ...h_v1_speech_long_running_recognize_sync.py | 56 + ...erated_speech_v1_speech_recognize_async.py | 52 + ...nerated_speech_v1_speech_recognize_sync.py | 52 + ...ech_v1_speech_streaming_recognize_async.py | 59 + ...eech_v1_speech_streaming_recognize_sync.py | 59 + ...a1_adaptation_create_custom_class_async.py | 46 + ...ta1_adaptation_create_custom_class_sync.py | 46 + ...eta1_adaptation_create_phrase_set_async.py | 46 + ...beta1_adaptation_create_phrase_set_sync.py | 46 + ...a1_adaptation_delete_custom_class_async.py | 43 + ...ta1_adaptation_delete_custom_class_sync.py | 43 + ...eta1_adaptation_delete_phrase_set_async.py | 43 + ...beta1_adaptation_delete_phrase_set_sync.py | 43 + ...beta1_adaptation_get_custom_class_async.py | 45 + ...1beta1_adaptation_get_custom_class_sync.py | 45 + ...p1beta1_adaptation_get_phrase_set_async.py | 45 + ...1p1beta1_adaptation_get_phrase_set_sync.py | 45 + ...a1_adaptation_list_custom_classes_async.py | 46 + ...ta1_adaptation_list_custom_classes_sync.py | 46 + ...1beta1_adaptation_list_phrase_set_async.py | 46 + ...p1beta1_adaptation_list_phrase_set_sync.py | 46 + ...a1_adaptation_update_custom_class_async.py | 44 + ...ta1_adaptation_update_custom_class_sync.py | 44 + ...eta1_adaptation_update_phrase_set_async.py | 44 + ...beta1_adaptation_update_phrase_set_sync.py | 44 + ...ta1_speech_long_running_recognize_async.py | 56 + ...eta1_speech_long_running_recognize_sync.py | 56 + ...speech_v1p1beta1_speech_recognize_async.py | 52 + ..._speech_v1p1beta1_speech_recognize_sync.py | 52 + ...1beta1_speech_streaming_recognize_async.py | 59 + ...p1beta1_speech_streaming_recognize_sync.py | 59 + 40 files changed, 3746 insertions(+) create mode 100644 samples/generated_samples/snippet_metadata_speech_v1.json create mode 100644 samples/generated_samples/snippet_metadata_speech_v1p1beta1.json create mode 100644 samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py create mode 100644 samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py diff --git a/google/cloud/speech_v1/services/speech/async_client.py b/google/cloud/speech_v1/services/speech/async_client.py index 6dff633f..f35455f9 100644 --- a/google/cloud/speech_v1/services/speech/async_client.py +++ b/google/cloud/speech_v1/services/speech/async_client.py @@ -220,6 +220,33 @@ async def recognize( r"""Performs synchronous speech recognition: receive results after all audio has been sent and processed. + + .. code-block:: + + from google.cloud import speech_v1 + + def sample_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = client.recognize(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1.types.RecognizeRequest, dict]): The request object. The top-level message sent by the @@ -312,6 +339,37 @@ async def long_running_recognize( on asynchronous speech recognition, see the `how-to `__. + + .. code-block:: + + from google.cloud import speech_v1 + + def sample_long_running_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1.types.LongRunningRecognizeRequest, dict]): The request object. The top-level message sent by the @@ -402,6 +460,40 @@ def streaming_recognize( receive results while sending audio. This method is only available via the gRPC API (not REST). + + .. code-block:: + + from google.cloud import speech_v1 + + def sample_streaming_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + streaming_config = speech_v1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.streaming_recognize(requests=request_generator()) + + # Handle the response + for response in stream: + print(response) + Args: requests (AsyncIterator[`google.cloud.speech_v1.types.StreamingRecognizeRequest`]): The request object AsyncIterator. The top-level message sent by the diff --git a/google/cloud/speech_v1/services/speech/client.py b/google/cloud/speech_v1/services/speech/client.py index eebe295b..423ff191 100644 --- a/google/cloud/speech_v1/services/speech/client.py +++ b/google/cloud/speech_v1/services/speech/client.py @@ -429,6 +429,34 @@ def recognize( r"""Performs synchronous speech recognition: receive results after all audio has been sent and processed. + + + .. code-block:: + + from google.cloud import speech_v1 + + def sample_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = client.recognize(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1.types.RecognizeRequest, dict]): The request object. The top-level message sent by the @@ -511,6 +539,38 @@ def long_running_recognize( on asynchronous speech recognition, see the `how-to `__. + + + .. code-block:: + + from google.cloud import speech_v1 + + def sample_long_running_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1.types.LongRunningRecognizeRequest, dict]): The request object. The top-level message sent by the @@ -601,6 +661,41 @@ def streaming_recognize( receive results while sending audio. This method is only available via the gRPC API (not REST). + + + .. code-block:: + + from google.cloud import speech_v1 + + def sample_streaming_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + streaming_config = speech_v1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.streaming_recognize(requests=request_generator()) + + # Handle the response + for response in stream: + print(response) + Args: requests (Iterator[google.cloud.speech_v1.types.StreamingRecognizeRequest]): The request object iterator. The top-level message sent by the diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py index 2d969647..91b36126 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py @@ -216,6 +216,27 @@ async def create_phrase_set( in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_create_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreatePhraseSetRequest( + parent="parent_value", + phrase_set_id="phrase_set_id_value", + ) + + # Make the request + response = client.create_phrase_set(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.CreatePhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -317,6 +338,25 @@ async def get_phrase_set( ) -> resource.PhraseSet: r"""Get a phrase set. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_get_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetPhraseSetRequest( + name="name_value", + ) + + # Make the request + response = client.get_phrase_set(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.GetPhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -398,6 +438,26 @@ async def list_phrase_set( ) -> pagers.ListPhraseSetAsyncPager: r"""List phrase sets. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_list_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListPhraseSetRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_phrase_set(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.ListPhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -488,6 +548,24 @@ async def update_phrase_set( ) -> resource.PhraseSet: r"""Update a phrase set. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_update_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdatePhraseSetRequest( + ) + + # Make the request + response = client.update_phrase_set(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.UpdatePhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -580,6 +658,22 @@ async def delete_phrase_set( ) -> None: r"""Delete a phrase set. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_delete_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeletePhraseSetRequest( + name="name_value", + ) + + # Make the request + client.delete_phrase_set(request=request) + Args: request (Union[google.cloud.speech_v1p1beta1.types.DeletePhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -647,6 +741,26 @@ async def create_custom_class( ) -> resource.CustomClass: r"""Create a custom class. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_create_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreateCustomClassRequest( + parent="parent_value", + custom_class_id="custom_class_id_value", + ) + + # Make the request + response = client.create_custom_class(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.CreateCustomClassRequest, dict]): The request object. Message sent by the client for the @@ -752,6 +866,25 @@ async def get_custom_class( ) -> resource.CustomClass: r"""Get a custom class. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_get_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetCustomClassRequest( + name="name_value", + ) + + # Make the request + response = client.get_custom_class(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.GetCustomClassRequest, dict]): The request object. Message sent by the client for the @@ -830,6 +963,26 @@ async def list_custom_classes( ) -> pagers.ListCustomClassesAsyncPager: r"""List custom classes. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_list_custom_classes(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListCustomClassesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_custom_classes(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.ListCustomClassesRequest, dict]): The request object. Message sent by the client for the @@ -920,6 +1073,24 @@ async def update_custom_class( ) -> resource.CustomClass: r"""Update a custom class. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_update_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdateCustomClassRequest( + ) + + # Make the request + response = client.update_custom_class(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.UpdateCustomClassRequest, dict]): The request object. Message sent by the client for the @@ -1016,6 +1187,22 @@ async def delete_custom_class( ) -> None: r"""Delete a custom class. + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_delete_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeleteCustomClassRequest( + name="name_value", + ) + + # Make the request + client.delete_custom_class(request=request) + Args: request (Union[google.cloud.speech_v1p1beta1.types.DeleteCustomClassRequest, dict]): The request object. Message sent by the client for the diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/client.py b/google/cloud/speech_v1p1beta1/services/adaptation/client.py index 6ba63177..a9a04d6b 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/client.py @@ -431,6 +431,28 @@ def create_phrase_set( in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet. + + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_create_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreatePhraseSetRequest( + parent="parent_value", + phrase_set_id="phrase_set_id_value", + ) + + # Make the request + response = client.create_phrase_set(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.CreatePhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -532,6 +554,26 @@ def get_phrase_set( ) -> resource.PhraseSet: r"""Get a phrase set. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_get_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetPhraseSetRequest( + name="name_value", + ) + + # Make the request + response = client.get_phrase_set(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.GetPhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -613,6 +655,27 @@ def list_phrase_set( ) -> pagers.ListPhraseSetPager: r"""List phrase sets. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_list_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListPhraseSetRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_phrase_set(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.ListPhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -703,6 +766,25 @@ def update_phrase_set( ) -> resource.PhraseSet: r"""Update a phrase set. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_update_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdatePhraseSetRequest( + ) + + # Make the request + response = client.update_phrase_set(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.UpdatePhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -795,6 +877,23 @@ def delete_phrase_set( ) -> None: r"""Delete a phrase set. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_delete_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeletePhraseSetRequest( + name="name_value", + ) + + # Make the request + client.delete_phrase_set(request=request) + Args: request (Union[google.cloud.speech_v1p1beta1.types.DeletePhraseSetRequest, dict]): The request object. Message sent by the client for the @@ -862,6 +961,27 @@ def create_custom_class( ) -> resource.CustomClass: r"""Create a custom class. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_create_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreateCustomClassRequest( + parent="parent_value", + custom_class_id="custom_class_id_value", + ) + + # Make the request + response = client.create_custom_class(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.CreateCustomClassRequest, dict]): The request object. Message sent by the client for the @@ -967,6 +1087,26 @@ def get_custom_class( ) -> resource.CustomClass: r"""Get a custom class. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_get_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetCustomClassRequest( + name="name_value", + ) + + # Make the request + response = client.get_custom_class(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.GetCustomClassRequest, dict]): The request object. Message sent by the client for the @@ -1045,6 +1185,27 @@ def list_custom_classes( ) -> pagers.ListCustomClassesPager: r"""List custom classes. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_list_custom_classes(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListCustomClassesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_custom_classes(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.ListCustomClassesRequest, dict]): The request object. Message sent by the client for the @@ -1135,6 +1296,25 @@ def update_custom_class( ) -> resource.CustomClass: r"""Update a custom class. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_update_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdateCustomClassRequest( + ) + + # Make the request + response = client.update_custom_class(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.UpdateCustomClassRequest, dict]): The request object. Message sent by the client for the @@ -1231,6 +1411,23 @@ def delete_custom_class( ) -> None: r"""Delete a custom class. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_delete_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeleteCustomClassRequest( + name="name_value", + ) + + # Make the request + client.delete_custom_class(request=request) + Args: request (Union[google.cloud.speech_v1p1beta1.types.DeleteCustomClassRequest, dict]): The request object. Message sent by the client for the diff --git a/google/cloud/speech_v1p1beta1/services/speech/async_client.py b/google/cloud/speech_v1p1beta1/services/speech/async_client.py index c8edb1cc..bc114ada 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/async_client.py @@ -220,6 +220,33 @@ async def recognize( r"""Performs synchronous speech recognition: receive results after all audio has been sent and processed. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = client.recognize(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.RecognizeRequest, dict]): The request object. The top-level message sent by the @@ -312,6 +339,37 @@ async def long_running_recognize( on asynchronous speech recognition, see the `how-to `__. + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_long_running_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.LongRunningRecognizeRequest, dict]): The request object. The top-level message sent by the @@ -402,6 +460,40 @@ def streaming_recognize( receive results while sending audio. This method is only available via the gRPC API (not REST). + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_streaming_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + streaming_config = speech_v1p1beta1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1p1beta1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1p1beta1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.streaming_recognize(requests=request_generator()) + + # Handle the response + for response in stream: + print(response) + Args: requests (AsyncIterator[`google.cloud.speech_v1p1beta1.types.StreamingRecognizeRequest`]): The request object AsyncIterator. The top-level message sent by the diff --git a/google/cloud/speech_v1p1beta1/services/speech/client.py b/google/cloud/speech_v1p1beta1/services/speech/client.py index 9700bc79..3ceedd12 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/client.py @@ -429,6 +429,34 @@ def recognize( r"""Performs synchronous speech recognition: receive results after all audio has been sent and processed. + + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = client.recognize(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.RecognizeRequest, dict]): The request object. The top-level message sent by the @@ -511,6 +539,38 @@ def long_running_recognize( on asynchronous speech recognition, see the `how-to `__. + + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_long_running_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.speech_v1p1beta1.types.LongRunningRecognizeRequest, dict]): The request object. The top-level message sent by the @@ -601,6 +661,41 @@ def streaming_recognize( receive results while sending audio. This method is only available via the gRPC API (not REST). + + + .. code-block:: + + from google.cloud import speech_v1p1beta1 + + def sample_streaming_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + streaming_config = speech_v1p1beta1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1p1beta1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1p1beta1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.streaming_recognize(requests=request_generator()) + + # Handle the response + for response in stream: + print(response) + Args: requests (Iterator[google.cloud.speech_v1p1beta1.types.StreamingRecognizeRequest]): The request object iterator. The top-level message sent by the diff --git a/samples/generated_samples/snippet_metadata_speech_v1.json b/samples/generated_samples/snippet_metadata_speech_v1.json new file mode 100644 index 00000000..af739627 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_speech_v1.json @@ -0,0 +1,271 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "LongRunningRecognize" + } + }, + "file": "speech_generated_speech_v1_speech_long_running_recognize_async.py", + "regionTag": "speech_generated_speech_v1_Speech_LongRunningRecognize_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "LongRunningRecognize" + } + }, + "file": "speech_generated_speech_v1_speech_long_running_recognize_sync.py", + "regionTag": "speech_generated_speech_v1_Speech_LongRunningRecognize_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "Recognize" + } + }, + "file": "speech_generated_speech_v1_speech_recognize_async.py", + "regionTag": "speech_generated_speech_v1_Speech_Recognize_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "Recognize" + } + }, + "file": "speech_generated_speech_v1_speech_recognize_sync.py", + "regionTag": "speech_generated_speech_v1_Speech_Recognize_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "StreamingRecognize" + } + }, + "file": "speech_generated_speech_v1_speech_streaming_recognize_async.py", + "regionTag": "speech_generated_speech_v1_Speech_StreamingRecognize_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 54, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 55, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "StreamingRecognize" + } + }, + "file": "speech_generated_speech_v1_speech_streaming_recognize_sync.py", + "regionTag": "speech_generated_speech_v1_Speech_StreamingRecognize_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 54, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 55, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json b/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json new file mode 100644 index 00000000..3f7adc12 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json @@ -0,0 +1,1153 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "CreateCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "CreateCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "CreatePhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "CreatePhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "DeleteCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "DeleteCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "DeletePhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "DeletePhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "GetCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "GetCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "GetPhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "GetPhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "ListCustomClasses" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "ListCustomClasses" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "ListPhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "ListPhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "UpdateCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "UpdateCustomClass" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "UpdatePhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Adaptation" + }, + "shortName": "UpdatePhraseSet" + } + }, + "file": "speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "LongRunningRecognize" + } + }, + "file": "speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "LongRunningRecognize" + } + }, + "file": "speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "Recognize" + } + }, + "file": "speech_generated_speech_v1p1beta1_speech_recognize_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Speech_Recognize_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "Recognize" + } + }, + "file": "speech_generated_speech_v1p1beta1_speech_recognize_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Speech_Recognize_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "StreamingRecognize" + } + }, + "file": "speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py", + "regionTag": "speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 54, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 55, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Speech" + }, + "shortName": "StreamingRecognize" + } + }, + "file": "speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py", + "regionTag": "speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 54, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 55, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py b/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py new file mode 100644 index 00000000..cd9eb097 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LongRunningRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1_Speech_LongRunningRecognize_async] +from google.cloud import speech_v1 + + +async def sample_long_running_recognize(): + # Create a client + client = speech_v1.SpeechAsyncClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END speech_generated_speech_v1_Speech_LongRunningRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py b/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py new file mode 100644 index 00000000..ccea1cb5 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LongRunningRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1_Speech_LongRunningRecognize_sync] +from google.cloud import speech_v1 + + +def sample_long_running_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END speech_generated_speech_v1_Speech_LongRunningRecognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py b/samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py new file mode 100644 index 00000000..bbfbcb6f --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Recognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1_Speech_Recognize_async] +from google.cloud import speech_v1 + + +async def sample_recognize(): + # Create a client + client = speech_v1.SpeechAsyncClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = await client.recognize(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1_Speech_Recognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py b/samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py new file mode 100644 index 00000000..8698fe98 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Recognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1_Speech_Recognize_sync] +from google.cloud import speech_v1 + + +def sample_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = client.recognize(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1_Speech_Recognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py b/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py new file mode 100644 index 00000000..acec2c76 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StreamingRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1_Speech_StreamingRecognize_async] +from google.cloud import speech_v1 + + +async def sample_streaming_recognize(): + # Create a client + client = speech_v1.SpeechAsyncClient() + + # Initialize request argument(s) + streaming_config = speech_v1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = await client.streaming_recognize(requests=request_generator()) + + # Handle the response + async for response in stream: + print(response) + +# [END speech_generated_speech_v1_Speech_StreamingRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py b/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py new file mode 100644 index 00000000..5d1335b0 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StreamingRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1_Speech_StreamingRecognize_sync] +from google.cloud import speech_v1 + + +def sample_streaming_recognize(): + # Create a client + client = speech_v1.SpeechClient() + + # Initialize request argument(s) + streaming_config = speech_v1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.streaming_recognize(requests=request_generator()) + + # Handle the response + for response in stream: + print(response) + +# [END speech_generated_speech_v1_Speech_StreamingRecognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py new file mode 100644 index 00000000..64ba623e --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_create_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreateCustomClassRequest( + parent="parent_value", + custom_class_id="custom_class_id_value", + ) + + # Make the request + response = await client.create_custom_class(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py new file mode 100644 index 00000000..45d45a69 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_create_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreateCustomClassRequest( + parent="parent_value", + custom_class_id="custom_class_id_value", + ) + + # Make the request + response = client.create_custom_class(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py new file mode 100644 index 00000000..c0434772 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreatePhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_create_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreatePhraseSetRequest( + parent="parent_value", + phrase_set_id="phrase_set_id_value", + ) + + # Make the request + response = await client.create_phrase_set(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py new file mode 100644 index 00000000..22d63ba8 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreatePhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_create_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.CreatePhraseSetRequest( + parent="parent_value", + phrase_set_id="phrase_set_id_value", + ) + + # Make the request + response = client.create_phrase_set(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py new file mode 100644 index 00000000..faecb648 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_delete_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeleteCustomClassRequest( + name="name_value", + ) + + # Make the request + await client.delete_custom_class(request=request) + + +# [END speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py new file mode 100644 index 00000000..ccf9ae9b --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_delete_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeleteCustomClassRequest( + name="name_value", + ) + + # Make the request + client.delete_custom_class(request=request) + + +# [END speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py new file mode 100644 index 00000000..afdfae18 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_delete_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeletePhraseSetRequest( + name="name_value", + ) + + # Make the request + await client.delete_phrase_set(request=request) + + +# [END speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py new file mode 100644 index 00000000..7b2b6f28 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_delete_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.DeletePhraseSetRequest( + name="name_value", + ) + + # Make the request + client.delete_phrase_set(request=request) + + +# [END speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py new file mode 100644 index 00000000..ea205ee2 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_get_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetCustomClassRequest( + name="name_value", + ) + + # Make the request + response = await client.get_custom_class(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py new file mode 100644 index 00000000..bde42339 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_get_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetCustomClassRequest( + name="name_value", + ) + + # Make the request + response = client.get_custom_class(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py new file mode 100644 index 00000000..d62a8878 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_get_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetPhraseSetRequest( + name="name_value", + ) + + # Make the request + response = await client.get_phrase_set(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py new file mode 100644 index 00000000..e16302c4 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_get_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.GetPhraseSetRequest( + name="name_value", + ) + + # Make the request + response = client.get_phrase_set(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py new file mode 100644 index 00000000..d2a70042 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCustomClasses +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_list_custom_classes(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListCustomClassesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_custom_classes(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py new file mode 100644 index 00000000..8dc585b3 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCustomClasses +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_list_custom_classes(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListCustomClassesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_custom_classes(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py new file mode 100644 index 00000000..8bbeeb3e --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_list_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListPhraseSetRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_phrase_set(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py new file mode 100644 index 00000000..b8a9b9c9 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_list_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.ListPhraseSetRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_phrase_set(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py new file mode 100644 index 00000000..4d36f405 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_update_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdateCustomClassRequest( + ) + + # Make the request + response = await client.update_custom_class(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py new file mode 100644 index 00000000..e1d1d45d --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCustomClass +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_update_custom_class(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdateCustomClassRequest( + ) + + # Make the request + response = client.update_custom_class(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py new file mode 100644 index 00000000..2f38a614 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdatePhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_update_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationAsyncClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdatePhraseSetRequest( + ) + + # Make the request + response = await client.update_phrase_set(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py new file mode 100644 index 00000000..681fa5e2 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdatePhraseSet +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_update_phrase_set(): + # Create a client + client = speech_v1p1beta1.AdaptationClient() + + # Initialize request argument(s) + request = speech_v1p1beta1.UpdatePhraseSetRequest( + ) + + # Make the request + response = client.update_phrase_set(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py new file mode 100644 index 00000000..43e5233e --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LongRunningRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_long_running_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechAsyncClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py new file mode 100644 index 00000000..c57300c8 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LongRunningRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_long_running_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.LongRunningRecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + operation = client.long_running_recognize(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py new file mode 100644 index 00000000..15854b3e --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Recognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Speech_Recognize_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechAsyncClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = await client.recognize(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Speech_Recognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py new file mode 100644 index 00000000..ad0e884d --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Recognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Speech_Recognize_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + config = speech_v1p1beta1.RecognitionConfig() + config.language_code = "language_code_value" + + audio = speech_v1p1beta1.RecognitionAudio() + audio.content = b'content_blob' + + request = speech_v1p1beta1.RecognizeRequest( + config=config, + audio=audio, + ) + + # Make the request + response = client.recognize(request=request) + + # Handle the response + print(response) + +# [END speech_generated_speech_v1p1beta1_Speech_Recognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py new file mode 100644 index 00000000..ac7daf07 --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StreamingRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_async] +from google.cloud import speech_v1p1beta1 + + +async def sample_streaming_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechAsyncClient() + + # Initialize request argument(s) + streaming_config = speech_v1p1beta1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1p1beta1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1p1beta1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = await client.streaming_recognize(requests=request_generator()) + + # Handle the response + async for response in stream: + print(response) + +# [END speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py new file mode 100644 index 00000000..05b3074a --- /dev/null +++ b/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StreamingRecognize +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-speech + + +# [START speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_sync] +from google.cloud import speech_v1p1beta1 + + +def sample_streaming_recognize(): + # Create a client + client = speech_v1p1beta1.SpeechClient() + + # Initialize request argument(s) + streaming_config = speech_v1p1beta1.StreamingRecognitionConfig() + streaming_config.config.language_code = "language_code_value" + + request = speech_v1p1beta1.StreamingRecognizeRequest( + streaming_config=streaming_config, + ) + + # This method expects an iterator which contains + # 'speech_v1p1beta1.StreamingRecognizeRequest' objects + # Here we create a generator that yields a single `request` for + # demonstrative purposes. + requests = [request] + + def request_generator(): + for request in requests: + yield request + + # Make the request + stream = client.streaming_recognize(requests=request_generator()) + + # Handle the response + for response in stream: + print(response) + +# [END speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_sync] From de6e7c193edeff69376ec94da26c76dbeaa24d36 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 15 Feb 2022 08:52:39 -0700 Subject: [PATCH 09/13] fix(deps): move libcst to extras (#322) --- UPGRADING.md | 4 ++-- setup.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 3d337494..666c0e16 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -17,10 +17,10 @@ The 2.0.0 release requires Python 3.6+. Methods expect request objects. We provide a script that will convert most common use cases. -* Install the library +* Install the library with the `libcst` extra ```py -python3 -m pip install google-cloud-speech +python3 -m pip install google-cloud-speech[libcst] ``` * The scripts `fixup_speech_v1_keywords.py` and `fixup_speech_v1p1beta1_keywords.py` are shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory. diff --git a/setup.py b/setup.py index a07dd1a0..b1b28488 100644 --- a/setup.py +++ b/setup.py @@ -33,10 +33,9 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.28.0, <3.0.0dev", - "libcst >= 0.2.5", "proto-plus >= 1.4.0", ] -extras = {} +extras = {"libcst": "libcst >= 0.2.5"} # Setup boilerplate below this line. From dc0f7d327301e973b160e1ca6eb6516dcc4707cd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 25 Feb 2022 10:08:05 -0700 Subject: [PATCH 10/13] chore: use gapic-generator-python 0.63.4 (#323) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: https://github.com/googleapis/googleapis/commit/ea5800229f73f94fd7204915a86ed09dcddf429a Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca893ff8af25fc7fe001de1405a517d80446ecca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: delete duplicates Co-authored-by: Owl Bot Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .../speech_v1/services/speech/async_client.py | 6 +- .../cloud/speech_v1/services/speech/client.py | 9 +- .../services/adaptation/async_client.py | 20 ++-- .../services/adaptation/client.py | 30 ++--- .../services/speech/async_client.py | 6 +- .../services/speech/client.py | 9 +- .../snippet_metadata_speech_v1.json | 24 ++-- .../snippet_metadata_speech_v1p1beta1.json | 104 +++++++++--------- ...ed_speech_long_running_recognize_async.py} | 4 +- ...ted_speech_long_running_recognize_sync.py} | 4 +- ...ch_v1_generated_speech_recognize_async.py} | 4 +- ...ech_v1_generated_speech_recognize_sync.py} | 4 +- ...rated_speech_streaming_recognize_async.py} | 4 +- ...erated_speech_streaming_recognize_sync.py} | 4 +- ...d_adaptation_create_custom_class_async.py} | 4 +- ...ed_adaptation_create_custom_class_sync.py} | 4 +- ...ted_adaptation_create_phrase_set_async.py} | 4 +- ...ated_adaptation_create_phrase_set_sync.py} | 4 +- ...d_adaptation_delete_custom_class_async.py} | 4 +- ...ed_adaptation_delete_custom_class_sync.py} | 4 +- ...ted_adaptation_delete_phrase_set_async.py} | 4 +- ...ated_adaptation_delete_phrase_set_sync.py} | 4 +- ...ated_adaptation_get_custom_class_async.py} | 4 +- ...rated_adaptation_get_custom_class_sync.py} | 4 +- ...erated_adaptation_get_phrase_set_async.py} | 4 +- ...nerated_adaptation_get_phrase_set_sync.py} | 4 +- ...d_adaptation_list_custom_classes_async.py} | 4 +- ...ed_adaptation_list_custom_classes_sync.py} | 4 +- ...rated_adaptation_list_phrase_set_async.py} | 4 +- ...erated_adaptation_list_phrase_set_sync.py} | 4 +- ...d_adaptation_update_custom_class_async.py} | 4 +- ...ed_adaptation_update_custom_class_sync.py} | 4 +- ...ted_adaptation_update_phrase_set_async.py} | 4 +- ...ated_adaptation_update_phrase_set_sync.py} | 4 +- ...ed_speech_long_running_recognize_async.py} | 4 +- ...ted_speech_long_running_recognize_sync.py} | 4 +- ...beta1_generated_speech_recognize_async.py} | 4 +- ...1beta1_generated_speech_recognize_sync.py} | 4 +- ...rated_speech_streaming_recognize_async.py} | 4 +- ...erated_speech_streaming_recognize_sync.py} | 4 +- 40 files changed, 160 insertions(+), 176 deletions(-) rename samples/generated_samples/{speech_generated_speech_v1_speech_long_running_recognize_async.py => speech_v1_generated_speech_long_running_recognize_async.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1_speech_long_running_recognize_sync.py => speech_v1_generated_speech_long_running_recognize_sync.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1_speech_recognize_async.py => speech_v1_generated_speech_recognize_async.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1_speech_recognize_sync.py => speech_v1_generated_speech_recognize_sync.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1_speech_streaming_recognize_async.py => speech_v1_generated_speech_streaming_recognize_async.py} (93%) rename samples/generated_samples/{speech_generated_speech_v1_speech_streaming_recognize_sync.py => speech_v1_generated_speech_streaming_recognize_sync.py} (93%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py => speech_v1p1beta1_generated_adaptation_create_custom_class_async.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py => speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py => speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py => speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py => speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py => speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py => speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py => speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py => speech_v1p1beta1_generated_adaptation_get_custom_class_async.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py => speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py => speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py => speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py => speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py => speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py => speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py => speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py} (90%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py => speech_v1p1beta1_generated_adaptation_update_custom_class_async.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py => speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py => speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py => speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py} (89%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py => speech_v1p1beta1_generated_speech_long_running_recognize_async.py} (91%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py => speech_v1p1beta1_generated_speech_long_running_recognize_sync.py} (91%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_speech_recognize_async.py => speech_v1p1beta1_generated_speech_recognize_async.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_speech_recognize_sync.py => speech_v1p1beta1_generated_speech_recognize_sync.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py => speech_v1p1beta1_generated_speech_streaming_recognize_async.py} (92%) rename samples/generated_samples/{speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py => speech_v1p1beta1_generated_speech_streaming_recognize_sync.py} (92%) diff --git a/google/cloud/speech_v1/services/speech/async_client.py b/google/cloud/speech_v1/services/speech/async_client.py index f35455f9..b992b6bb 100644 --- a/google/cloud/speech_v1/services/speech/async_client.py +++ b/google/cloud/speech_v1/services/speech/async_client.py @@ -221,7 +221,7 @@ async def recognize( results after all audio has been sent and processed. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1 @@ -340,7 +340,7 @@ async def long_running_recognize( `how-to `__. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1 @@ -461,7 +461,7 @@ def streaming_recognize( available via the gRPC API (not REST). - .. code-block:: + .. code-block:: python from google.cloud import speech_v1 diff --git a/google/cloud/speech_v1/services/speech/client.py b/google/cloud/speech_v1/services/speech/client.py index 423ff191..3d353e35 100644 --- a/google/cloud/speech_v1/services/speech/client.py +++ b/google/cloud/speech_v1/services/speech/client.py @@ -430,8 +430,7 @@ def recognize( results after all audio has been sent and processed. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1 @@ -540,8 +539,7 @@ def long_running_recognize( `how-to `__. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1 @@ -662,8 +660,7 @@ def streaming_recognize( available via the gRPC API (not REST). - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1 diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py index 91b36126..9f15f36d 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py @@ -217,7 +217,7 @@ async def create_phrase_set( when you send a call that includes the PhraseSet. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -338,7 +338,7 @@ async def get_phrase_set( ) -> resource.PhraseSet: r"""Get a phrase set. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -438,7 +438,7 @@ async def list_phrase_set( ) -> pagers.ListPhraseSetAsyncPager: r"""List phrase sets. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -548,7 +548,7 @@ async def update_phrase_set( ) -> resource.PhraseSet: r"""Update a phrase set. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -658,7 +658,7 @@ async def delete_phrase_set( ) -> None: r"""Delete a phrase set. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -741,7 +741,7 @@ async def create_custom_class( ) -> resource.CustomClass: r"""Create a custom class. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -866,7 +866,7 @@ async def get_custom_class( ) -> resource.CustomClass: r"""Get a custom class. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -963,7 +963,7 @@ async def list_custom_classes( ) -> pagers.ListCustomClassesAsyncPager: r"""List custom classes. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -1073,7 +1073,7 @@ async def update_custom_class( ) -> resource.CustomClass: r"""Update a custom class. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -1187,7 +1187,7 @@ async def delete_custom_class( ) -> None: r"""Delete a custom class. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/client.py b/google/cloud/speech_v1p1beta1/services/adaptation/client.py index a9a04d6b..1569c613 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/client.py @@ -432,8 +432,7 @@ def create_phrase_set( when you send a call that includes the PhraseSet. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -554,8 +553,7 @@ def get_phrase_set( ) -> resource.PhraseSet: r"""Get a phrase set. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -655,8 +653,7 @@ def list_phrase_set( ) -> pagers.ListPhraseSetPager: r"""List phrase sets. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -766,8 +763,7 @@ def update_phrase_set( ) -> resource.PhraseSet: r"""Update a phrase set. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -877,8 +873,7 @@ def delete_phrase_set( ) -> None: r"""Delete a phrase set. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -961,8 +956,7 @@ def create_custom_class( ) -> resource.CustomClass: r"""Create a custom class. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -1087,8 +1081,7 @@ def get_custom_class( ) -> resource.CustomClass: r"""Get a custom class. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -1185,8 +1178,7 @@ def list_custom_classes( ) -> pagers.ListCustomClassesPager: r"""List custom classes. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -1296,8 +1288,7 @@ def update_custom_class( ) -> resource.CustomClass: r"""Update a custom class. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -1411,8 +1402,7 @@ def delete_custom_class( ) -> None: r"""Delete a custom class. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 diff --git a/google/cloud/speech_v1p1beta1/services/speech/async_client.py b/google/cloud/speech_v1p1beta1/services/speech/async_client.py index bc114ada..22f01c8a 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/async_client.py @@ -221,7 +221,7 @@ async def recognize( results after all audio has been sent and processed. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -340,7 +340,7 @@ async def long_running_recognize( `how-to `__. - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -461,7 +461,7 @@ def streaming_recognize( available via the gRPC API (not REST). - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 diff --git a/google/cloud/speech_v1p1beta1/services/speech/client.py b/google/cloud/speech_v1p1beta1/services/speech/client.py index 3ceedd12..16d19ccb 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/client.py @@ -430,8 +430,7 @@ def recognize( results after all audio has been sent and processed. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -540,8 +539,7 @@ def long_running_recognize( `how-to `__. - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 @@ -662,8 +660,7 @@ def streaming_recognize( available via the gRPC API (not REST). - - .. code-block:: + .. code-block:: python from google.cloud import speech_v1p1beta1 diff --git a/samples/generated_samples/snippet_metadata_speech_v1.json b/samples/generated_samples/snippet_metadata_speech_v1.json index af739627..2871799e 100644 --- a/samples/generated_samples/snippet_metadata_speech_v1.json +++ b/samples/generated_samples/snippet_metadata_speech_v1.json @@ -10,8 +10,8 @@ "shortName": "LongRunningRecognize" } }, - "file": "speech_generated_speech_v1_speech_long_running_recognize_async.py", - "regionTag": "speech_generated_speech_v1_Speech_LongRunningRecognize_async", + "file": "speech_v1_generated_speech_long_running_recognize_async.py", + "regionTag": "speech_v1_generated_Speech_LongRunningRecognize_async", "segments": [ { "end": 55, @@ -54,8 +54,8 @@ "shortName": "LongRunningRecognize" } }, - "file": "speech_generated_speech_v1_speech_long_running_recognize_sync.py", - "regionTag": "speech_generated_speech_v1_Speech_LongRunningRecognize_sync", + "file": "speech_v1_generated_speech_long_running_recognize_sync.py", + "regionTag": "speech_v1_generated_Speech_LongRunningRecognize_sync", "segments": [ { "end": 55, @@ -99,8 +99,8 @@ "shortName": "Recognize" } }, - "file": "speech_generated_speech_v1_speech_recognize_async.py", - "regionTag": "speech_generated_speech_v1_Speech_Recognize_async", + "file": "speech_v1_generated_speech_recognize_async.py", + "regionTag": "speech_v1_generated_Speech_Recognize_async", "segments": [ { "end": 51, @@ -143,8 +143,8 @@ "shortName": "Recognize" } }, - "file": "speech_generated_speech_v1_speech_recognize_sync.py", - "regionTag": "speech_generated_speech_v1_Speech_Recognize_sync", + "file": "speech_v1_generated_speech_recognize_sync.py", + "regionTag": "speech_v1_generated_Speech_Recognize_sync", "segments": [ { "end": 51, @@ -188,8 +188,8 @@ "shortName": "StreamingRecognize" } }, - "file": "speech_generated_speech_v1_speech_streaming_recognize_async.py", - "regionTag": "speech_generated_speech_v1_Speech_StreamingRecognize_async", + "file": "speech_v1_generated_speech_streaming_recognize_async.py", + "regionTag": "speech_v1_generated_Speech_StreamingRecognize_async", "segments": [ { "end": 58, @@ -232,8 +232,8 @@ "shortName": "StreamingRecognize" } }, - "file": "speech_generated_speech_v1_speech_streaming_recognize_sync.py", - "regionTag": "speech_generated_speech_v1_Speech_StreamingRecognize_sync", + "file": "speech_v1_generated_speech_streaming_recognize_sync.py", + "regionTag": "speech_v1_generated_Speech_StreamingRecognize_sync", "segments": [ { "end": 58, diff --git a/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json b/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json index 3f7adc12..76518ffb 100644 --- a/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json +++ b/samples/generated_samples/snippet_metadata_speech_v1p1beta1.json @@ -10,8 +10,8 @@ "shortName": "CreateCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_async", + "file": "speech_v1p1beta1_generated_adaptation_create_custom_class_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_CreateCustomClass_async", "segments": [ { "end": 45, @@ -54,8 +54,8 @@ "shortName": "CreateCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_sync", + "file": "speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_CreateCustomClass_sync", "segments": [ { "end": 45, @@ -99,8 +99,8 @@ "shortName": "CreatePhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_async", + "file": "speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_async", "segments": [ { "end": 45, @@ -143,8 +143,8 @@ "shortName": "CreatePhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_sync", + "file": "speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_sync", "segments": [ { "end": 45, @@ -188,8 +188,8 @@ "shortName": "DeleteCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_async", + "file": "speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_async", "segments": [ { "end": 42, @@ -230,8 +230,8 @@ "shortName": "DeleteCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_sync", + "file": "speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_sync", "segments": [ { "end": 42, @@ -273,8 +273,8 @@ "shortName": "DeletePhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_async", + "file": "speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_DeletePhraseSet_async", "segments": [ { "end": 42, @@ -315,8 +315,8 @@ "shortName": "DeletePhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_sync", + "file": "speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_DeletePhraseSet_sync", "segments": [ { "end": 42, @@ -358,8 +358,8 @@ "shortName": "GetCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_async", + "file": "speech_v1p1beta1_generated_adaptation_get_custom_class_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_GetCustomClass_async", "segments": [ { "end": 44, @@ -402,8 +402,8 @@ "shortName": "GetCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_sync", + "file": "speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_GetCustomClass_sync", "segments": [ { "end": 44, @@ -447,8 +447,8 @@ "shortName": "GetPhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_async", + "file": "speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_GetPhraseSet_async", "segments": [ { "end": 44, @@ -491,8 +491,8 @@ "shortName": "GetPhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_sync", + "file": "speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_GetPhraseSet_sync", "segments": [ { "end": 44, @@ -536,8 +536,8 @@ "shortName": "ListCustomClasses" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_async", + "file": "speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_ListCustomClasses_async", "segments": [ { "end": 45, @@ -580,8 +580,8 @@ "shortName": "ListCustomClasses" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_sync", + "file": "speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_ListCustomClasses_sync", "segments": [ { "end": 45, @@ -625,8 +625,8 @@ "shortName": "ListPhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_async", + "file": "speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_ListPhraseSet_async", "segments": [ { "end": 45, @@ -669,8 +669,8 @@ "shortName": "ListPhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_sync", + "file": "speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_ListPhraseSet_sync", "segments": [ { "end": 45, @@ -714,8 +714,8 @@ "shortName": "UpdateCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_async", + "file": "speech_v1p1beta1_generated_adaptation_update_custom_class_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_UpdateCustomClass_async", "segments": [ { "end": 43, @@ -758,8 +758,8 @@ "shortName": "UpdateCustomClass" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_sync", + "file": "speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_UpdateCustomClass_sync", "segments": [ { "end": 43, @@ -803,8 +803,8 @@ "shortName": "UpdatePhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_async", + "file": "speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_UpdatePhraseSet_async", "segments": [ { "end": 43, @@ -847,8 +847,8 @@ "shortName": "UpdatePhraseSet" } }, - "file": "speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_sync", + "file": "speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py", + "regionTag": "speech_v1p1beta1_generated_Adaptation_UpdatePhraseSet_sync", "segments": [ { "end": 43, @@ -892,8 +892,8 @@ "shortName": "LongRunningRecognize" } }, - "file": "speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_async", + "file": "speech_v1p1beta1_generated_speech_long_running_recognize_async.py", + "regionTag": "speech_v1p1beta1_generated_Speech_LongRunningRecognize_async", "segments": [ { "end": 55, @@ -936,8 +936,8 @@ "shortName": "LongRunningRecognize" } }, - "file": "speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_sync", + "file": "speech_v1p1beta1_generated_speech_long_running_recognize_sync.py", + "regionTag": "speech_v1p1beta1_generated_Speech_LongRunningRecognize_sync", "segments": [ { "end": 55, @@ -981,8 +981,8 @@ "shortName": "Recognize" } }, - "file": "speech_generated_speech_v1p1beta1_speech_recognize_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Speech_Recognize_async", + "file": "speech_v1p1beta1_generated_speech_recognize_async.py", + "regionTag": "speech_v1p1beta1_generated_Speech_Recognize_async", "segments": [ { "end": 51, @@ -1025,8 +1025,8 @@ "shortName": "Recognize" } }, - "file": "speech_generated_speech_v1p1beta1_speech_recognize_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Speech_Recognize_sync", + "file": "speech_v1p1beta1_generated_speech_recognize_sync.py", + "regionTag": "speech_v1p1beta1_generated_Speech_Recognize_sync", "segments": [ { "end": 51, @@ -1070,8 +1070,8 @@ "shortName": "StreamingRecognize" } }, - "file": "speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py", - "regionTag": "speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_async", + "file": "speech_v1p1beta1_generated_speech_streaming_recognize_async.py", + "regionTag": "speech_v1p1beta1_generated_Speech_StreamingRecognize_async", "segments": [ { "end": 58, @@ -1114,8 +1114,8 @@ "shortName": "StreamingRecognize" } }, - "file": "speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py", - "regionTag": "speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_sync", + "file": "speech_v1p1beta1_generated_speech_streaming_recognize_sync.py", + "regionTag": "speech_v1p1beta1_generated_Speech_StreamingRecognize_sync", "segments": [ { "end": 58, diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py rename to samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py index cd9eb097..deeb4c0f 100644 --- a/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_async.py +++ b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1_Speech_LongRunningRecognize_async] +# [START speech_v1_generated_Speech_LongRunningRecognize_async] from google.cloud import speech_v1 @@ -53,4 +53,4 @@ async def sample_long_running_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1_Speech_LongRunningRecognize_async] +# [END speech_v1_generated_Speech_LongRunningRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py rename to samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py index ccea1cb5..cb7641b0 100644 --- a/samples/generated_samples/speech_generated_speech_v1_speech_long_running_recognize_sync.py +++ b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1_Speech_LongRunningRecognize_sync] +# [START speech_v1_generated_Speech_LongRunningRecognize_sync] from google.cloud import speech_v1 @@ -53,4 +53,4 @@ def sample_long_running_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1_Speech_LongRunningRecognize_sync] +# [END speech_v1_generated_Speech_LongRunningRecognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py b/samples/generated_samples/speech_v1_generated_speech_recognize_async.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py rename to samples/generated_samples/speech_v1_generated_speech_recognize_async.py index bbfbcb6f..f0692c26 100644 --- a/samples/generated_samples/speech_generated_speech_v1_speech_recognize_async.py +++ b/samples/generated_samples/speech_v1_generated_speech_recognize_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1_Speech_Recognize_async] +# [START speech_v1_generated_Speech_Recognize_async] from google.cloud import speech_v1 @@ -49,4 +49,4 @@ async def sample_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1_Speech_Recognize_async] +# [END speech_v1_generated_Speech_Recognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py b/samples/generated_samples/speech_v1_generated_speech_recognize_sync.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py rename to samples/generated_samples/speech_v1_generated_speech_recognize_sync.py index 8698fe98..8ef95a89 100644 --- a/samples/generated_samples/speech_generated_speech_v1_speech_recognize_sync.py +++ b/samples/generated_samples/speech_v1_generated_speech_recognize_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1_Speech_Recognize_sync] +# [START speech_v1_generated_Speech_Recognize_sync] from google.cloud import speech_v1 @@ -49,4 +49,4 @@ def sample_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1_Speech_Recognize_sync] +# [END speech_v1_generated_Speech_Recognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py similarity index 93% rename from samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py rename to samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py index acec2c76..becc905d 100644 --- a/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_async.py +++ b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1_Speech_StreamingRecognize_async] +# [START speech_v1_generated_Speech_StreamingRecognize_async] from google.cloud import speech_v1 @@ -56,4 +56,4 @@ def request_generator(): async for response in stream: print(response) -# [END speech_generated_speech_v1_Speech_StreamingRecognize_async] +# [END speech_v1_generated_Speech_StreamingRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py similarity index 93% rename from samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py rename to samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py index 5d1335b0..e4bba046 100644 --- a/samples/generated_samples/speech_generated_speech_v1_speech_streaming_recognize_sync.py +++ b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1_Speech_StreamingRecognize_sync] +# [START speech_v1_generated_Speech_StreamingRecognize_sync] from google.cloud import speech_v1 @@ -56,4 +56,4 @@ def request_generator(): for response in stream: print(response) -# [END speech_generated_speech_v1_Speech_StreamingRecognize_sync] +# [END speech_v1_generated_Speech_StreamingRecognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py index 64ba623e..a8290819 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_async] +# [START speech_v1p1beta1_generated_Adaptation_CreateCustomClass_async] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ async def sample_create_custom_class(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_async] +# [END speech_v1p1beta1_generated_Adaptation_CreateCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py index 45d45a69..506dac07 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_sync] +# [START speech_v1p1beta1_generated_Adaptation_CreateCustomClass_sync] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ def sample_create_custom_class(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_CreateCustomClass_sync] +# [END speech_v1p1beta1_generated_Adaptation_CreateCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py index c0434772..919c85d5 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_async] +# [START speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_async] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ async def sample_create_phrase_set(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_async] +# [END speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py index 22d63ba8..4b2c597a 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_create_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_sync] +# [START speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_sync] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ def sample_create_phrase_set(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_CreatePhraseSet_sync] +# [END speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py index faecb648..01cee120 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_async] +# [START speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_async] from google.cloud import speech_v1p1beta1 @@ -40,4 +40,4 @@ async def sample_delete_custom_class(): await client.delete_custom_class(request=request) -# [END speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_async] +# [END speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py index ccf9ae9b..d95f792a 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_sync] +# [START speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_sync] from google.cloud import speech_v1p1beta1 @@ -40,4 +40,4 @@ def sample_delete_custom_class(): client.delete_custom_class(request=request) -# [END speech_generated_speech_v1p1beta1_Adaptation_DeleteCustomClass_sync] +# [END speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py index afdfae18..cb5c9435 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_async] +# [START speech_v1p1beta1_generated_Adaptation_DeletePhraseSet_async] from google.cloud import speech_v1p1beta1 @@ -40,4 +40,4 @@ async def sample_delete_phrase_set(): await client.delete_phrase_set(request=request) -# [END speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_async] +# [END speech_v1p1beta1_generated_Adaptation_DeletePhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py index 7b2b6f28..7afb52b7 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_delete_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_sync] +# [START speech_v1p1beta1_generated_Adaptation_DeletePhraseSet_sync] from google.cloud import speech_v1p1beta1 @@ -40,4 +40,4 @@ def sample_delete_phrase_set(): client.delete_phrase_set(request=request) -# [END speech_generated_speech_v1p1beta1_Adaptation_DeletePhraseSet_sync] +# [END speech_v1p1beta1_generated_Adaptation_DeletePhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py index ea205ee2..e2d4ac5e 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_async] +# [START speech_v1p1beta1_generated_Adaptation_GetCustomClass_async] from google.cloud import speech_v1p1beta1 @@ -42,4 +42,4 @@ async def sample_get_custom_class(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_async] +# [END speech_v1p1beta1_generated_Adaptation_GetCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py index bde42339..a349b6f0 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_sync] +# [START speech_v1p1beta1_generated_Adaptation_GetCustomClass_sync] from google.cloud import speech_v1p1beta1 @@ -42,4 +42,4 @@ def sample_get_custom_class(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_GetCustomClass_sync] +# [END speech_v1p1beta1_generated_Adaptation_GetCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py index d62a8878..c864f554 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_async] +# [START speech_v1p1beta1_generated_Adaptation_GetPhraseSet_async] from google.cloud import speech_v1p1beta1 @@ -42,4 +42,4 @@ async def sample_get_phrase_set(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_async] +# [END speech_v1p1beta1_generated_Adaptation_GetPhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py index e16302c4..f6d6dd6c 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_get_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_sync] +# [START speech_v1p1beta1_generated_Adaptation_GetPhraseSet_sync] from google.cloud import speech_v1p1beta1 @@ -42,4 +42,4 @@ def sample_get_phrase_set(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_GetPhraseSet_sync] +# [END speech_v1p1beta1_generated_Adaptation_GetPhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py index d2a70042..8ac74a4e 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_async] +# [START speech_v1p1beta1_generated_Adaptation_ListCustomClasses_async] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ async def sample_list_custom_classes(): async for response in page_result: print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_async] +# [END speech_v1p1beta1_generated_Adaptation_ListCustomClasses_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py index 8dc585b3..1e31b683 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_custom_classes_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_sync] +# [START speech_v1p1beta1_generated_Adaptation_ListCustomClasses_sync] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ def sample_list_custom_classes(): for response in page_result: print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_ListCustomClasses_sync] +# [END speech_v1p1beta1_generated_Adaptation_ListCustomClasses_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py index 8bbeeb3e..79ade2e9 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_async] +# [START speech_v1p1beta1_generated_Adaptation_ListPhraseSet_async] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ async def sample_list_phrase_set(): async for response in page_result: print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_async] +# [END speech_v1p1beta1_generated_Adaptation_ListPhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py similarity index 90% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py index b8a9b9c9..7d146e42 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_list_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_sync] +# [START speech_v1p1beta1_generated_Adaptation_ListPhraseSet_sync] from google.cloud import speech_v1p1beta1 @@ -43,4 +43,4 @@ def sample_list_phrase_set(): for response in page_result: print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_ListPhraseSet_sync] +# [END speech_v1p1beta1_generated_Adaptation_ListPhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py index 4d36f405..f09d84e4 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_async] +# [START speech_v1p1beta1_generated_Adaptation_UpdateCustomClass_async] from google.cloud import speech_v1p1beta1 @@ -41,4 +41,4 @@ async def sample_update_custom_class(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_async] +# [END speech_v1p1beta1_generated_Adaptation_UpdateCustomClass_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py index e1d1d45d..ca2410f1 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_sync] +# [START speech_v1p1beta1_generated_Adaptation_UpdateCustomClass_sync] from google.cloud import speech_v1p1beta1 @@ -41,4 +41,4 @@ def sample_update_custom_class(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_UpdateCustomClass_sync] +# [END speech_v1p1beta1_generated_Adaptation_UpdateCustomClass_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py index 2f38a614..6572cd07 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_async] +# [START speech_v1p1beta1_generated_Adaptation_UpdatePhraseSet_async] from google.cloud import speech_v1p1beta1 @@ -41,4 +41,4 @@ async def sample_update_phrase_set(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_async] +# [END speech_v1p1beta1_generated_Adaptation_UpdatePhraseSet_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py similarity index 89% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py index 681fa5e2..3f2be7da 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_adaptation_update_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_sync] +# [START speech_v1p1beta1_generated_Adaptation_UpdatePhraseSet_sync] from google.cloud import speech_v1p1beta1 @@ -41,4 +41,4 @@ def sample_update_phrase_set(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Adaptation_UpdatePhraseSet_sync] +# [END speech_v1p1beta1_generated_Adaptation_UpdatePhraseSet_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py similarity index 91% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py index 43e5233e..169a6b7f 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_async] +# [START speech_v1p1beta1_generated_Speech_LongRunningRecognize_async] from google.cloud import speech_v1p1beta1 @@ -53,4 +53,4 @@ async def sample_long_running_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_async] +# [END speech_v1p1beta1_generated_Speech_LongRunningRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py similarity index 91% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py index c57300c8..2944238a 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_long_running_recognize_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_sync] +# [START speech_v1p1beta1_generated_Speech_LongRunningRecognize_sync] from google.cloud import speech_v1p1beta1 @@ -53,4 +53,4 @@ def sample_long_running_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Speech_LongRunningRecognize_sync] +# [END speech_v1p1beta1_generated_Speech_LongRunningRecognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py index 15854b3e..663dbf75 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Speech_Recognize_async] +# [START speech_v1p1beta1_generated_Speech_Recognize_async] from google.cloud import speech_v1p1beta1 @@ -49,4 +49,4 @@ async def sample_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Speech_Recognize_async] +# [END speech_v1p1beta1_generated_Speech_Recognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py index ad0e884d..75ffdb46 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_recognize_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Speech_Recognize_sync] +# [START speech_v1p1beta1_generated_Speech_Recognize_sync] from google.cloud import speech_v1p1beta1 @@ -49,4 +49,4 @@ def sample_recognize(): # Handle the response print(response) -# [END speech_generated_speech_v1p1beta1_Speech_Recognize_sync] +# [END speech_v1p1beta1_generated_Speech_Recognize_sync] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py rename to samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py index ac7daf07..d0b327d8 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_async] +# [START speech_v1p1beta1_generated_Speech_StreamingRecognize_async] from google.cloud import speech_v1p1beta1 @@ -56,4 +56,4 @@ def request_generator(): async for response in stream: print(response) -# [END speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_async] +# [END speech_v1p1beta1_generated_Speech_StreamingRecognize_async] diff --git a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py similarity index 92% rename from samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py rename to samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py index 05b3074a..4ea9292a 100644 --- a/samples/generated_samples/speech_generated_speech_v1p1beta1_speech_streaming_recognize_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-speech -# [START speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_sync] +# [START speech_v1p1beta1_generated_Speech_StreamingRecognize_sync] from google.cloud import speech_v1p1beta1 @@ -56,4 +56,4 @@ def request_generator(): for response in stream: print(response) -# [END speech_generated_speech_v1p1beta1_Speech_StreamingRecognize_sync] +# [END speech_v1p1beta1_generated_Speech_StreamingRecognize_sync] From 3a4e171b2d9c10d1018c085f09d955b6ed7e1b7d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Feb 2022 06:07:37 -0500 Subject: [PATCH 11/13] chore: update copyright year to 2022 (#325) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update copyright year to 2022 PiperOrigin-RevId: 431037888 Source-Link: https://github.com/googleapis/googleapis/commit/b3397f5febbf21dfc69b875ddabaf76bee765058 Source-Link: https://github.com/googleapis/googleapis-gen/commit/510b54e1cdefd53173984df16645081308fe897e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTEwYjU0ZTFjZGVmZDUzMTczOTg0ZGYxNjY0NTA4MTMwOGZlODk3ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google/cloud/speech/__init__.py | 2 +- google/cloud/speech_v1/__init__.py | 2 +- google/cloud/speech_v1/services/__init__.py | 2 +- google/cloud/speech_v1/services/speech/__init__.py | 2 +- google/cloud/speech_v1/services/speech/async_client.py | 2 +- google/cloud/speech_v1/services/speech/client.py | 2 +- google/cloud/speech_v1/services/speech/transports/__init__.py | 2 +- google/cloud/speech_v1/services/speech/transports/base.py | 2 +- google/cloud/speech_v1/services/speech/transports/grpc.py | 2 +- .../cloud/speech_v1/services/speech/transports/grpc_asyncio.py | 2 +- google/cloud/speech_v1/types/__init__.py | 2 +- google/cloud/speech_v1/types/cloud_speech.py | 2 +- google/cloud/speech_v1/types/resource.py | 2 +- google/cloud/speech_v1p1beta1/__init__.py | 2 +- google/cloud/speech_v1p1beta1/services/__init__.py | 2 +- google/cloud/speech_v1p1beta1/services/adaptation/__init__.py | 2 +- .../cloud/speech_v1p1beta1/services/adaptation/async_client.py | 2 +- google/cloud/speech_v1p1beta1/services/adaptation/client.py | 2 +- google/cloud/speech_v1p1beta1/services/adaptation/pagers.py | 2 +- .../speech_v1p1beta1/services/adaptation/transports/__init__.py | 2 +- .../speech_v1p1beta1/services/adaptation/transports/base.py | 2 +- .../speech_v1p1beta1/services/adaptation/transports/grpc.py | 2 +- .../services/adaptation/transports/grpc_asyncio.py | 2 +- google/cloud/speech_v1p1beta1/services/speech/__init__.py | 2 +- google/cloud/speech_v1p1beta1/services/speech/async_client.py | 2 +- google/cloud/speech_v1p1beta1/services/speech/client.py | 2 +- .../speech_v1p1beta1/services/speech/transports/__init__.py | 2 +- .../cloud/speech_v1p1beta1/services/speech/transports/base.py | 2 +- .../cloud/speech_v1p1beta1/services/speech/transports/grpc.py | 2 +- .../speech_v1p1beta1/services/speech/transports/grpc_asyncio.py | 2 +- google/cloud/speech_v1p1beta1/types/__init__.py | 2 +- google/cloud/speech_v1p1beta1/types/cloud_speech.py | 2 +- google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py | 2 +- google/cloud/speech_v1p1beta1/types/resource.py | 2 +- .../speech_v1_generated_speech_long_running_recognize_async.py | 2 +- .../speech_v1_generated_speech_long_running_recognize_sync.py | 2 +- .../speech_v1_generated_speech_recognize_async.py | 2 +- .../speech_v1_generated_speech_recognize_sync.py | 2 +- .../speech_v1_generated_speech_streaming_recognize_async.py | 2 +- .../speech_v1_generated_speech_streaming_recognize_sync.py | 2 +- ..._v1p1beta1_generated_adaptation_create_custom_class_async.py | 2 +- ...h_v1p1beta1_generated_adaptation_create_custom_class_sync.py | 2 +- ...ch_v1p1beta1_generated_adaptation_create_phrase_set_async.py | 2 +- ...ech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py | 2 +- ..._v1p1beta1_generated_adaptation_delete_custom_class_async.py | 2 +- ...h_v1p1beta1_generated_adaptation_delete_custom_class_sync.py | 2 +- ...ch_v1p1beta1_generated_adaptation_delete_phrase_set_async.py | 2 +- ...ech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py | 2 +- ...ech_v1p1beta1_generated_adaptation_get_custom_class_async.py | 2 +- ...eech_v1p1beta1_generated_adaptation_get_custom_class_sync.py | 2 +- ...peech_v1p1beta1_generated_adaptation_get_phrase_set_async.py | 2 +- ...speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py | 2 +- ..._v1p1beta1_generated_adaptation_list_custom_classes_async.py | 2 +- ...h_v1p1beta1_generated_adaptation_list_custom_classes_sync.py | 2 +- ...eech_v1p1beta1_generated_adaptation_list_phrase_set_async.py | 2 +- ...peech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py | 2 +- ..._v1p1beta1_generated_adaptation_update_custom_class_async.py | 2 +- ...h_v1p1beta1_generated_adaptation_update_custom_class_sync.py | 2 +- ...ch_v1p1beta1_generated_adaptation_update_phrase_set_async.py | 2 +- ...ech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py | 2 +- ...h_v1p1beta1_generated_speech_long_running_recognize_async.py | 2 +- ...ch_v1p1beta1_generated_speech_long_running_recognize_sync.py | 2 +- .../speech_v1p1beta1_generated_speech_recognize_async.py | 2 +- .../speech_v1p1beta1_generated_speech_recognize_sync.py | 2 +- ...eech_v1p1beta1_generated_speech_streaming_recognize_async.py | 2 +- ...peech_v1p1beta1_generated_speech_streaming_recognize_sync.py | 2 +- scripts/fixup_speech_v1_keywords.py | 2 +- scripts/fixup_speech_v1p1beta1_keywords.py | 2 +- tests/__init__.py | 2 +- tests/unit/__init__.py | 2 +- tests/unit/gapic/__init__.py | 2 +- tests/unit/gapic/speech_v1/__init__.py | 2 +- tests/unit/gapic/speech_v1/test_speech.py | 2 +- tests/unit/gapic/speech_v1p1beta1/__init__.py | 2 +- tests/unit/gapic/speech_v1p1beta1/test_adaptation.py | 2 +- tests/unit/gapic/speech_v1p1beta1/test_speech.py | 2 +- 76 files changed, 76 insertions(+), 76 deletions(-) diff --git a/google/cloud/speech/__init__.py b/google/cloud/speech/__init__.py index 54e539cb..6d1c9f4f 100644 --- a/google/cloud/speech/__init__.py +++ b/google/cloud/speech/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/__init__.py b/google/cloud/speech_v1/__init__.py index 47592b25..a31190b9 100644 --- a/google/cloud/speech_v1/__init__.py +++ b/google/cloud/speech_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/__init__.py b/google/cloud/speech_v1/services/__init__.py index 4de65971..e8e1c384 100644 --- a/google/cloud/speech_v1/services/__init__.py +++ b/google/cloud/speech_v1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/__init__.py b/google/cloud/speech_v1/services/speech/__init__.py index 5a359701..80fcdb77 100644 --- a/google/cloud/speech_v1/services/speech/__init__.py +++ b/google/cloud/speech_v1/services/speech/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/async_client.py b/google/cloud/speech_v1/services/speech/async_client.py index b992b6bb..a8522754 100644 --- a/google/cloud/speech_v1/services/speech/async_client.py +++ b/google/cloud/speech_v1/services/speech/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/client.py b/google/cloud/speech_v1/services/speech/client.py index 3d353e35..0e89b345 100644 --- a/google/cloud/speech_v1/services/speech/client.py +++ b/google/cloud/speech_v1/services/speech/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/transports/__init__.py b/google/cloud/speech_v1/services/speech/transports/__init__.py index 9672a67d..4f7834ee 100644 --- a/google/cloud/speech_v1/services/speech/transports/__init__.py +++ b/google/cloud/speech_v1/services/speech/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/transports/base.py b/google/cloud/speech_v1/services/speech/transports/base.py index 1b25e522..9479402d 100644 --- a/google/cloud/speech_v1/services/speech/transports/base.py +++ b/google/cloud/speech_v1/services/speech/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/transports/grpc.py b/google/cloud/speech_v1/services/speech/transports/grpc.py index d77ef0e8..9dd50450 100644 --- a/google/cloud/speech_v1/services/speech/transports/grpc.py +++ b/google/cloud/speech_v1/services/speech/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py b/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py index faf20e54..b76f6d60 100644 --- a/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py +++ b/google/cloud/speech_v1/services/speech/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/types/__init__.py b/google/cloud/speech_v1/types/__init__.py index 4075fc31..533c9c5c 100644 --- a/google/cloud/speech_v1/types/__init__.py +++ b/google/cloud/speech_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/types/cloud_speech.py b/google/cloud/speech_v1/types/cloud_speech.py index d94c11a1..af9d64aa 100644 --- a/google/cloud/speech_v1/types/cloud_speech.py +++ b/google/cloud/speech_v1/types/cloud_speech.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1/types/resource.py b/google/cloud/speech_v1/types/resource.py index c7286b81..149add1b 100644 --- a/google/cloud/speech_v1/types/resource.py +++ b/google/cloud/speech_v1/types/resource.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/__init__.py b/google/cloud/speech_v1p1beta1/__init__.py index ec90e3e0..b3022126 100644 --- a/google/cloud/speech_v1p1beta1/__init__.py +++ b/google/cloud/speech_v1p1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/__init__.py b/google/cloud/speech_v1p1beta1/services/__init__.py index 4de65971..e8e1c384 100644 --- a/google/cloud/speech_v1p1beta1/services/__init__.py +++ b/google/cloud/speech_v1p1beta1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/__init__.py b/google/cloud/speech_v1p1beta1/services/adaptation/__init__.py index 00ce7ae3..afac210a 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/__init__.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py index 9f15f36d..f28e3032 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/client.py b/google/cloud/speech_v1p1beta1/services/adaptation/client.py index 1569c613..9dbad4c7 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/client.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/pagers.py b/google/cloud/speech_v1p1beta1/services/adaptation/pagers.py index f5a5ad84..d1f7e00b 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/pagers.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/pagers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/transports/__init__.py b/google/cloud/speech_v1p1beta1/services/adaptation/transports/__init__.py index 6ca6bbe1..1a966428 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/transports/__init__.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/transports/base.py b/google/cloud/speech_v1p1beta1/services/adaptation/transports/base.py index 93a396d0..fea0224e 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/transports/base.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py index 71e19e7f..f9670a2a 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py index f6fa38a3..1a21c29a 100644 --- a/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py +++ b/google/cloud/speech_v1p1beta1/services/adaptation/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/__init__.py b/google/cloud/speech_v1p1beta1/services/speech/__init__.py index 5a359701..80fcdb77 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/__init__.py +++ b/google/cloud/speech_v1p1beta1/services/speech/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/async_client.py b/google/cloud/speech_v1p1beta1/services/speech/async_client.py index 22f01c8a..e8a78661 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/async_client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/client.py b/google/cloud/speech_v1p1beta1/services/speech/client.py index 16d19ccb..c22ba685 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/client.py +++ b/google/cloud/speech_v1p1beta1/services/speech/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/transports/__init__.py b/google/cloud/speech_v1p1beta1/services/speech/transports/__init__.py index 9672a67d..4f7834ee 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/transports/__init__.py +++ b/google/cloud/speech_v1p1beta1/services/speech/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/transports/base.py b/google/cloud/speech_v1p1beta1/services/speech/transports/base.py index 70e0551b..912d5d1b 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/transports/base.py +++ b/google/cloud/speech_v1p1beta1/services/speech/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py index 243a248d..613ec482 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py +++ b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py index b43fdf0e..05f0387f 100644 --- a/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py +++ b/google/cloud/speech_v1p1beta1/services/speech/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/types/__init__.py b/google/cloud/speech_v1p1beta1/types/__init__.py index fd172826..a33a9eff 100644 --- a/google/cloud/speech_v1p1beta1/types/__init__.py +++ b/google/cloud/speech_v1p1beta1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/types/cloud_speech.py b/google/cloud/speech_v1p1beta1/types/cloud_speech.py index 9deaa396..3f6545e4 100644 --- a/google/cloud/speech_v1p1beta1/types/cloud_speech.py +++ b/google/cloud/speech_v1p1beta1/types/cloud_speech.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py b/google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py index 4b61f22f..c5791b75 100644 --- a/google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py +++ b/google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/google/cloud/speech_v1p1beta1/types/resource.py b/google/cloud/speech_v1p1beta1/types/resource.py index 9aa0508b..d755985f 100644 --- a/google/cloud/speech_v1p1beta1/types/resource.py +++ b/google/cloud/speech_v1p1beta1/types/resource.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py index deeb4c0f..223b0854 100644 --- a/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py +++ b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py index cb7641b0..6fc5d6a9 100644 --- a/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py +++ b/samples/generated_samples/speech_v1_generated_speech_long_running_recognize_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1_generated_speech_recognize_async.py b/samples/generated_samples/speech_v1_generated_speech_recognize_async.py index f0692c26..4cc7e270 100644 --- a/samples/generated_samples/speech_v1_generated_speech_recognize_async.py +++ b/samples/generated_samples/speech_v1_generated_speech_recognize_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1_generated_speech_recognize_sync.py b/samples/generated_samples/speech_v1_generated_speech_recognize_sync.py index 8ef95a89..3a12ac12 100644 --- a/samples/generated_samples/speech_v1_generated_speech_recognize_sync.py +++ b/samples/generated_samples/speech_v1_generated_speech_recognize_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py index becc905d..094b3fb5 100644 --- a/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py +++ b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py index e4bba046..a33e468f 100644 --- a/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py +++ b/samples/generated_samples/speech_v1_generated_speech_streaming_recognize_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py index a8290819..c35ca34b 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py index 506dac07..464c568b 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_custom_class_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py index 919c85d5..2533f582 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py index 4b2c597a..28d7c095 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_create_phrase_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py index 01cee120..b7cfaf2d 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py index d95f792a..44bba044 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_custom_class_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py index cb5c9435..4951a6b6 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py index 7afb52b7..3340d9f1 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_delete_phrase_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py index e2d4ac5e..d1016dd4 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py index a349b6f0..b5e94a26 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_custom_class_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py index c864f554..dd999bc9 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py index f6d6dd6c..09e4c125 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_get_phrase_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py index 8ac74a4e..a34f77b1 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py index 1e31b683..4f1ff01f 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_custom_classes_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py index 79ade2e9..f7fc80a0 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py index 7d146e42..e8fa851a 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_list_phrase_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py index f09d84e4..67d2aeb2 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py index ca2410f1..20f2caa3 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_custom_class_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py index 6572cd07..4f0f3605 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py index 3f2be7da..66908df4 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_adaptation_update_phrase_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py index 169a6b7f..7f22e235 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py index 2944238a..e20884a4 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py index 663dbf75..a21579e7 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py index 75ffdb46..18eb0020 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_recognize_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py index d0b327d8..9ad96c5f 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py index 4ea9292a..ffd2a084 100644 --- a/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py +++ b/samples/generated_samples/speech_v1p1beta1_generated_speech_streaming_recognize_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/scripts/fixup_speech_v1_keywords.py b/scripts/fixup_speech_v1_keywords.py index 018711bf..cf0c7209 100644 --- a/scripts/fixup_speech_v1_keywords.py +++ b/scripts/fixup_speech_v1_keywords.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/scripts/fixup_speech_v1p1beta1_keywords.py b/scripts/fixup_speech_v1p1beta1_keywords.py index a226eb9a..5901b513 100644 --- a/scripts/fixup_speech_v1p1beta1_keywords.py +++ b/scripts/fixup_speech_v1p1beta1_keywords.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/__init__.py b/tests/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/gapic/speech_v1/__init__.py b/tests/unit/gapic/speech_v1/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/gapic/speech_v1/__init__.py +++ b/tests/unit/gapic/speech_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/gapic/speech_v1/test_speech.py b/tests/unit/gapic/speech_v1/test_speech.py index c3fe28b0..a4594970 100644 --- a/tests/unit/gapic/speech_v1/test_speech.py +++ b/tests/unit/gapic/speech_v1/test_speech.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/gapic/speech_v1p1beta1/__init__.py b/tests/unit/gapic/speech_v1p1beta1/__init__.py index 4de65971..e8e1c384 100644 --- a/tests/unit/gapic/speech_v1p1beta1/__init__.py +++ b/tests/unit/gapic/speech_v1p1beta1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py b/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py index df2bdb04..ef381c70 100644 --- a/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py +++ b/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. diff --git a/tests/unit/gapic/speech_v1p1beta1/test_speech.py b/tests/unit/gapic/speech_v1p1beta1/test_speech.py index bd0471c2..3b9b1c99 100644 --- a/tests/unit/gapic/speech_v1p1beta1/test_speech.py +++ b/tests/unit/gapic/speech_v1p1beta1/test_speech.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# 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. From c553bd0c1fff39a3a4398a6d954052fc85d3af3f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 26 Feb 2022 19:42:27 +0100 Subject: [PATCH 12/13] chore(deps): update dependency google-cloud-storage to v2.1.0 (#309) Co-authored-by: Anthonios Partheniou --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 71b67878..c549f4e2 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ google-cloud-speech==2.12.0 -google-cloud-storage==2.0.0 +google-cloud-storage==2.1.0 From d2b360c989c4c8be0f5aefa50bf62e867b3095b8 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 28 Feb 2022 17:50:37 -0500 Subject: [PATCH 13/13] chore(main): release 2.13.0 (#314) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 18 ++++++++++++++++++ setup.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 088c3bfc..999c1310 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,24 @@ [1]: https://pypi.org/project/google-cloud-speech/#history +## [2.13.0](https://github.com/googleapis/python-speech/compare/v2.12.0...v2.13.0) (2022-02-26) + + +### Features + +* add api key support ([#313](https://github.com/googleapis/python-speech/issues/313)) ([86fe8ea](https://github.com/googleapis/python-speech/commit/86fe8ea626c95b9dd98345777739013b9fd1b0f3)) + + +### Bug Fixes + +* **deps:** move libcst to extras ([#322](https://github.com/googleapis/python-speech/issues/322)) ([de6e7c1](https://github.com/googleapis/python-speech/commit/de6e7c193edeff69376ec94da26c76dbeaa24d36)) +* resolve DuplicateCredentialArgs error when using credentials_file ([#318](https://github.com/googleapis/python-speech/issues/318)) ([1348765](https://github.com/googleapis/python-speech/commit/1348765cbf8d682ba49983a3e991cb408d59171e)) + + +### Documentation + +* add generated snippets ([#321](https://github.com/googleapis/python-speech/issues/321)) ([ca99f96](https://github.com/googleapis/python-speech/commit/ca99f96d081eed4d2d1409fc5e688a243fa78ae3)) + ## [2.12.0](https://github.com/googleapis/python-speech/compare/v2.11.1...v2.12.0) (2022-01-17) diff --git a/setup.py b/setup.py index b1b28488..5ff1b3bf 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-speech" description = "Google Cloud Speech API client library" -version = "2.12.0" +version = "2.13.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta'