diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# 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. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index fb3370a..2be2abe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.6.2](https://github.com/googleapis/python-workflows/compare/v1.6.1...v1.6.2) (2022-05-05) + + +### Documentation + +* fix type in docstring for map fields ([f3ec9da](https://github.com/googleapis/python-workflows/commit/f3ec9dadea8a3574a5413c635288242014b1a5ae)) + ### [1.6.1](https://github.com/googleapis/python-workflows/compare/v1.6.0...v1.6.1) (2022-03-05) diff --git a/docs/conf.py b/docs/conf.py index a021284..a0e91f3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/workflows/executions_v1/services/executions/async_client.py b/google/cloud/workflows/executions_v1/services/executions/async_client.py index 4495255..995cf5b 100644 --- a/google/cloud/workflows/executions_v1/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1/services/executions/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,14 +216,13 @@ async def list_executions( executions are ordered by their start time (newest first). - .. code-block:: python from google.cloud.workflows import executions_v1 - def sample_list_executions(): + async def sample_list_executions(): # Create a client - client = executions_v1.ExecutionsClient() + client = executions_v1.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1.ListExecutionsRequest( @@ -234,7 +233,7 @@ def sample_list_executions(): page_result = client.list_executions(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -299,12 +298,20 @@ def sample_list_executions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListExecutionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -323,14 +330,13 @@ async def create_execution( r"""Creates a new execution using the latest revision of the given workflow. - .. code-block:: python from google.cloud.workflows import executions_v1 - def sample_create_execution(): + async def sample_create_execution(): # Create a client - client = executions_v1.ExecutionsClient() + client = executions_v1.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1.CreateExecutionRequest( @@ -338,7 +344,7 @@ def sample_create_execution(): ) # Make the request - response = client.create_execution(request=request) + response = await client.create_execution(request=request) # Handle the response print(response) @@ -410,7 +416,12 @@ def sample_create_execution(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -430,9 +441,9 @@ async def get_execution( from google.cloud.workflows import executions_v1 - def sample_get_execution(): + async def sample_get_execution(): # Create a client - client = executions_v1.ExecutionsClient() + client = executions_v1.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1.GetExecutionRequest( @@ -440,7 +451,7 @@ def sample_get_execution(): ) # Make the request - response = client.get_execution(request=request) + response = await client.get_execution(request=request) # Handle the response print(response) @@ -502,7 +513,12 @@ def sample_get_execution(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -522,9 +538,9 @@ async def cancel_execution( from google.cloud.workflows import executions_v1 - def sample_cancel_execution(): + async def sample_cancel_execution(): # Create a client - client = executions_v1.ExecutionsClient() + client = executions_v1.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1.CancelExecutionRequest( @@ -532,7 +548,7 @@ def sample_cancel_execution(): ) # Make the request - response = client.cancel_execution(request=request) + response = await client.cancel_execution(request=request) # Handle the response print(response) @@ -594,7 +610,12 @@ def sample_cancel_execution(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -608,7 +629,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflow",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflow", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows/executions_v1/services/executions/client.py b/google/cloud/workflows/executions_v1/services/executions/client.py index 995fa0f..12a8003 100644 --- a/google/cloud/workflows/executions_v1/services/executions/client.py +++ b/google/cloud/workflows/executions_v1/services/executions/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class ExecutionsClientMeta(type): _transport_registry["grpc"] = ExecutionsGrpcTransport _transport_registry["grpc_asyncio"] = ExecutionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ExecutionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ExecutionsTransport]: """Returns an appropriate transport class. Args: @@ -162,11 +165,17 @@ def transport(self) -> ExecutionsTransport: @staticmethod def execution_path( - project: str, location: str, workflow: str, execution: str, + project: str, + location: str, + workflow: str, + execution: str, ) -> str: """Returns a fully-qualified execution string.""" return "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}".format( - project=project, location=location, workflow=workflow, execution=execution, + project=project, + location=location, + workflow=workflow, + execution=execution, ) @staticmethod @@ -179,10 +188,16 @@ def parse_execution_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def workflow_path(project: str, location: str, workflow: str,) -> str: + def workflow_path( + project: str, + location: str, + workflow: str, + ) -> str: """Returns a fully-qualified workflow string.""" return "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) @staticmethod @@ -195,7 +210,9 @@ def parse_workflow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -208,9 +225,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -219,9 +240,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -230,9 +255,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -241,10 +270,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -433,7 +466,6 @@ def list_executions( executions are ordered by their start time (newest first). - .. code-block:: python from google.cloud.workflows import executions_v1 @@ -516,12 +548,20 @@ def sample_list_executions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListExecutionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,7 +580,6 @@ def create_execution( r"""Creates a new execution using the latest revision of the given workflow. - .. code-block:: python from google.cloud.workflows import executions_v1 @@ -627,7 +666,12 @@ def sample_create_execution(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -719,7 +763,12 @@ def sample_get_execution(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -811,7 +860,12 @@ def sample_cancel_execution(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -832,7 +886,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflow",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflow", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows/executions_v1/services/executions/transports/base.py b/google/cloud/workflows/executions_v1/services/executions/transports/base.py index 08a4ff7..6b6e7d9 100644 --- a/google/cloud/workflows/executions_v1/services/executions/transports/base.py +++ b/google/cloud/workflows/executions_v1/services/executions/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflow",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflow", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -78,6 +80,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -119,25 +122,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_executions: gapic_v1.method.wrap_method( - self.list_executions, default_timeout=None, client_info=client_info, + self.list_executions, + default_timeout=None, + client_info=client_info, ), self.create_execution: gapic_v1.method.wrap_method( - self.create_execution, default_timeout=None, client_info=client_info, + self.create_execution, + default_timeout=None, + client_info=client_info, ), self.get_execution: gapic_v1.method.wrap_method( - self.get_execution, default_timeout=None, client_info=client_info, + self.get_execution, + default_timeout=None, + client_info=client_info, ), self.cancel_execution: gapic_v1.method.wrap_method( - self.cancel_execution, default_timeout=None, client_info=client_info, + self.cancel_execution, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -180,5 +191,9 @@ def cancel_execution( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ExecutionsTransport",) diff --git a/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py b/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py index c06125b..26f50a5 100644 --- a/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py +++ b/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -343,5 +342,9 @@ def cancel_execution( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ExecutionsGrpcTransport",) diff --git a/google/cloud/workflows/executions_v1/types/executions.py b/google/cloud/workflows/executions_v1/types/executions.py index f3b89e6..ae9a43a 100644 --- a/google/cloud/workflows/executions_v1/types/executions.py +++ b/google/cloud/workflows/executions_v1/types/executions.py @@ -128,14 +128,31 @@ class Position(proto.Message): this stack trace element. """ - line = proto.Field(proto.INT64, number=1,) - column = proto.Field(proto.INT64, number=2,) - length = proto.Field(proto.INT64, number=3,) - - step = proto.Field(proto.STRING, number=1,) - routine = proto.Field(proto.STRING, number=2,) + line = proto.Field( + proto.INT64, + number=1, + ) + column = proto.Field( + proto.INT64, + number=2, + ) + length = proto.Field( + proto.INT64, + number=3, + ) + + step = proto.Field( + proto.STRING, + number=1, + ) + routine = proto.Field( + proto.STRING, + number=2, + ) position = proto.Field( - proto.MESSAGE, number=3, message="Execution.StackTraceElement.Position", + proto.MESSAGE, + number=3, + message="Execution.StackTraceElement.Position", ) class StackTrace(proto.Message): @@ -148,7 +165,9 @@ class StackTrace(proto.Message): """ elements = proto.RepeatedField( - proto.MESSAGE, number=1, message="Execution.StackTraceElement", + proto.MESSAGE, + number=1, + message="Execution.StackTraceElement", ) class Error(proto.Message): @@ -165,21 +184,61 @@ class Error(proto.Message): where error was generated. """ - payload = proto.Field(proto.STRING, number=1,) - context = proto.Field(proto.STRING, number=2,) + payload = proto.Field( + proto.STRING, + number=1, + ) + context = proto.Field( + proto.STRING, + number=2, + ) stack_trace = proto.Field( - proto.MESSAGE, number=3, message="Execution.StackTrace", + proto.MESSAGE, + number=3, + message="Execution.StackTrace", ) - name = proto.Field(proto.STRING, number=1,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - state = proto.Field(proto.ENUM, number=4, enum=State,) - argument = proto.Field(proto.STRING, number=5,) - result = proto.Field(proto.STRING, number=6,) - error = proto.Field(proto.MESSAGE, number=7, message=Error,) - workflow_revision_id = proto.Field(proto.STRING, number=8,) - call_log_level = proto.Field(proto.ENUM, number=9, enum=CallLogLevel,) + name = proto.Field( + proto.STRING, + number=1, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=4, + enum=State, + ) + argument = proto.Field( + proto.STRING, + number=5, + ) + result = proto.Field( + proto.STRING, + number=6, + ) + error = proto.Field( + proto.MESSAGE, + number=7, + message=Error, + ) + workflow_revision_id = proto.Field( + proto.STRING, + number=8, + ) + call_log_level = proto.Field( + proto.ENUM, + number=9, + enum=CallLogLevel, + ) class ListExecutionsRequest(proto.Message): @@ -211,10 +270,23 @@ class ListExecutionsRequest(proto.Message): will default to the BASIC view. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - view = proto.Field(proto.ENUM, number=4, enum="ExecutionView",) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum="ExecutionView", + ) class ListExecutionsResponse(proto.Message): @@ -235,8 +307,15 @@ class ListExecutionsResponse(proto.Message): def raw_page(self): return self - executions = proto.RepeatedField(proto.MESSAGE, number=1, message="Execution",) - next_page_token = proto.Field(proto.STRING, number=2,) + executions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Execution", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class CreateExecutionRequest(proto.Message): @@ -255,8 +334,15 @@ class CreateExecutionRequest(proto.Message): Required. Execution to be created. """ - parent = proto.Field(proto.STRING, number=1,) - execution = proto.Field(proto.MESSAGE, number=2, message="Execution",) + parent = proto.Field( + proto.STRING, + number=1, + ) + execution = proto.Field( + proto.MESSAGE, + number=2, + message="Execution", + ) class GetExecutionRequest(proto.Message): @@ -275,8 +361,15 @@ class GetExecutionRequest(proto.Message): will default to the FULL view. """ - name = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum="ExecutionView",) + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="ExecutionView", + ) class CancelExecutionRequest(proto.Message): @@ -291,7 +384,10 @@ class CancelExecutionRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/workflows/executions_v1beta/services/executions/async_client.py b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py index 0164a42..dc51e4d 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -217,14 +217,13 @@ async def list_executions( executions are ordered by their start time (newest first). - .. code-block:: python from google.cloud.workflows import executions_v1beta - def sample_list_executions(): + async def sample_list_executions(): # Create a client - client = executions_v1beta.ExecutionsClient() + client = executions_v1beta.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1beta.ListExecutionsRequest( @@ -235,7 +234,7 @@ def sample_list_executions(): page_result = client.list_executions(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -300,12 +299,20 @@ def sample_list_executions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListExecutionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -324,14 +331,13 @@ async def create_execution( r"""Creates a new execution using the latest revision of the given workflow. - .. code-block:: python from google.cloud.workflows import executions_v1beta - def sample_create_execution(): + async def sample_create_execution(): # Create a client - client = executions_v1beta.ExecutionsClient() + client = executions_v1beta.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1beta.CreateExecutionRequest( @@ -339,7 +345,7 @@ def sample_create_execution(): ) # Make the request - response = client.create_execution(request=request) + response = await client.create_execution(request=request) # Handle the response print(response) @@ -411,7 +417,12 @@ def sample_create_execution(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -431,9 +442,9 @@ async def get_execution( from google.cloud.workflows import executions_v1beta - def sample_get_execution(): + async def sample_get_execution(): # Create a client - client = executions_v1beta.ExecutionsClient() + client = executions_v1beta.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1beta.GetExecutionRequest( @@ -441,7 +452,7 @@ def sample_get_execution(): ) # Make the request - response = client.get_execution(request=request) + response = await client.get_execution(request=request) # Handle the response print(response) @@ -503,7 +514,12 @@ def sample_get_execution(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -523,9 +539,9 @@ async def cancel_execution( from google.cloud.workflows import executions_v1beta - def sample_cancel_execution(): + async def sample_cancel_execution(): # Create a client - client = executions_v1beta.ExecutionsClient() + client = executions_v1beta.ExecutionsAsyncClient() # Initialize request argument(s) request = executions_v1beta.CancelExecutionRequest( @@ -533,7 +549,7 @@ def sample_cancel_execution(): ) # Make the request - response = client.cancel_execution(request=request) + response = await client.cancel_execution(request=request) # Handle the response print(response) @@ -595,7 +611,12 @@ def sample_cancel_execution(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -609,7 +630,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflow",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflow", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows/executions_v1beta/services/executions/client.py b/google/cloud/workflows/executions_v1beta/services/executions/client.py index cbb9004..990671f 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class ExecutionsClientMeta(type): _transport_registry["grpc"] = ExecutionsGrpcTransport _transport_registry["grpc_asyncio"] = ExecutionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ExecutionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ExecutionsTransport]: """Returns an appropriate transport class. Args: @@ -163,11 +166,17 @@ def transport(self) -> ExecutionsTransport: @staticmethod def execution_path( - project: str, location: str, workflow: str, execution: str, + project: str, + location: str, + workflow: str, + execution: str, ) -> str: """Returns a fully-qualified execution string.""" return "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}".format( - project=project, location=location, workflow=workflow, execution=execution, + project=project, + location=location, + workflow=workflow, + execution=execution, ) @staticmethod @@ -180,10 +189,16 @@ def parse_execution_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def workflow_path(project: str, location: str, workflow: str,) -> str: + def workflow_path( + project: str, + location: str, + workflow: str, + ) -> str: """Returns a fully-qualified workflow string.""" return "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) @staticmethod @@ -196,7 +211,9 @@ def parse_workflow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -209,9 +226,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -220,9 +241,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -231,9 +256,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -242,10 +271,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -434,7 +467,6 @@ def list_executions( executions are ordered by their start time (newest first). - .. code-block:: python from google.cloud.workflows import executions_v1beta @@ -517,12 +549,20 @@ def sample_list_executions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListExecutionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -541,7 +581,6 @@ def create_execution( r"""Creates a new execution using the latest revision of the given workflow. - .. code-block:: python from google.cloud.workflows import executions_v1beta @@ -628,7 +667,12 @@ def sample_create_execution(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -720,7 +764,12 @@ def sample_get_execution(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -812,7 +861,12 @@ def sample_cancel_execution(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -833,7 +887,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflow",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflow", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py b/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py index fee66ca..222fe3d 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflow",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflow", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -78,6 +80,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -119,25 +122,33 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_executions: gapic_v1.method.wrap_method( - self.list_executions, default_timeout=None, client_info=client_info, + self.list_executions, + default_timeout=None, + client_info=client_info, ), self.create_execution: gapic_v1.method.wrap_method( - self.create_execution, default_timeout=None, client_info=client_info, + self.create_execution, + default_timeout=None, + client_info=client_info, ), self.get_execution: gapic_v1.method.wrap_method( - self.get_execution, default_timeout=None, client_info=client_info, + self.get_execution, + default_timeout=None, + client_info=client_info, ), self.cancel_execution: gapic_v1.method.wrap_method( - self.cancel_execution, default_timeout=None, client_info=client_info, + self.cancel_execution, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -180,5 +191,9 @@ def cancel_execution( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ExecutionsTransport",) diff --git a/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py b/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py index 0b49fe0..de7de6d 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py @@ -226,8 +226,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -344,5 +343,9 @@ def cancel_execution( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ExecutionsGrpcTransport",) diff --git a/google/cloud/workflows/executions_v1beta/types/executions.py b/google/cloud/workflows/executions_v1beta/types/executions.py index 442ed2f..41f5458 100644 --- a/google/cloud/workflows/executions_v1beta/types/executions.py +++ b/google/cloud/workflows/executions_v1beta/types/executions.py @@ -94,17 +94,51 @@ class Error(proto.Message): debugging purposes. """ - payload = proto.Field(proto.STRING, number=1,) - context = proto.Field(proto.STRING, number=2,) - - name = proto.Field(proto.STRING, number=1,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - state = proto.Field(proto.ENUM, number=4, enum=State,) - argument = proto.Field(proto.STRING, number=5,) - result = proto.Field(proto.STRING, number=6,) - error = proto.Field(proto.MESSAGE, number=7, message=Error,) - workflow_revision_id = proto.Field(proto.STRING, number=8,) + payload = proto.Field( + proto.STRING, + number=1, + ) + context = proto.Field( + proto.STRING, + number=2, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=4, + enum=State, + ) + argument = proto.Field( + proto.STRING, + number=5, + ) + result = proto.Field( + proto.STRING, + number=6, + ) + error = proto.Field( + proto.MESSAGE, + number=7, + message=Error, + ) + workflow_revision_id = proto.Field( + proto.STRING, + number=8, + ) class ListExecutionsRequest(proto.Message): @@ -138,10 +172,23 @@ class ListExecutionsRequest(proto.Message): will default to the BASIC view. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - view = proto.Field(proto.ENUM, number=4, enum="ExecutionView",) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum="ExecutionView", + ) class ListExecutionsResponse(proto.Message): @@ -162,8 +209,15 @@ class ListExecutionsResponse(proto.Message): def raw_page(self): return self - executions = proto.RepeatedField(proto.MESSAGE, number=1, message="Execution",) - next_page_token = proto.Field(proto.STRING, number=2,) + executions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Execution", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class CreateExecutionRequest(proto.Message): @@ -182,8 +236,15 @@ class CreateExecutionRequest(proto.Message): Required. Execution to be created. """ - parent = proto.Field(proto.STRING, number=1,) - execution = proto.Field(proto.MESSAGE, number=2, message="Execution",) + parent = proto.Field( + proto.STRING, + number=1, + ) + execution = proto.Field( + proto.MESSAGE, + number=2, + message="Execution", + ) class GetExecutionRequest(proto.Message): @@ -202,8 +263,15 @@ class GetExecutionRequest(proto.Message): will default to the FULL view. """ - name = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum="ExecutionView",) + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="ExecutionView", + ) class CancelExecutionRequest(proto.Message): @@ -218,7 +286,10 @@ class CancelExecutionRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/workflows_v1/services/workflows/async_client.py b/google/cloud/workflows_v1/services/workflows/async_client.py index ea13762..bd9ae57 100644 --- a/google/cloud/workflows_v1/services/workflows/async_client.py +++ b/google/cloud/workflows_v1/services/workflows/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,14 +216,13 @@ async def list_workflows( r"""Lists Workflows in a given project and location. The default order is not specified. - .. code-block:: python from google.cloud import workflows_v1 - def sample_list_workflows(): + async def sample_list_workflows(): # Create a client - client = workflows_v1.WorkflowsClient() + client = workflows_v1.WorkflowsAsyncClient() # Initialize request argument(s) request = workflows_v1.ListWorkflowsRequest( @@ -234,7 +233,7 @@ def sample_list_workflows(): page_result = client.list_workflows(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -299,12 +298,20 @@ def sample_list_workflows(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListWorkflowsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -325,9 +332,9 @@ async def get_workflow( from google.cloud import workflows_v1 - def sample_get_workflow(): + async def sample_get_workflow(): # Create a client - client = workflows_v1.WorkflowsClient() + client = workflows_v1.WorkflowsAsyncClient() # Initialize request argument(s) request = workflows_v1.GetWorkflowRequest( @@ -335,7 +342,7 @@ def sample_get_workflow(): ) # Make the request - response = client.get_workflow(request=request) + response = await client.get_workflow(request=request) # Handle the response print(response) @@ -397,7 +404,12 @@ def sample_get_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -418,14 +430,13 @@ async def create_workflow( running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - .. code-block:: python from google.cloud import workflows_v1 - def sample_create_workflow(): + async def sample_create_workflow(): # Create a client - client = workflows_v1.WorkflowsClient() + client = workflows_v1.WorkflowsAsyncClient() # Initialize request argument(s) workflow = workflows_v1.Workflow() @@ -442,7 +453,7 @@ def sample_create_workflow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -532,7 +543,12 @@ def sample_create_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -558,14 +574,13 @@ async def delete_workflow( This method also cancels and deletes all running executions of the workflow. - .. code-block:: python from google.cloud import workflows_v1 - def sample_delete_workflow(): + async def sample_delete_workflow(): # Create a client - client = workflows_v1.WorkflowsClient() + client = workflows_v1.WorkflowsAsyncClient() # Initialize request argument(s) request = workflows_v1.DeleteWorkflowRequest( @@ -577,7 +592,7 @@ def sample_delete_workflow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -652,7 +667,12 @@ def sample_delete_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -682,14 +702,13 @@ async def update_workflow( update operation. In that case, such revision will be used in new workflow executions. - .. code-block:: python from google.cloud import workflows_v1 - def sample_update_workflow(): + async def sample_update_workflow(): # Create a client - client = workflows_v1.WorkflowsClient() + client = workflows_v1.WorkflowsAsyncClient() # Initialize request argument(s) workflow = workflows_v1.Workflow() @@ -704,7 +723,7 @@ def sample_update_workflow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -778,7 +797,12 @@ def sample_update_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -800,7 +824,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflows",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflows", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows_v1/services/workflows/client.py b/google/cloud/workflows_v1/services/workflows/client.py index 435807a..b5d1ef2 100644 --- a/google/cloud/workflows_v1/services/workflows/client.py +++ b/google/cloud/workflows_v1/services/workflows/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -58,7 +58,10 @@ class WorkflowsClientMeta(type): _transport_registry["grpc"] = WorkflowsGrpcTransport _transport_registry["grpc_asyncio"] = WorkflowsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[WorkflowsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[WorkflowsTransport]: """Returns an appropriate transport class. Args: @@ -166,10 +169,16 @@ def transport(self) -> WorkflowsTransport: return self._transport @staticmethod - def workflow_path(project: str, location: str, workflow: str,) -> str: + def workflow_path( + project: str, + location: str, + workflow: str, + ) -> str: """Returns a fully-qualified workflow string.""" return "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) @staticmethod @@ -182,7 +191,9 @@ def parse_workflow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -195,9 +206,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -206,9 +221,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -217,9 +236,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -228,10 +251,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -417,7 +444,6 @@ def list_workflows( r"""Lists Workflows in a given project and location. The default order is not specified. - .. code-block:: python from google.cloud import workflows_v1 @@ -500,12 +526,20 @@ def sample_list_workflows(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListWorkflowsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -598,7 +632,12 @@ def sample_get_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -619,7 +658,6 @@ def create_workflow( running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - .. code-block:: python from google.cloud import workflows_v1 @@ -733,7 +771,12 @@ def sample_create_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -759,7 +802,6 @@ def delete_workflow( This method also cancels and deletes all running executions of the workflow. - .. code-block:: python from google.cloud import workflows_v1 @@ -853,7 +895,12 @@ def sample_delete_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -883,7 +930,6 @@ def update_workflow( update operation. In that case, such revision will be used in new workflow executions. - .. code-block:: python from google.cloud import workflows_v1 @@ -979,7 +1025,12 @@ def sample_update_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1008,7 +1059,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflows",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflows", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows_v1/services/workflows/transports/base.py b/google/cloud/workflows_v1/services/workflows/transports/base.py index 78cfe70..9fb95db 100644 --- a/google/cloud/workflows_v1/services/workflows/transports/base.py +++ b/google/cloud/workflows_v1/services/workflows/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflows",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflows", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -80,6 +82,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -121,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_workflows: gapic_v1.method.wrap_method( - self.list_workflows, default_timeout=None, client_info=client_info, + self.list_workflows, + default_timeout=None, + client_info=client_info, ), self.get_workflow: gapic_v1.method.wrap_method( - self.get_workflow, default_timeout=None, client_info=client_info, + self.get_workflow, + default_timeout=None, + client_info=client_info, ), self.create_workflow: gapic_v1.method.wrap_method( - self.create_workflow, default_timeout=None, client_info=client_info, + self.create_workflow, + default_timeout=None, + client_info=client_info, ), self.delete_workflow: gapic_v1.method.wrap_method( - self.delete_workflow, default_timeout=None, client_info=client_info, + self.delete_workflow, + default_timeout=None, + client_info=client_info, ), self.update_workflow: gapic_v1.method.wrap_method( - self.update_workflow, default_timeout=None, client_info=client_info, + self.update_workflow, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -198,5 +211,9 @@ def update_workflow( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("WorkflowsTransport",) diff --git a/google/cloud/workflows_v1/services/workflows/transports/grpc.py b/google/cloud/workflows_v1/services/workflows/transports/grpc.py index 595e077..42dc782 100644 --- a/google/cloud/workflows_v1/services/workflows/transports/grpc.py +++ b/google/cloud/workflows_v1/services/workflows/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -391,5 +390,9 @@ def update_workflow( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("WorkflowsGrpcTransport",) diff --git a/google/cloud/workflows_v1/types/workflows.py b/google/cloud/workflows_v1/types/workflows.py index ba87b00..888bba6 100644 --- a/google/cloud/workflows_v1/types/workflows.py +++ b/google/cloud/workflows_v1/types/workflows.py @@ -73,7 +73,7 @@ class Workflow(proto.Message): revision_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp that the latest revision of the workflow was created. - labels (Sequence[google.cloud.workflows_v1.types.Workflow.LabelsEntry]): + labels (Mapping[str, str]): Labels associated with this workflow. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and @@ -110,18 +110,52 @@ class State(proto.Enum): STATE_UNSPECIFIED = 0 ACTIVE = 1 - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - state = proto.Field(proto.ENUM, number=3, enum=State,) - revision_id = proto.Field(proto.STRING, number=4,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + revision_id = proto.Field( + proto.STRING, + number=4, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) revision_create_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=8, + ) + service_account = proto.Field( + proto.STRING, + number=9, + ) + source_contents = proto.Field( + proto.STRING, + number=10, + oneof="source_code", ) - labels = proto.MapField(proto.STRING, proto.STRING, number=8,) - service_account = proto.Field(proto.STRING, number=9,) - source_contents = proto.Field(proto.STRING, number=10, oneof="source_code",) class ListWorkflowsRequest(proto.Message): @@ -161,11 +195,26 @@ class ListWorkflowsRequest(proto.Message): in an unspecified order. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListWorkflowsResponse(proto.Message): @@ -188,9 +237,19 @@ class ListWorkflowsResponse(proto.Message): def raw_page(self): return self - workflows = proto.RepeatedField(proto.MESSAGE, number=1, message="Workflow",) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) + workflows = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Workflow", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) class GetWorkflowRequest(proto.Message): @@ -205,7 +264,10 @@ class GetWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateWorkflowRequest(proto.Message): @@ -232,9 +294,19 @@ class CreateWorkflowRequest(proto.Message): - Must be unique within the customer project and location. """ - parent = proto.Field(proto.STRING, number=1,) - workflow = proto.Field(proto.MESSAGE, number=2, message="Workflow",) - workflow_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + workflow = proto.Field( + proto.MESSAGE, + number=2, + message="Workflow", + ) + workflow_id = proto.Field( + proto.STRING, + number=3, + ) class DeleteWorkflowRequest(proto.Message): @@ -249,7 +321,10 @@ class DeleteWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateWorkflowRequest(proto.Message): @@ -265,9 +340,15 @@ class UpdateWorkflowRequest(proto.Message): the entire workflow will be updated. """ - workflow = proto.Field(proto.MESSAGE, number=1, message="Workflow",) + workflow = proto.Field( + proto.MESSAGE, + number=1, + message="Workflow", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -288,11 +369,28 @@ class OperationMetadata(proto.Message): API version used to start the operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - api_version = proto.Field(proto.STRING, number=5,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + api_version = proto.Field( + proto.STRING, + number=5, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/workflows_v1beta/services/workflows/async_client.py b/google/cloud/workflows_v1beta/services/workflows/async_client.py index 43c6fa2..378dc12 100644 --- a/google/cloud/workflows_v1beta/services/workflows/async_client.py +++ b/google/cloud/workflows_v1beta/services/workflows/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,14 +216,13 @@ async def list_workflows( r"""Lists Workflows in a given project and location. The default order is not specified. - .. code-block:: python from google.cloud import workflows_v1beta - def sample_list_workflows(): + async def sample_list_workflows(): # Create a client - client = workflows_v1beta.WorkflowsClient() + client = workflows_v1beta.WorkflowsAsyncClient() # Initialize request argument(s) request = workflows_v1beta.ListWorkflowsRequest( @@ -234,7 +233,7 @@ def sample_list_workflows(): page_result = client.list_workflows(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -299,12 +298,20 @@ def sample_list_workflows(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListWorkflowsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -325,9 +332,9 @@ async def get_workflow( from google.cloud import workflows_v1beta - def sample_get_workflow(): + async def sample_get_workflow(): # Create a client - client = workflows_v1beta.WorkflowsClient() + client = workflows_v1beta.WorkflowsAsyncClient() # Initialize request argument(s) request = workflows_v1beta.GetWorkflowRequest( @@ -335,7 +342,7 @@ def sample_get_workflow(): ) # Make the request - response = client.get_workflow(request=request) + response = await client.get_workflow(request=request) # Handle the response print(response) @@ -397,7 +404,12 @@ def sample_get_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -418,14 +430,13 @@ async def create_workflow( running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - .. code-block:: python from google.cloud import workflows_v1beta - def sample_create_workflow(): + async def sample_create_workflow(): # Create a client - client = workflows_v1beta.WorkflowsClient() + client = workflows_v1beta.WorkflowsAsyncClient() # Initialize request argument(s) workflow = workflows_v1beta.Workflow() @@ -442,7 +453,7 @@ def sample_create_workflow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -532,7 +543,12 @@ def sample_create_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -558,14 +574,13 @@ async def delete_workflow( This method also cancels and deletes all running executions of the workflow. - .. code-block:: python from google.cloud import workflows_v1beta - def sample_delete_workflow(): + async def sample_delete_workflow(): # Create a client - client = workflows_v1beta.WorkflowsClient() + client = workflows_v1beta.WorkflowsAsyncClient() # Initialize request argument(s) request = workflows_v1beta.DeleteWorkflowRequest( @@ -577,7 +592,7 @@ def sample_delete_workflow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -652,7 +667,12 @@ def sample_delete_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -682,14 +702,13 @@ async def update_workflow( update operation. In that case, such revision will be used in new workflow executions. - .. code-block:: python from google.cloud import workflows_v1beta - def sample_update_workflow(): + async def sample_update_workflow(): # Create a client - client = workflows_v1beta.WorkflowsClient() + client = workflows_v1beta.WorkflowsAsyncClient() # Initialize request argument(s) workflow = workflows_v1beta.Workflow() @@ -704,7 +723,7 @@ def sample_update_workflow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -778,7 +797,12 @@ def sample_update_workflow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -800,7 +824,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflows",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflows", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows_v1beta/services/workflows/client.py b/google/cloud/workflows_v1beta/services/workflows/client.py index ef72592..32448a8 100644 --- a/google/cloud/workflows_v1beta/services/workflows/client.py +++ b/google/cloud/workflows_v1beta/services/workflows/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -58,7 +58,10 @@ class WorkflowsClientMeta(type): _transport_registry["grpc"] = WorkflowsGrpcTransport _transport_registry["grpc_asyncio"] = WorkflowsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[WorkflowsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[WorkflowsTransport]: """Returns an appropriate transport class. Args: @@ -166,10 +169,16 @@ def transport(self) -> WorkflowsTransport: return self._transport @staticmethod - def workflow_path(project: str, location: str, workflow: str,) -> str: + def workflow_path( + project: str, + location: str, + workflow: str, + ) -> str: """Returns a fully-qualified workflow string.""" return "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) @staticmethod @@ -182,7 +191,9 @@ def parse_workflow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -195,9 +206,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -206,9 +221,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -217,9 +236,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -228,10 +251,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -417,7 +444,6 @@ def list_workflows( r"""Lists Workflows in a given project and location. The default order is not specified. - .. code-block:: python from google.cloud import workflows_v1beta @@ -500,12 +526,20 @@ def sample_list_workflows(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListWorkflowsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -598,7 +632,12 @@ def sample_get_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -619,7 +658,6 @@ def create_workflow( running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - .. code-block:: python from google.cloud import workflows_v1beta @@ -733,7 +771,12 @@ def sample_create_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -759,7 +802,6 @@ def delete_workflow( This method also cancels and deletes all running executions of the workflow. - .. code-block:: python from google.cloud import workflows_v1beta @@ -853,7 +895,12 @@ def sample_delete_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -883,7 +930,6 @@ def update_workflow( update operation. In that case, such revision will be used in new workflow executions. - .. code-block:: python from google.cloud import workflows_v1beta @@ -979,7 +1025,12 @@ def sample_update_workflow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1008,7 +1059,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflows",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflows", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/workflows_v1beta/services/workflows/transports/base.py b/google/cloud/workflows_v1beta/services/workflows/transports/base.py index e3e208c..64ba463 100644 --- a/google/cloud/workflows_v1beta/services/workflows/transports/base.py +++ b/google/cloud/workflows_v1beta/services/workflows/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-workflows",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-workflows", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -80,6 +82,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -121,28 +124,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_workflows: gapic_v1.method.wrap_method( - self.list_workflows, default_timeout=None, client_info=client_info, + self.list_workflows, + default_timeout=None, + client_info=client_info, ), self.get_workflow: gapic_v1.method.wrap_method( - self.get_workflow, default_timeout=None, client_info=client_info, + self.get_workflow, + default_timeout=None, + client_info=client_info, ), self.create_workflow: gapic_v1.method.wrap_method( - self.create_workflow, default_timeout=None, client_info=client_info, + self.create_workflow, + default_timeout=None, + client_info=client_info, ), self.delete_workflow: gapic_v1.method.wrap_method( - self.delete_workflow, default_timeout=None, client_info=client_info, + self.delete_workflow, + default_timeout=None, + client_info=client_info, ), self.update_workflow: gapic_v1.method.wrap_method( - self.update_workflow, default_timeout=None, client_info=client_info, + self.update_workflow, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -198,5 +211,9 @@ def update_workflow( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("WorkflowsTransport",) diff --git a/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py b/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py index 1f986ca..10b4b9f 100644 --- a/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py +++ b/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -391,5 +390,9 @@ def update_workflow( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("WorkflowsGrpcTransport",) diff --git a/google/cloud/workflows_v1beta/types/workflows.py b/google/cloud/workflows_v1beta/types/workflows.py index 3d525ad..7d1d59d 100644 --- a/google/cloud/workflows_v1beta/types/workflows.py +++ b/google/cloud/workflows_v1beta/types/workflows.py @@ -70,7 +70,7 @@ class Workflow(proto.Message): revision_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp that the latest revision of the workflow was created. - labels (Sequence[google.cloud.workflows_v1beta.types.Workflow.LabelsEntry]): + labels (Mapping[str, str]): Labels associated with this workflow. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and @@ -107,18 +107,52 @@ class State(proto.Enum): STATE_UNSPECIFIED = 0 ACTIVE = 1 - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - state = proto.Field(proto.ENUM, number=3, enum=State,) - revision_id = proto.Field(proto.STRING, number=4,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + revision_id = proto.Field( + proto.STRING, + number=4, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) revision_create_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=8, + ) + service_account = proto.Field( + proto.STRING, + number=9, + ) + source_contents = proto.Field( + proto.STRING, + number=10, + oneof="source_code", ) - labels = proto.MapField(proto.STRING, proto.STRING, number=8,) - service_account = proto.Field(proto.STRING, number=9,) - source_contents = proto.Field(proto.STRING, number=10, oneof="source_code",) class ListWorkflowsRequest(proto.Message): @@ -158,11 +192,26 @@ class ListWorkflowsRequest(proto.Message): in an unspecified order. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListWorkflowsResponse(proto.Message): @@ -185,9 +234,19 @@ class ListWorkflowsResponse(proto.Message): def raw_page(self): return self - workflows = proto.RepeatedField(proto.MESSAGE, number=1, message="Workflow",) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) + workflows = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Workflow", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, + ) class GetWorkflowRequest(proto.Message): @@ -202,7 +261,10 @@ class GetWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateWorkflowRequest(proto.Message): @@ -229,9 +291,19 @@ class CreateWorkflowRequest(proto.Message): - Must be unique within the customer project and location. """ - parent = proto.Field(proto.STRING, number=1,) - workflow = proto.Field(proto.MESSAGE, number=2, message="Workflow",) - workflow_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + workflow = proto.Field( + proto.MESSAGE, + number=2, + message="Workflow", + ) + workflow_id = proto.Field( + proto.STRING, + number=3, + ) class DeleteWorkflowRequest(proto.Message): @@ -246,7 +318,10 @@ class DeleteWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateWorkflowRequest(proto.Message): @@ -262,9 +337,15 @@ class UpdateWorkflowRequest(proto.Message): the entire workflow will be updated. """ - workflow = proto.Field(proto.MESSAGE, number=1, message="Workflow",) + workflow = proto.Field( + proto.MESSAGE, + number=1, + message="Workflow", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -285,11 +366,28 @@ class OperationMetadata(proto.Message): API version used to start the operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - api_version = proto.Field(proto.STRING, number=5,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + api_version = proto.Field( + proto.STRING, + number=5, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..92da31f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,41 @@ import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +82,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +94,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +126,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +184,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +235,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/owlbot.py b/owlbot.py index 73ef18c..4e91774 100644 --- a/owlbot.py +++ b/owlbot.py @@ -107,5 +107,6 @@ def get_staging_dirs( ) # the microgenerator has a good coveragerc file python.py_samples(skip_readmes=True) +python.configure_previous_major_version_branches() s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/samples/generated_samples/snippet_metadata_executions_v1.json b/samples/generated_samples/snippet_metadata_executions_v1.json index 182f24a..4db88ae 100644 --- a/samples/generated_samples/snippet_metadata_executions_v1.json +++ b/samples/generated_samples/snippet_metadata_executions_v1.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.workflows.executions.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-workflows-executions" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.cancel_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "CancelExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.CancelExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.types.Execution", + "shortName": "cancel_execution" }, + "description": "Sample for CancelExecution", "file": "workflowexecutions_v1_generated_executions_cancel_execution_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_cancel_execution_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.cancel_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "CancelExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.CancelExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.types.Execution", + "shortName": "cancel_execution" }, + "description": "Sample for CancelExecution", "file": "workflowexecutions_v1_generated_executions_cancel_execution_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_sync", "segments": [ { @@ -87,19 +168,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_cancel_execution_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.create_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "CreateExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.CreateExecutionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "execution", + "type": "google.cloud.workflows.executions_v1.types.Execution" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.types.Execution", + "shortName": "create_execution" }, + "description": "Sample for CreateExecution", "file": "workflowexecutions_v1_generated_executions_create_execution_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_async", "segments": [ { @@ -132,18 +253,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_create_execution_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.create_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "CreateExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.CreateExecutionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "execution", + "type": "google.cloud.workflows.executions_v1.types.Execution" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.types.Execution", + "shortName": "create_execution" }, + "description": "Sample for CreateExecution", "file": "workflowexecutions_v1_generated_executions_create_execution_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_sync", "segments": [ { @@ -176,19 +337,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_create_execution_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.get_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "GetExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.GetExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.types.Execution", + "shortName": "get_execution" }, + "description": "Sample for GetExecution", "file": "workflowexecutions_v1_generated_executions_get_execution_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_async", "segments": [ { @@ -221,18 +418,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_get_execution_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.get_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "GetExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.GetExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.types.Execution", + "shortName": "get_execution" }, + "description": "Sample for GetExecution", "file": "workflowexecutions_v1_generated_executions_get_execution_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_sync", "segments": [ { @@ -265,19 +498,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_get_execution_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.list_executions", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "ListExecutions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.ListExecutionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.services.executions.pagers.ListExecutionsAsyncPager", + "shortName": "list_executions" }, + "description": "Sample for ListExecutions", "file": "workflowexecutions_v1_generated_executions_list_executions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_async", "segments": [ { @@ -310,18 +579,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_list_executions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.list_executions", "method": { + "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", "service": { + "fullName": "google.cloud.workflows.executions.v1.Executions", "shortName": "Executions" }, "shortName": "ListExecutions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1.types.ListExecutionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1.services.executions.pagers.ListExecutionsPager", + "shortName": "list_executions" }, + "description": "Sample for ListExecutions", "file": "workflowexecutions_v1_generated_executions_list_executions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_sync", "segments": [ { @@ -354,7 +659,8 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1_generated_executions_list_executions_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_executions_v1beta.json b/samples/generated_samples/snippet_metadata_executions_v1beta.json index 8705e5b..1abc39d 100644 --- a/samples/generated_samples/snippet_metadata_executions_v1beta.json +++ b/samples/generated_samples/snippet_metadata_executions_v1beta.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.workflows.executions.v1beta", + "version": "v1beta" + } + ], + "language": "PYTHON", + "name": "google-cloud-workflows-executions" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.cancel_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "CancelExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", + "shortName": "cancel_execution" }, + "description": "Sample for CancelExecution", "file": "workflowexecutions_v1beta_generated_executions_cancel_execution_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_cancel_execution_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.cancel_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "CancelExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", + "shortName": "cancel_execution" }, + "description": "Sample for CancelExecution", "file": "workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_sync", "segments": [ { @@ -87,19 +168,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.create_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "CreateExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "execution", + "type": "google.cloud.workflows.executions_v1beta.types.Execution" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", + "shortName": "create_execution" }, + "description": "Sample for CreateExecution", "file": "workflowexecutions_v1beta_generated_executions_create_execution_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_async", "segments": [ { @@ -132,18 +253,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_create_execution_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.create_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "CreateExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "execution", + "type": "google.cloud.workflows.executions_v1beta.types.Execution" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", + "shortName": "create_execution" }, + "description": "Sample for CreateExecution", "file": "workflowexecutions_v1beta_generated_executions_create_execution_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_sync", "segments": [ { @@ -176,19 +337,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_create_execution_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.get_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "GetExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.GetExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", + "shortName": "get_execution" }, + "description": "Sample for GetExecution", "file": "workflowexecutions_v1beta_generated_executions_get_execution_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_async", "segments": [ { @@ -221,18 +418,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_get_execution_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.get_execution", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "GetExecution" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.GetExecutionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", + "shortName": "get_execution" }, + "description": "Sample for GetExecution", "file": "workflowexecutions_v1beta_generated_executions_get_execution_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_sync", "segments": [ { @@ -265,19 +498,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_get_execution_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", + "shortName": "ExecutionsAsyncClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.list_executions", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "ListExecutions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsAsyncPager", + "shortName": "list_executions" }, + "description": "Sample for ListExecutions", "file": "workflowexecutions_v1beta_generated_executions_list_executions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_async", "segments": [ { @@ -310,18 +579,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_list_executions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", + "shortName": "ExecutionsClient" + }, + "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.list_executions", "method": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", "service": { + "fullName": "google.cloud.workflows.executions.v1beta.Executions", "shortName": "Executions" }, "shortName": "ListExecutions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsPager", + "shortName": "list_executions" }, + "description": "Sample for ListExecutions", "file": "workflowexecutions_v1beta_generated_executions_list_executions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_sync", "segments": [ { @@ -354,7 +659,8 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflowexecutions_v1beta_generated_executions_list_executions_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_workflows_v1.json b/samples/generated_samples/snippet_metadata_workflows_v1.json index f1bd5d3..04c4e65 100644 --- a/samples/generated_samples/snippet_metadata_workflows_v1.json +++ b/samples/generated_samples/snippet_metadata_workflows_v1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.workflows.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-workflows" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient.create_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "CreateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.CreateWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1.types.Workflow" + }, + { + "name": "workflow_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_workflow" }, + "description": "Sample for CreateWorkflow", "file": "workflows_v1_generated_workflows_create_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_CreateWorkflow_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_create_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsClient.create_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "CreateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.CreateWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1.types.Workflow" + }, + { + "name": "workflow_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_workflow" }, + "description": "Sample for CreateWorkflow", "file": "workflows_v1_generated_workflows_create_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_CreateWorkflow_sync", "segments": [ { @@ -87,19 +184,55 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_create_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient.delete_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "DeleteWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.DeleteWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_workflow" }, + "description": "Sample for DeleteWorkflow", "file": "workflows_v1_generated_workflows_delete_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_DeleteWorkflow_async", "segments": [ { @@ -132,18 +265,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_delete_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsClient.delete_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "DeleteWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.DeleteWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_workflow" }, + "description": "Sample for DeleteWorkflow", "file": "workflows_v1_generated_workflows_delete_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_DeleteWorkflow_sync", "segments": [ { @@ -176,19 +345,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_delete_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient.get_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "GetWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.GetWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1.types.Workflow", + "shortName": "get_workflow" }, + "description": "Sample for GetWorkflow", "file": "workflows_v1_generated_workflows_get_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_GetWorkflow_async", "segments": [ { @@ -221,18 +426,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_get_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsClient.get_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "GetWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.GetWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1.types.Workflow", + "shortName": "get_workflow" }, + "description": "Sample for GetWorkflow", "file": "workflows_v1_generated_workflows_get_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_GetWorkflow_sync", "segments": [ { @@ -265,19 +506,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_get_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient.list_workflows", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "ListWorkflows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.ListWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1.services.workflows.pagers.ListWorkflowsAsyncPager", + "shortName": "list_workflows" }, + "description": "Sample for ListWorkflows", "file": "workflows_v1_generated_workflows_list_workflows_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_ListWorkflows_async", "segments": [ { @@ -310,18 +587,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_list_workflows_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsClient.list_workflows", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "ListWorkflows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.ListWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1.services.workflows.pagers.ListWorkflowsPager", + "shortName": "list_workflows" }, + "description": "Sample for ListWorkflows", "file": "workflows_v1_generated_workflows_list_workflows_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_ListWorkflows_sync", "segments": [ { @@ -354,19 +667,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_list_workflows_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsAsyncClient.update_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "UpdateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.UpdateWorkflowRequest" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1.types.Workflow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_workflow" }, + "description": "Sample for UpdateWorkflow", "file": "workflows_v1_generated_workflows_update_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_UpdateWorkflow_async", "segments": [ { @@ -399,18 +752,58 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_update_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1.WorkflowsClient.update_workflow", "method": { + "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1.Workflows", "shortName": "Workflows" }, "shortName": "UpdateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1.types.UpdateWorkflowRequest" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1.types.Workflow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_workflow" }, + "description": "Sample for UpdateWorkflow", "file": "workflows_v1_generated_workflows_update_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1_generated_Workflows_UpdateWorkflow_sync", "segments": [ { @@ -443,7 +836,8 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1_generated_workflows_update_workflow_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_workflows_v1beta.json b/samples/generated_samples/snippet_metadata_workflows_v1beta.json index b1f5514..cff5a0e 100644 --- a/samples/generated_samples/snippet_metadata_workflows_v1beta.json +++ b/samples/generated_samples/snippet_metadata_workflows_v1beta.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.workflows.v1beta", + "version": "v1beta" + } + ], + "language": "PYTHON", + "name": "google-cloud-workflows" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient.create_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "CreateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.CreateWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1beta.types.Workflow" + }, + { + "name": "workflow_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_workflow" }, + "description": "Sample for CreateWorkflow", "file": "workflows_v1beta_generated_workflows_create_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_CreateWorkflow_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_create_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient.create_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "CreateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.CreateWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1beta.types.Workflow" + }, + { + "name": "workflow_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_workflow" }, + "description": "Sample for CreateWorkflow", "file": "workflows_v1beta_generated_workflows_create_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_CreateWorkflow_sync", "segments": [ { @@ -87,19 +184,55 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_create_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient.delete_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "DeleteWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.DeleteWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_workflow" }, + "description": "Sample for DeleteWorkflow", "file": "workflows_v1beta_generated_workflows_delete_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_DeleteWorkflow_async", "segments": [ { @@ -132,18 +265,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_delete_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient.delete_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "DeleteWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.DeleteWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_workflow" }, + "description": "Sample for DeleteWorkflow", "file": "workflows_v1beta_generated_workflows_delete_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_DeleteWorkflow_sync", "segments": [ { @@ -176,19 +345,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_delete_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient.get_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "GetWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.GetWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1beta.types.Workflow", + "shortName": "get_workflow" }, + "description": "Sample for GetWorkflow", "file": "workflows_v1beta_generated_workflows_get_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_GetWorkflow_async", "segments": [ { @@ -221,18 +426,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_get_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient.get_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "GetWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.GetWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1beta.types.Workflow", + "shortName": "get_workflow" }, + "description": "Sample for GetWorkflow", "file": "workflows_v1beta_generated_workflows_get_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_GetWorkflow_sync", "segments": [ { @@ -265,19 +506,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_get_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient.list_workflows", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "ListWorkflows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.ListWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1beta.services.workflows.pagers.ListWorkflowsAsyncPager", + "shortName": "list_workflows" }, + "description": "Sample for ListWorkflows", "file": "workflows_v1beta_generated_workflows_list_workflows_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_ListWorkflows_async", "segments": [ { @@ -310,18 +587,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_list_workflows_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient.list_workflows", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "ListWorkflows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.ListWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.workflows_v1beta.services.workflows.pagers.ListWorkflowsPager", + "shortName": "list_workflows" }, + "description": "Sample for ListWorkflows", "file": "workflows_v1beta_generated_workflows_list_workflows_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_ListWorkflows_sync", "segments": [ { @@ -354,19 +667,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_list_workflows_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient", + "shortName": "WorkflowsAsyncClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsAsyncClient.update_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "UpdateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.UpdateWorkflowRequest" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1beta.types.Workflow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_workflow" }, + "description": "Sample for UpdateWorkflow", "file": "workflows_v1beta_generated_workflows_update_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_UpdateWorkflow_async", "segments": [ { @@ -399,18 +752,58 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_update_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient", + "shortName": "WorkflowsClient" + }, + "fullName": "google.cloud.workflows_v1beta.WorkflowsClient.update_workflow", "method": { + "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", "service": { + "fullName": "google.cloud.workflows.v1beta.Workflows", "shortName": "Workflows" }, "shortName": "UpdateWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.workflows_v1beta.types.UpdateWorkflowRequest" + }, + { + "name": "workflow", + "type": "google.cloud.workflows_v1beta.types.Workflow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_workflow" }, + "description": "Sample for UpdateWorkflow", "file": "workflows_v1beta_generated_workflows_update_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "workflows_v1beta_generated_Workflows_UpdateWorkflow_sync", "segments": [ { @@ -443,7 +836,8 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "workflows_v1beta_generated_workflows_update_workflow_sync.py" } ] } diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index d577a90..70cd7d7 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.6.1" +version = "1.6.2" package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/unit/gapic/executions_v1/test_executions.py b/tests/unit/gapic/executions_v1/test_executions.py index bf82cdd..5310384 100644 --- a/tests/unit/gapic/executions_v1/test_executions.py +++ b/tests/unit/gapic/executions_v1/test_executions.py @@ -84,19 +84,25 @@ def test__get_default_mtls_endpoint(): assert ExecutionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) -def test_executions_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), + ], +) +def test_executions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflowexecutions.googleapis.com:443" + assert client.transport._host == ("workflowexecutions.googleapis.com:443") @pytest.mark.parametrize( @@ -124,22 +130,32 @@ def test_executions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) -def test_executions_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), + ], +) +def test_executions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflowexecutions.googleapis.com:443" + assert client.transport._host == ("workflowexecutions.googleapis.com:443") def test_executions_client_get_transport_class(): @@ -479,7 +495,9 @@ def test_executions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -607,10 +625,17 @@ def test_executions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [executions.ListExecutionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.ListExecutionsRequest, + dict, + ], +) def test_list_executions(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -639,7 +664,8 @@ def test_list_executions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -655,7 +681,8 @@ async def test_list_executions_async( transport: str = "grpc_asyncio", request_type=executions.ListExecutionsRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -666,7 +693,9 @@ async def test_list_executions_async( with mock.patch.object(type(client.transport.list_executions), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - executions.ListExecutionsResponse(next_page_token="next_page_token_value",) + executions.ListExecutionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_executions(request) @@ -686,13 +715,15 @@ async def test_list_executions_async_from_dict(): def test_list_executions_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.ListExecutionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -706,18 +737,23 @@ def test_list_executions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_executions_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.ListExecutionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -733,11 +769,16 @@ async def test_list_executions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_executions_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -745,7 +786,9 @@ def test_list_executions_flattened(): call.return_value = executions.ListExecutionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_executions(parent="parent_value",) + client.list_executions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -757,19 +800,24 @@ def test_list_executions_flattened(): def test_list_executions_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_executions( - executions.ListExecutionsRequest(), parent="parent_value", + executions.ListExecutionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_executions_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -781,7 +829,9 @@ async def test_list_executions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_executions(parent="parent_value",) + response = await client.list_executions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -794,19 +844,23 @@ async def test_list_executions_flattened_async(): @pytest.mark.asyncio async def test_list_executions_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_executions( - executions.ListExecutionsRequest(), parent="parent_value", + executions.ListExecutionsRequest(), + parent="parent_value", ) def test_list_executions_pager(transport_name: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -821,12 +875,21 @@ def test_list_executions_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + ], + next_page_token="ghi", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) @@ -839,14 +902,15 @@ def test_list_executions_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, executions.Execution) for i in results) def test_list_executions_pages(transport_name: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -861,12 +925,21 @@ def test_list_executions_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + ], + next_page_token="ghi", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) @@ -877,7 +950,9 @@ def test_list_executions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_executions_async_pager(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -893,19 +968,30 @@ async def test_list_executions_async_pager(): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + ], + next_page_token="ghi", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) - async_pager = await client.list_executions(request={},) + async_pager = await client.list_executions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -914,7 +1000,9 @@ async def test_list_executions_async_pager(): @pytest.mark.asyncio async def test_list_executions_async_pages(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -930,26 +1018,44 @@ async def test_list_executions_async_pages(): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + ], + next_page_token="ghi", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_executions(request={})).pages: + async for page_ in ( + await client.list_executions(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [executions.CreateExecutionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.CreateExecutionRequest, + dict, + ], +) def test_create_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -988,7 +1094,8 @@ def test_create_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1004,7 +1111,8 @@ async def test_create_execution_async( transport: str = "grpc_asyncio", request_type=executions.CreateExecutionRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1047,13 +1155,15 @@ async def test_create_execution_async_from_dict(): def test_create_execution_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CreateExecutionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1067,18 +1177,23 @@ def test_create_execution_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_execution_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CreateExecutionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1094,11 +1209,16 @@ async def test_create_execution_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_execution_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1107,7 +1227,8 @@ def test_create_execution_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_execution( - parent="parent_value", execution=executions.Execution(name="name_value"), + parent="parent_value", + execution=executions.Execution(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1123,7 +1244,9 @@ def test_create_execution_flattened(): def test_create_execution_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1137,7 +1260,9 @@ def test_create_execution_flattened_error(): @pytest.mark.asyncio async def test_create_execution_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1150,7 +1275,8 @@ async def test_create_execution_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_execution( - parent="parent_value", execution=executions.Execution(name="name_value"), + parent="parent_value", + execution=executions.Execution(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1167,7 +1293,9 @@ async def test_create_execution_flattened_async(): @pytest.mark.asyncio async def test_create_execution_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1179,10 +1307,17 @@ async def test_create_execution_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [executions.GetExecutionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.GetExecutionRequest, + dict, + ], +) def test_get_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1221,7 +1356,8 @@ def test_get_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1237,7 +1373,8 @@ async def test_get_execution_async( transport: str = "grpc_asyncio", request_type=executions.GetExecutionRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1280,13 +1417,15 @@ async def test_get_execution_async_from_dict(): def test_get_execution_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.GetExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1300,18 +1439,23 @@ def test_get_execution_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_execution_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.GetExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1327,11 +1471,16 @@ async def test_get_execution_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_execution_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1339,7 +1488,9 @@ def test_get_execution_flattened(): call.return_value = executions.Execution() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_execution(name="name_value",) + client.get_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1351,19 +1502,24 @@ def test_get_execution_flattened(): def test_get_execution_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_execution( - executions.GetExecutionRequest(), name="name_value", + executions.GetExecutionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_execution_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1375,7 +1531,9 @@ async def test_get_execution_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_execution(name="name_value",) + response = await client.get_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1388,20 +1546,30 @@ async def test_get_execution_flattened_async(): @pytest.mark.asyncio async def test_get_execution_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_execution( - executions.GetExecutionRequest(), name="name_value", + executions.GetExecutionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [executions.CancelExecutionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.CancelExecutionRequest, + dict, + ], +) def test_cancel_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1440,7 +1608,8 @@ def test_cancel_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1456,7 +1625,8 @@ async def test_cancel_execution_async( transport: str = "grpc_asyncio", request_type=executions.CancelExecutionRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1499,13 +1669,15 @@ async def test_cancel_execution_async_from_dict(): def test_cancel_execution_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CancelExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1519,18 +1691,23 @@ def test_cancel_execution_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_cancel_execution_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CancelExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1546,11 +1723,16 @@ async def test_cancel_execution_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_cancel_execution_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1558,7 +1740,9 @@ def test_cancel_execution_flattened(): call.return_value = executions.Execution() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.cancel_execution(name="name_value",) + client.cancel_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1570,19 +1754,24 @@ def test_cancel_execution_flattened(): def test_cancel_execution_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.cancel_execution( - executions.CancelExecutionRequest(), name="name_value", + executions.CancelExecutionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_cancel_execution_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1594,7 +1783,9 @@ async def test_cancel_execution_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.cancel_execution(name="name_value",) + response = await client.cancel_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1607,13 +1798,16 @@ async def test_cancel_execution_flattened_async(): @pytest.mark.asyncio async def test_cancel_execution_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.cancel_execution( - executions.CancelExecutionRequest(), name="name_value", + executions.CancelExecutionRequest(), + name="name_value", ) @@ -1624,7 +1818,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1644,7 +1839,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ExecutionsClient(client_options=options, transport=transport,) + client = ExecutionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1660,7 +1858,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExecutionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1690,7 +1889,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport,], + [ + transports.ExecutionsGrpcTransport, + transports.ExecutionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1700,10 +1902,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ExecutionsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ExecutionsGrpcTransport,) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ExecutionsGrpcTransport, + ) def test_executions_base_transport_error(): @@ -1740,6 +1960,14 @@ def test_executions_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_executions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1751,7 +1979,8 @@ def test_executions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExecutionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1786,7 +2015,10 @@ def test_executions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport,], + [ + transports.ExecutionsGrpcTransport, + transports.ExecutionsGrpcAsyncIOTransport, + ], ) def test_executions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1878,24 +2110,40 @@ def test_executions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_executions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_executions_host_no_port(transport_name): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflowexecutions.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "workflowexecutions.googleapis.com:443" + assert client.transport._host == ("workflowexecutions.googleapis.com:443") -def test_executions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_executions_host_with_port(transport_name): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflowexecutions.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "workflowexecutions.googleapis.com:8000" + assert client.transport._host == ("workflowexecutions.googleapis.com:8000") def test_executions_grpc_transport_channel(): @@ -1903,7 +2151,8 @@ def test_executions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ExecutionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1915,7 +2164,8 @@ def test_executions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ExecutionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2020,7 +2270,10 @@ def test_execution_path(): workflow = "whelk" execution = "octopus" expected = "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}".format( - project=project, location=location, workflow=workflow, execution=execution, + project=project, + location=location, + workflow=workflow, + execution=execution, ) actual = ExecutionsClient.execution_path(project, location, workflow, execution) assert expected == actual @@ -2045,7 +2298,9 @@ def test_workflow_path(): location = "nautilus" workflow = "scallop" expected = "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) actual = ExecutionsClient.workflow_path(project, location, workflow) assert expected == actual @@ -2086,7 +2341,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ExecutionsClient.common_folder_path(folder) assert expected == actual @@ -2104,7 +2361,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ExecutionsClient.common_organization_path(organization) assert expected == actual @@ -2122,7 +2381,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ExecutionsClient.common_project_path(project) assert expected == actual @@ -2142,7 +2403,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ExecutionsClient.common_location_path(project, location) assert expected == actual @@ -2167,7 +2429,8 @@ def test_client_with_default_client_info(): transports.ExecutionsTransport, "_prep_wrapped_messages" ) as prep: client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2176,7 +2439,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ExecutionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2184,7 +2448,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/executions_v1beta/test_executions.py b/tests/unit/gapic/executions_v1beta/test_executions.py index 46a3ba6..675ed58 100644 --- a/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/tests/unit/gapic/executions_v1beta/test_executions.py @@ -86,19 +86,25 @@ def test__get_default_mtls_endpoint(): assert ExecutionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) -def test_executions_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), + ], +) +def test_executions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflowexecutions.googleapis.com:443" + assert client.transport._host == ("workflowexecutions.googleapis.com:443") @pytest.mark.parametrize( @@ -126,22 +132,32 @@ def test_executions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) -def test_executions_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), + ], +) +def test_executions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflowexecutions.googleapis.com:443" + assert client.transport._host == ("workflowexecutions.googleapis.com:443") def test_executions_client_get_transport_class(): @@ -481,7 +497,9 @@ def test_executions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -609,10 +627,17 @@ def test_executions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [executions.ListExecutionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.ListExecutionsRequest, + dict, + ], +) def test_list_executions(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -641,7 +666,8 @@ def test_list_executions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -657,7 +683,8 @@ async def test_list_executions_async( transport: str = "grpc_asyncio", request_type=executions.ListExecutionsRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -668,7 +695,9 @@ async def test_list_executions_async( with mock.patch.object(type(client.transport.list_executions), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - executions.ListExecutionsResponse(next_page_token="next_page_token_value",) + executions.ListExecutionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_executions(request) @@ -688,13 +717,15 @@ async def test_list_executions_async_from_dict(): def test_list_executions_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.ListExecutionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -708,18 +739,23 @@ def test_list_executions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_executions_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.ListExecutionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -735,11 +771,16 @@ async def test_list_executions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_executions_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -747,7 +788,9 @@ def test_list_executions_flattened(): call.return_value = executions.ListExecutionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_executions(parent="parent_value",) + client.list_executions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -759,19 +802,24 @@ def test_list_executions_flattened(): def test_list_executions_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_executions( - executions.ListExecutionsRequest(), parent="parent_value", + executions.ListExecutionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_executions_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_executions), "__call__") as call: @@ -783,7 +831,9 @@ async def test_list_executions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_executions(parent="parent_value",) + response = await client.list_executions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -796,19 +846,23 @@ async def test_list_executions_flattened_async(): @pytest.mark.asyncio async def test_list_executions_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_executions( - executions.ListExecutionsRequest(), parent="parent_value", + executions.ListExecutionsRequest(), + parent="parent_value", ) def test_list_executions_pager(transport_name: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -823,12 +877,21 @@ def test_list_executions_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + ], + next_page_token="ghi", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) @@ -841,14 +904,15 @@ def test_list_executions_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, executions.Execution) for i in results) def test_list_executions_pages(transport_name: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -863,12 +927,21 @@ def test_list_executions_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + ], + next_page_token="ghi", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) @@ -879,7 +952,9 @@ def test_list_executions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_executions_async_pager(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -895,19 +970,30 @@ async def test_list_executions_async_pager(): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + ], + next_page_token="ghi", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) - async_pager = await client.list_executions(request={},) + async_pager = await client.list_executions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -916,7 +1002,9 @@ async def test_list_executions_async_pager(): @pytest.mark.asyncio async def test_list_executions_async_pages(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -932,26 +1020,44 @@ async def test_list_executions_async_pages(): ], next_page_token="abc", ), - executions.ListExecutionsResponse(executions=[], next_page_token="def",), executions.ListExecutionsResponse( - executions=[executions.Execution(),], next_page_token="ghi", + executions=[], + next_page_token="def", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + ], + next_page_token="ghi", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_executions(request={})).pages: + async for page_ in ( + await client.list_executions(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [executions.CreateExecutionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.CreateExecutionRequest, + dict, + ], +) def test_create_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -988,7 +1094,8 @@ def test_create_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1004,7 +1111,8 @@ async def test_create_execution_async( transport: str = "grpc_asyncio", request_type=executions.CreateExecutionRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1045,13 +1153,15 @@ async def test_create_execution_async_from_dict(): def test_create_execution_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CreateExecutionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1065,18 +1175,23 @@ def test_create_execution_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_execution_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CreateExecutionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1092,11 +1207,16 @@ async def test_create_execution_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_execution_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1105,7 +1225,8 @@ def test_create_execution_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_execution( - parent="parent_value", execution=executions.Execution(name="name_value"), + parent="parent_value", + execution=executions.Execution(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1121,7 +1242,9 @@ def test_create_execution_flattened(): def test_create_execution_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1135,7 +1258,9 @@ def test_create_execution_flattened_error(): @pytest.mark.asyncio async def test_create_execution_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_execution), "__call__") as call: @@ -1148,7 +1273,8 @@ async def test_create_execution_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_execution( - parent="parent_value", execution=executions.Execution(name="name_value"), + parent="parent_value", + execution=executions.Execution(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1165,7 +1291,9 @@ async def test_create_execution_flattened_async(): @pytest.mark.asyncio async def test_create_execution_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1177,10 +1305,17 @@ async def test_create_execution_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [executions.GetExecutionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.GetExecutionRequest, + dict, + ], +) def test_get_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1217,7 +1352,8 @@ def test_get_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1233,7 +1369,8 @@ async def test_get_execution_async( transport: str = "grpc_asyncio", request_type=executions.GetExecutionRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1274,13 +1411,15 @@ async def test_get_execution_async_from_dict(): def test_get_execution_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.GetExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1294,18 +1433,23 @@ def test_get_execution_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_execution_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.GetExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1321,11 +1465,16 @@ async def test_get_execution_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_execution_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1333,7 +1482,9 @@ def test_get_execution_flattened(): call.return_value = executions.Execution() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_execution(name="name_value",) + client.get_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1345,19 +1496,24 @@ def test_get_execution_flattened(): def test_get_execution_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_execution( - executions.GetExecutionRequest(), name="name_value", + executions.GetExecutionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_execution_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_execution), "__call__") as call: @@ -1369,7 +1525,9 @@ async def test_get_execution_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_execution(name="name_value",) + response = await client.get_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1382,20 +1540,30 @@ async def test_get_execution_flattened_async(): @pytest.mark.asyncio async def test_get_execution_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_execution( - executions.GetExecutionRequest(), name="name_value", + executions.GetExecutionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [executions.CancelExecutionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + executions.CancelExecutionRequest, + dict, + ], +) def test_cancel_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1432,7 +1600,8 @@ def test_cancel_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1448,7 +1617,8 @@ async def test_cancel_execution_async( transport: str = "grpc_asyncio", request_type=executions.CancelExecutionRequest ): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1489,13 +1659,15 @@ async def test_cancel_execution_async_from_dict(): def test_cancel_execution_field_headers(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CancelExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1509,18 +1681,23 @@ def test_cancel_execution_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_cancel_execution_field_headers_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = executions.CancelExecutionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1536,11 +1713,16 @@ async def test_cancel_execution_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_cancel_execution_flattened(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1548,7 +1730,9 @@ def test_cancel_execution_flattened(): call.return_value = executions.Execution() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.cancel_execution(name="name_value",) + client.cancel_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1560,19 +1744,24 @@ def test_cancel_execution_flattened(): def test_cancel_execution_flattened_error(): - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.cancel_execution( - executions.CancelExecutionRequest(), name="name_value", + executions.CancelExecutionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_cancel_execution_flattened_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_execution), "__call__") as call: @@ -1584,7 +1773,9 @@ async def test_cancel_execution_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.cancel_execution(name="name_value",) + response = await client.cancel_execution( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1597,13 +1788,16 @@ async def test_cancel_execution_flattened_async(): @pytest.mark.asyncio async def test_cancel_execution_flattened_error_async(): - client = ExecutionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExecutionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.cancel_execution( - executions.CancelExecutionRequest(), name="name_value", + executions.CancelExecutionRequest(), + name="name_value", ) @@ -1614,7 +1808,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1634,7 +1829,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ExecutionsClient(client_options=options, transport=transport,) + client = ExecutionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1650,7 +1848,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExecutionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1680,7 +1879,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport,], + [ + transports.ExecutionsGrpcTransport, + transports.ExecutionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1690,10 +1892,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ExecutionsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ExecutionsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ExecutionsGrpcTransport,) + client = ExecutionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ExecutionsGrpcTransport, + ) def test_executions_base_transport_error(): @@ -1730,6 +1950,14 @@ def test_executions_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_executions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1741,7 +1969,8 @@ def test_executions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExecutionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1776,7 +2005,10 @@ def test_executions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport,], + [ + transports.ExecutionsGrpcTransport, + transports.ExecutionsGrpcAsyncIOTransport, + ], ) def test_executions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1868,24 +2100,40 @@ def test_executions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_executions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_executions_host_no_port(transport_name): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflowexecutions.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "workflowexecutions.googleapis.com:443" + assert client.transport._host == ("workflowexecutions.googleapis.com:443") -def test_executions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_executions_host_with_port(transport_name): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflowexecutions.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "workflowexecutions.googleapis.com:8000" + assert client.transport._host == ("workflowexecutions.googleapis.com:8000") def test_executions_grpc_transport_channel(): @@ -1893,7 +2141,8 @@ def test_executions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ExecutionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1905,7 +2154,8 @@ def test_executions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ExecutionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2010,7 +2260,10 @@ def test_execution_path(): workflow = "whelk" execution = "octopus" expected = "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}".format( - project=project, location=location, workflow=workflow, execution=execution, + project=project, + location=location, + workflow=workflow, + execution=execution, ) actual = ExecutionsClient.execution_path(project, location, workflow, execution) assert expected == actual @@ -2035,7 +2288,9 @@ def test_workflow_path(): location = "nautilus" workflow = "scallop" expected = "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) actual = ExecutionsClient.workflow_path(project, location, workflow) assert expected == actual @@ -2076,7 +2331,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ExecutionsClient.common_folder_path(folder) assert expected == actual @@ -2094,7 +2351,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ExecutionsClient.common_organization_path(organization) assert expected == actual @@ -2112,7 +2371,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ExecutionsClient.common_project_path(project) assert expected == actual @@ -2132,7 +2393,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ExecutionsClient.common_location_path(project, location) assert expected == actual @@ -2157,7 +2419,8 @@ def test_client_with_default_client_info(): transports.ExecutionsTransport, "_prep_wrapped_messages" ) as prep: client = ExecutionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2166,7 +2429,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ExecutionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2174,7 +2438,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ExecutionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/workflows_v1/test_workflows.py b/tests/unit/gapic/workflows_v1/test_workflows.py index ee3cb5f..be99bcd 100644 --- a/tests/unit/gapic/workflows_v1/test_workflows.py +++ b/tests/unit/gapic/workflows_v1/test_workflows.py @@ -86,19 +86,25 @@ def test__get_default_mtls_endpoint(): assert WorkflowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) -def test_workflows_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), + ], +) +def test_workflows_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflows.googleapis.com:443" + assert client.transport._host == ("workflows.googleapis.com:443") @pytest.mark.parametrize( @@ -126,22 +132,32 @@ def test_workflows_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) -def test_workflows_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), + ], +) +def test_workflows_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflows.googleapis.com:443" + assert client.transport._host == ("workflows.googleapis.com:443") def test_workflows_client_get_transport_class(): @@ -479,7 +495,9 @@ def test_workflows_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -607,10 +625,17 @@ def test_workflows_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [workflows.ListWorkflowsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.ListWorkflowsRequest, + dict, + ], +) def test_list_workflows(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -621,7 +646,8 @@ def test_list_workflows(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = workflows.ListWorkflowsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_workflows(request) @@ -640,7 +666,8 @@ def test_list_workflows_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -656,7 +683,8 @@ async def test_list_workflows_async( transport: str = "grpc_asyncio", request_type=workflows.ListWorkflowsRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -691,13 +719,15 @@ async def test_list_workflows_async_from_dict(): def test_list_workflows_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.ListWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -711,18 +741,23 @@ def test_list_workflows_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_workflows_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.ListWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -738,11 +773,16 @@ async def test_list_workflows_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_workflows_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -750,7 +790,9 @@ def test_list_workflows_flattened(): call.return_value = workflows.ListWorkflowsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_workflows(parent="parent_value",) + client.list_workflows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -762,19 +804,24 @@ def test_list_workflows_flattened(): def test_list_workflows_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_workflows( - workflows.ListWorkflowsRequest(), parent="parent_value", + workflows.ListWorkflowsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_workflows_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -786,7 +833,9 @@ async def test_list_workflows_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_workflows(parent="parent_value",) + response = await client.list_workflows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -799,19 +848,23 @@ async def test_list_workflows_flattened_async(): @pytest.mark.asyncio async def test_list_workflows_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_workflows( - workflows.ListWorkflowsRequest(), parent="parent_value", + workflows.ListWorkflowsRequest(), + parent="parent_value", ) def test_list_workflows_pager(transport_name: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -826,12 +879,21 @@ def test_list_workflows_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -844,14 +906,15 @@ def test_list_workflows_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, workflows.Workflow) for i in results) def test_list_workflows_pages(transport_name: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -866,12 +929,21 @@ def test_list_workflows_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -882,7 +954,9 @@ def test_list_workflows_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_workflows_async_pager(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -898,19 +972,30 @@ async def test_list_workflows_async_pager(): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) - async_pager = await client.list_workflows(request={},) + async_pager = await client.list_workflows( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -919,7 +1004,9 @@ async def test_list_workflows_async_pager(): @pytest.mark.asyncio async def test_list_workflows_async_pages(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -935,26 +1022,44 @@ async def test_list_workflows_async_pages(): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_workflows(request={})).pages: + async for page_ in ( + await client.list_workflows(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [workflows.GetWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.GetWorkflowRequest, + dict, + ], +) def test_get_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -992,7 +1097,8 @@ def test_get_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1008,7 +1114,8 @@ async def test_get_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.GetWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1049,13 +1156,15 @@ async def test_get_workflow_async_from_dict(): def test_get_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.GetWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1069,18 +1178,23 @@ def test_get_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.GetWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1094,11 +1208,16 @@ async def test_get_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1106,7 +1225,9 @@ def test_get_workflow_flattened(): call.return_value = workflows.Workflow() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_workflow(name="name_value",) + client.get_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1118,19 +1239,24 @@ def test_get_workflow_flattened(): def test_get_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_workflow( - workflows.GetWorkflowRequest(), name="name_value", + workflows.GetWorkflowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1140,7 +1266,9 @@ async def test_get_workflow_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(workflows.Workflow()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_workflow(name="name_value",) + response = await client.get_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1153,20 +1281,30 @@ async def test_get_workflow_flattened_async(): @pytest.mark.asyncio async def test_get_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_workflow( - workflows.GetWorkflowRequest(), name="name_value", + workflows.GetWorkflowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [workflows.CreateWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.CreateWorkflowRequest, + dict, + ], +) def test_create_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1192,7 +1330,8 @@ def test_create_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1208,7 +1347,8 @@ async def test_create_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.CreateWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1238,13 +1378,15 @@ async def test_create_workflow_async_from_dict(): def test_create_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.CreateWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1258,18 +1400,23 @@ def test_create_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.CreateWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1285,11 +1432,16 @@ async def test_create_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1319,7 +1471,9 @@ def test_create_workflow_flattened(): def test_create_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1334,7 +1488,9 @@ def test_create_workflow_flattened_error(): @pytest.mark.asyncio async def test_create_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1369,7 +1525,9 @@ async def test_create_workflow_flattened_async(): @pytest.mark.asyncio async def test_create_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1382,10 +1540,17 @@ async def test_create_workflow_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [workflows.DeleteWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.DeleteWorkflowRequest, + dict, + ], +) def test_delete_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1411,7 +1576,8 @@ def test_delete_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1427,7 +1593,8 @@ async def test_delete_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.DeleteWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1457,13 +1624,15 @@ async def test_delete_workflow_async_from_dict(): def test_delete_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.DeleteWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1477,18 +1646,23 @@ def test_delete_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.DeleteWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1504,11 +1678,16 @@ async def test_delete_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1516,7 +1695,9 @@ def test_delete_workflow_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_workflow(name="name_value",) + client.delete_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1528,19 +1709,24 @@ def test_delete_workflow_flattened(): def test_delete_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_workflow( - workflows.DeleteWorkflowRequest(), name="name_value", + workflows.DeleteWorkflowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1552,7 +1738,9 @@ async def test_delete_workflow_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_workflow(name="name_value",) + response = await client.delete_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1565,20 +1753,30 @@ async def test_delete_workflow_flattened_async(): @pytest.mark.asyncio async def test_delete_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_workflow( - workflows.DeleteWorkflowRequest(), name="name_value", + workflows.DeleteWorkflowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [workflows.UpdateWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.UpdateWorkflowRequest, + dict, + ], +) def test_update_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1604,7 +1802,8 @@ def test_update_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1620,7 +1819,8 @@ async def test_update_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.UpdateWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1650,13 +1850,15 @@ async def test_update_workflow_async_from_dict(): def test_update_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.UpdateWorkflowRequest() - request.workflow.name = "workflow.name/value" + request.workflow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1670,20 +1872,23 @@ def test_update_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "workflow.name=workflow.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "workflow.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.UpdateWorkflowRequest() - request.workflow.name = "workflow.name/value" + request.workflow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1699,13 +1904,16 @@ async def test_update_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "workflow.name=workflow.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "workflow.name=name_value", + ) in kw["metadata"] def test_update_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1731,7 +1939,9 @@ def test_update_workflow_flattened(): def test_update_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1745,7 +1955,9 @@ def test_update_workflow_flattened_error(): @pytest.mark.asyncio async def test_update_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1776,7 +1988,9 @@ async def test_update_workflow_flattened_async(): @pytest.mark.asyncio async def test_update_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1795,7 +2009,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1815,7 +2030,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = WorkflowsClient(client_options=options, transport=transport,) + client = WorkflowsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1831,7 +2049,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WorkflowsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1861,7 +2080,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.WorkflowsGrpcTransport, transports.WorkflowsGrpcAsyncIOTransport,], + [ + transports.WorkflowsGrpcTransport, + transports.WorkflowsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1871,10 +2093,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = WorkflowsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.WorkflowsGrpcTransport,) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.WorkflowsGrpcTransport, + ) def test_workflows_base_transport_error(): @@ -1917,6 +2157,14 @@ def test_workflows_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_workflows_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1928,7 +2176,8 @@ def test_workflows_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.WorkflowsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1963,7 +2212,10 @@ def test_workflows_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.WorkflowsGrpcTransport, transports.WorkflowsGrpcAsyncIOTransport,], + [ + transports.WorkflowsGrpcTransport, + transports.WorkflowsGrpcAsyncIOTransport, + ], ) def test_workflows_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2055,24 +2307,40 @@ def test_workflows_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_workflows_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_workflows_host_no_port(transport_name): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflows.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "workflows.googleapis.com:443" + assert client.transport._host == ("workflows.googleapis.com:443") -def test_workflows_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_workflows_host_with_port(transport_name): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflows.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "workflows.googleapis.com:8000" + assert client.transport._host == ("workflows.googleapis.com:8000") def test_workflows_grpc_transport_channel(): @@ -2080,7 +2348,8 @@ def test_workflows_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.WorkflowsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2092,7 +2361,8 @@ def test_workflows_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.WorkflowsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2193,12 +2463,16 @@ def test_workflows_transport_channel_mtls_with_adc(transport_class): def test_workflows_grpc_lro_client(): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2206,12 +2480,16 @@ def test_workflows_grpc_lro_client(): def test_workflows_grpc_lro_async_client(): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2222,7 +2500,9 @@ def test_workflow_path(): location = "clam" workflow = "whelk" expected = "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) actual = WorkflowsClient.workflow_path(project, location, workflow) assert expected == actual @@ -2263,7 +2543,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = WorkflowsClient.common_folder_path(folder) assert expected == actual @@ -2281,7 +2563,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = WorkflowsClient.common_organization_path(organization) assert expected == actual @@ -2299,7 +2583,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = WorkflowsClient.common_project_path(project) assert expected == actual @@ -2319,7 +2605,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = WorkflowsClient.common_location_path(project, location) assert expected == actual @@ -2344,7 +2631,8 @@ def test_client_with_default_client_info(): transports.WorkflowsTransport, "_prep_wrapped_messages" ) as prep: client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2353,7 +2641,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = WorkflowsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2361,7 +2650,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/workflows_v1beta/test_workflows.py b/tests/unit/gapic/workflows_v1beta/test_workflows.py index ecccb98..dfc95d0 100644 --- a/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/tests/unit/gapic/workflows_v1beta/test_workflows.py @@ -86,19 +86,25 @@ def test__get_default_mtls_endpoint(): assert WorkflowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) -def test_workflows_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), + ], +) +def test_workflows_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflows.googleapis.com:443" + assert client.transport._host == ("workflows.googleapis.com:443") @pytest.mark.parametrize( @@ -126,22 +132,32 @@ def test_workflows_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) -def test_workflows_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), + ], +) +def test_workflows_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "workflows.googleapis.com:443" + assert client.transport._host == ("workflows.googleapis.com:443") def test_workflows_client_get_transport_class(): @@ -479,7 +495,9 @@ def test_workflows_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -607,10 +625,17 @@ def test_workflows_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [workflows.ListWorkflowsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.ListWorkflowsRequest, + dict, + ], +) def test_list_workflows(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -621,7 +646,8 @@ def test_list_workflows(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = workflows.ListWorkflowsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_workflows(request) @@ -640,7 +666,8 @@ def test_list_workflows_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -656,7 +683,8 @@ async def test_list_workflows_async( transport: str = "grpc_asyncio", request_type=workflows.ListWorkflowsRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -691,13 +719,15 @@ async def test_list_workflows_async_from_dict(): def test_list_workflows_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.ListWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -711,18 +741,23 @@ def test_list_workflows_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_workflows_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.ListWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -738,11 +773,16 @@ async def test_list_workflows_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_workflows_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -750,7 +790,9 @@ def test_list_workflows_flattened(): call.return_value = workflows.ListWorkflowsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_workflows(parent="parent_value",) + client.list_workflows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -762,19 +804,24 @@ def test_list_workflows_flattened(): def test_list_workflows_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_workflows( - workflows.ListWorkflowsRequest(), parent="parent_value", + workflows.ListWorkflowsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_workflows_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_workflows), "__call__") as call: @@ -786,7 +833,9 @@ async def test_list_workflows_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_workflows(parent="parent_value",) + response = await client.list_workflows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -799,19 +848,23 @@ async def test_list_workflows_flattened_async(): @pytest.mark.asyncio async def test_list_workflows_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_workflows( - workflows.ListWorkflowsRequest(), parent="parent_value", + workflows.ListWorkflowsRequest(), + parent="parent_value", ) def test_list_workflows_pager(transport_name: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -826,12 +879,21 @@ def test_list_workflows_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -844,14 +906,15 @@ def test_list_workflows_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, workflows.Workflow) for i in results) def test_list_workflows_pages(transport_name: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -866,12 +929,21 @@ def test_list_workflows_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -882,7 +954,9 @@ def test_list_workflows_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_workflows_async_pager(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -898,19 +972,30 @@ async def test_list_workflows_async_pager(): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) - async_pager = await client.list_workflows(request={},) + async_pager = await client.list_workflows( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -919,7 +1004,9 @@ async def test_list_workflows_async_pager(): @pytest.mark.asyncio async def test_list_workflows_async_pages(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -935,26 +1022,44 @@ async def test_list_workflows_async_pages(): ], next_page_token="abc", ), - workflows.ListWorkflowsResponse(workflows=[], next_page_token="def",), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(),], next_page_token="ghi", + workflows=[], + next_page_token="def", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_workflows(request={})).pages: + async for page_ in ( + await client.list_workflows(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [workflows.GetWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.GetWorkflowRequest, + dict, + ], +) def test_get_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -992,7 +1097,8 @@ def test_get_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1008,7 +1114,8 @@ async def test_get_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.GetWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1049,13 +1156,15 @@ async def test_get_workflow_async_from_dict(): def test_get_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.GetWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1069,18 +1178,23 @@ def test_get_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.GetWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1094,11 +1208,16 @@ async def test_get_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1106,7 +1225,9 @@ def test_get_workflow_flattened(): call.return_value = workflows.Workflow() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_workflow(name="name_value",) + client.get_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1118,19 +1239,24 @@ def test_get_workflow_flattened(): def test_get_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_workflow( - workflows.GetWorkflowRequest(), name="name_value", + workflows.GetWorkflowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_workflow), "__call__") as call: @@ -1140,7 +1266,9 @@ async def test_get_workflow_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(workflows.Workflow()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_workflow(name="name_value",) + response = await client.get_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1153,20 +1281,30 @@ async def test_get_workflow_flattened_async(): @pytest.mark.asyncio async def test_get_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_workflow( - workflows.GetWorkflowRequest(), name="name_value", + workflows.GetWorkflowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [workflows.CreateWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.CreateWorkflowRequest, + dict, + ], +) def test_create_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1192,7 +1330,8 @@ def test_create_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1208,7 +1347,8 @@ async def test_create_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.CreateWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1238,13 +1378,15 @@ async def test_create_workflow_async_from_dict(): def test_create_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.CreateWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1258,18 +1400,23 @@ def test_create_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.CreateWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1285,11 +1432,16 @@ async def test_create_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1319,7 +1471,9 @@ def test_create_workflow_flattened(): def test_create_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1334,7 +1488,9 @@ def test_create_workflow_flattened_error(): @pytest.mark.asyncio async def test_create_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_workflow), "__call__") as call: @@ -1369,7 +1525,9 @@ async def test_create_workflow_flattened_async(): @pytest.mark.asyncio async def test_create_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1382,10 +1540,17 @@ async def test_create_workflow_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [workflows.DeleteWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.DeleteWorkflowRequest, + dict, + ], +) def test_delete_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1411,7 +1576,8 @@ def test_delete_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1427,7 +1593,8 @@ async def test_delete_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.DeleteWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1457,13 +1624,15 @@ async def test_delete_workflow_async_from_dict(): def test_delete_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.DeleteWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1477,18 +1646,23 @@ def test_delete_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.DeleteWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1504,11 +1678,16 @@ async def test_delete_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1516,7 +1695,9 @@ def test_delete_workflow_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_workflow(name="name_value",) + client.delete_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1528,19 +1709,24 @@ def test_delete_workflow_flattened(): def test_delete_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_workflow( - workflows.DeleteWorkflowRequest(), name="name_value", + workflows.DeleteWorkflowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_workflow), "__call__") as call: @@ -1552,7 +1738,9 @@ async def test_delete_workflow_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_workflow(name="name_value",) + response = await client.delete_workflow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1565,20 +1753,30 @@ async def test_delete_workflow_flattened_async(): @pytest.mark.asyncio async def test_delete_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_workflow( - workflows.DeleteWorkflowRequest(), name="name_value", + workflows.DeleteWorkflowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [workflows.UpdateWorkflowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + workflows.UpdateWorkflowRequest, + dict, + ], +) def test_update_workflow(request_type, transport: str = "grpc"): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1604,7 +1802,8 @@ def test_update_workflow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1620,7 +1819,8 @@ async def test_update_workflow_async( transport: str = "grpc_asyncio", request_type=workflows.UpdateWorkflowRequest ): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1650,13 +1850,15 @@ async def test_update_workflow_async_from_dict(): def test_update_workflow_field_headers(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.UpdateWorkflowRequest() - request.workflow.name = "workflow.name/value" + request.workflow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1670,20 +1872,23 @@ def test_update_workflow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "workflow.name=workflow.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "workflow.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_workflow_field_headers_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = workflows.UpdateWorkflowRequest() - request.workflow.name = "workflow.name/value" + request.workflow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1699,13 +1904,16 @@ async def test_update_workflow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "workflow.name=workflow.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "workflow.name=name_value", + ) in kw["metadata"] def test_update_workflow_flattened(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1731,7 +1939,9 @@ def test_update_workflow_flattened(): def test_update_workflow_flattened_error(): - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1745,7 +1955,9 @@ def test_update_workflow_flattened_error(): @pytest.mark.asyncio async def test_update_workflow_flattened_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_workflow), "__call__") as call: @@ -1776,7 +1988,9 @@ async def test_update_workflow_flattened_async(): @pytest.mark.asyncio async def test_update_workflow_flattened_error_async(): - client = WorkflowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WorkflowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1795,7 +2009,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1815,7 +2030,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = WorkflowsClient(client_options=options, transport=transport,) + client = WorkflowsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1831,7 +2049,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WorkflowsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1861,7 +2080,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.WorkflowsGrpcTransport, transports.WorkflowsGrpcAsyncIOTransport,], + [ + transports.WorkflowsGrpcTransport, + transports.WorkflowsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1871,10 +2093,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = WorkflowsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = WorkflowsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.WorkflowsGrpcTransport,) + client = WorkflowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.WorkflowsGrpcTransport, + ) def test_workflows_base_transport_error(): @@ -1917,6 +2157,14 @@ def test_workflows_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_workflows_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1928,7 +2176,8 @@ def test_workflows_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.WorkflowsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1963,7 +2212,10 @@ def test_workflows_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.WorkflowsGrpcTransport, transports.WorkflowsGrpcAsyncIOTransport,], + [ + transports.WorkflowsGrpcTransport, + transports.WorkflowsGrpcAsyncIOTransport, + ], ) def test_workflows_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2055,24 +2307,40 @@ def test_workflows_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_workflows_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_workflows_host_no_port(transport_name): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflows.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "workflows.googleapis.com:443" + assert client.transport._host == ("workflows.googleapis.com:443") -def test_workflows_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_workflows_host_with_port(transport_name): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="workflows.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "workflows.googleapis.com:8000" + assert client.transport._host == ("workflows.googleapis.com:8000") def test_workflows_grpc_transport_channel(): @@ -2080,7 +2348,8 @@ def test_workflows_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.WorkflowsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2092,7 +2361,8 @@ def test_workflows_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.WorkflowsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2193,12 +2463,16 @@ def test_workflows_transport_channel_mtls_with_adc(transport_class): def test_workflows_grpc_lro_client(): client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2206,12 +2480,16 @@ def test_workflows_grpc_lro_client(): def test_workflows_grpc_lro_async_client(): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2222,7 +2500,9 @@ def test_workflow_path(): location = "clam" workflow = "whelk" expected = "projects/{project}/locations/{location}/workflows/{workflow}".format( - project=project, location=location, workflow=workflow, + project=project, + location=location, + workflow=workflow, ) actual = WorkflowsClient.workflow_path(project, location, workflow) assert expected == actual @@ -2263,7 +2543,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = WorkflowsClient.common_folder_path(folder) assert expected == actual @@ -2281,7 +2563,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = WorkflowsClient.common_organization_path(organization) assert expected == actual @@ -2299,7 +2583,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = WorkflowsClient.common_project_path(project) assert expected == actual @@ -2319,7 +2605,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = WorkflowsClient.common_location_path(project, location) assert expected == actual @@ -2344,7 +2631,8 @@ def test_client_with_default_client_info(): transports.WorkflowsTransport, "_prep_wrapped_messages" ) as prep: client = WorkflowsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2353,7 +2641,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = WorkflowsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2361,7 +2650,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = WorkflowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"