From dea82aa2bbd635d834ab63429679671c0365ece8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:56:25 +0000 Subject: [PATCH 01/15] chore(python): use black==22.3.0 (#149) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 5 +- .../services/executions/async_client.py | 37 +- .../services/executions/client.py | 98 +++- .../services/executions/transports/base.py | 26 +- .../services/executions/transports/grpc.py | 3 +- .../executions_v1/types/executions.py | 158 ++++-- .../services/executions/async_client.py | 37 +- .../services/executions/client.py | 98 +++- .../services/executions/transports/base.py | 26 +- .../services/executions/transports/grpc.py | 3 +- .../executions_v1beta/types/executions.py | 115 ++++- .../services/workflows/async_client.py | 44 +- .../workflows_v1/services/workflows/client.py | 95 +++- .../services/workflows/transports/base.py | 30 +- .../services/workflows/transports/grpc.py | 3 +- google/cloud/workflows_v1/types/workflows.py | 158 ++++-- .../services/workflows/async_client.py | 44 +- .../services/workflows/client.py | 95 +++- .../services/workflows/transports/base.py | 30 +- .../services/workflows/transports/grpc.py | 3 +- .../cloud/workflows_v1beta/types/workflows.py | 158 ++++-- noxfile.py | 9 +- .../gapic/executions_v1/test_executions.py | 426 +++++++++++---- .../executions_v1beta/test_executions.py | 426 +++++++++++---- .../unit/gapic/workflows_v1/test_workflows.py | 485 +++++++++++++----- .../gapic/workflows_v1beta/test_workflows.py | 485 +++++++++++++----- 27 files changed, 2393 insertions(+), 706 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..87dd006 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe 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..04df71d 100644 --- a/google/cloud/workflows/executions_v1/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1/services/executions/async_client.py @@ -299,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. @@ -410,7 +418,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 @@ -502,7 +515,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 @@ -594,7 +612,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 +631,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..0ba3d95 100644 --- a/google/cloud/workflows/executions_v1/services/executions/client.py +++ b/google/cloud/workflows/executions_v1/services/executions/client.py @@ -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 @@ -516,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. @@ -627,7 +668,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 +765,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 +862,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 +888,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..0d08ccd 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() @@ -119,25 +121,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() 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..a8f422b 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 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..0000818 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py @@ -300,12 +300,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. @@ -411,7 +419,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 @@ -503,7 +516,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 @@ -595,7 +613,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 +632,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..efa8b6c 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/client.py @@ -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 @@ -517,12 +550,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. @@ -628,7 +669,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 +766,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 +863,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 +889,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..25d02cc 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() @@ -119,25 +121,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() 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..7dbca61 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 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..9546d68 100644 --- a/google/cloud/workflows_v1/services/workflows/async_client.py +++ b/google/cloud/workflows_v1/services/workflows/async_client.py @@ -299,12 +299,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. @@ -397,7 +405,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 @@ -532,7 +545,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( @@ -652,7 +670,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( @@ -778,7 +801,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 +828,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..b4faa27 100644 --- a/google/cloud/workflows_v1/services/workflows/client.py +++ b/google/cloud/workflows_v1/services/workflows/client.py @@ -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 @@ -500,12 +527,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 +633,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 @@ -733,7 +773,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( @@ -853,7 +898,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( @@ -979,7 +1029,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 +1063,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..a464d5c 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() @@ -121,28 +123,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() diff --git a/google/cloud/workflows_v1/services/workflows/transports/grpc.py b/google/cloud/workflows_v1/services/workflows/transports/grpc.py index 595e077..8fc97df 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 diff --git a/google/cloud/workflows_v1/types/workflows.py b/google/cloud/workflows_v1/types/workflows.py index ba87b00..bf7792a 100644 --- a/google/cloud/workflows_v1/types/workflows.py +++ b/google/cloud/workflows_v1/types/workflows.py @@ -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..d9849be 100644 --- a/google/cloud/workflows_v1beta/services/workflows/async_client.py +++ b/google/cloud/workflows_v1beta/services/workflows/async_client.py @@ -299,12 +299,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. @@ -397,7 +405,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 @@ -532,7 +545,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( @@ -652,7 +670,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( @@ -778,7 +801,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 +828,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..4f618a7 100644 --- a/google/cloud/workflows_v1beta/services/workflows/client.py +++ b/google/cloud/workflows_v1beta/services/workflows/client.py @@ -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 @@ -500,12 +527,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 +633,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 @@ -733,7 +773,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( @@ -853,7 +898,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( @@ -979,7 +1029,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 +1063,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..b639849 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() @@ -121,28 +123,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() diff --git a/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py b/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py index 1f986ca..c39da15 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 diff --git a/google/cloud/workflows_v1beta/types/workflows.py b/google/cloud/workflows_v1beta/types/workflows.py index 3d525ad..9cd98b2 100644 --- a/google/cloud/workflows_v1beta/types/workflows.py +++ b/google/cloud/workflows_v1beta/types/workflows.py @@ -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..3addb4e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/tests/unit/gapic/executions_v1/test_executions.py b/tests/unit/gapic/executions_v1/test_executions.py index bf82cdd..6f6f882 100644 --- a/tests/unit/gapic/executions_v1/test_executions.py +++ b/tests/unit/gapic/executions_v1/test_executions.py @@ -84,7 +84,13 @@ def test__get_default_mtls_endpoint(): assert ExecutionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ExecutionsClient, + ExecutionsAsyncClient, + ], +) def test_executions_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -124,7 +130,13 @@ def test_executions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ExecutionsClient, + ExecutionsAsyncClient, + ], +) def test_executions_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -479,7 +491,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 +621,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 +660,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 +677,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 +689,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,7 +711,9 @@ 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. @@ -706,12 +733,17 @@ 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. @@ -733,11 +765,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 +782,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 +796,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 +825,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 +840,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 +871,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(), executions.Execution(),], + executions=[ + executions.Execution(), + ], + next_page_token="ghi", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) @@ -846,7 +905,8 @@ def test_list_executions_pager(transport_name: str = "grpc"): 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 +921,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 +946,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,16 +964,27 @@ 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(), + ], + next_page_token="ghi", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + 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: @@ -914,7 +996,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,12 +1014,21 @@ 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, ) @@ -946,10 +1039,17 @@ async def test_list_executions_async_pages(): 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 +1088,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 +1105,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,7 +1149,9 @@ 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. @@ -1067,12 +1171,17 @@ 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. @@ -1094,11 +1203,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 +1221,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 +1238,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 +1254,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 +1269,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 +1287,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 +1301,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 +1350,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 +1367,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,7 +1411,9 @@ 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. @@ -1300,12 +1433,17 @@ 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. @@ -1327,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: @@ -1339,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. @@ -1351,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: @@ -1375,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. @@ -1388,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, @@ -1440,7 +1602,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 +1619,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,7 +1663,9 @@ 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. @@ -1519,12 +1685,17 @@ 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. @@ -1546,11 +1717,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 +1734,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 +1748,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 +1777,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 +1792,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 +1812,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 +1833,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 +1852,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 +1883,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. @@ -1702,8 +1898,13 @@ def test_transport_adc(transport_class): 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(): @@ -1751,7 +1952,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 +1988,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 @@ -1903,7 +2108,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 +2121,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 +2227,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 +2255,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 +2298,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 +2318,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 +2338,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 +2360,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 +2386,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 +2396,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 +2405,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..27594e5 100644 --- a/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/tests/unit/gapic/executions_v1beta/test_executions.py @@ -86,7 +86,13 @@ def test__get_default_mtls_endpoint(): assert ExecutionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ExecutionsClient, + ExecutionsAsyncClient, + ], +) def test_executions_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -126,7 +132,13 @@ def test_executions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + ExecutionsClient, + ExecutionsAsyncClient, + ], +) def test_executions_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -481,7 +493,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 +623,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 +662,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 +679,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 +691,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,7 +713,9 @@ 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. @@ -708,12 +735,17 @@ 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. @@ -735,11 +767,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 +784,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 +798,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 +827,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 +842,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 +873,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(), executions.Execution(),], + executions=[ + executions.Execution(), + ], + next_page_token="ghi", + ), + executions.ListExecutionsResponse( + executions=[ + executions.Execution(), + executions.Execution(), + ], ), RuntimeError, ) @@ -848,7 +907,8 @@ def test_list_executions_pager(transport_name: str = "grpc"): 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 +923,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 +948,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,16 +966,27 @@ 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(), + ], + next_page_token="ghi", ), executions.ListExecutionsResponse( - executions=[executions.Execution(), executions.Execution(),], + 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: @@ -916,7 +998,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,12 +1016,21 @@ 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, ) @@ -948,10 +1041,17 @@ async def test_list_executions_async_pages(): 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 +1088,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 +1105,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,7 +1147,9 @@ 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. @@ -1065,12 +1169,17 @@ 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. @@ -1092,11 +1201,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 +1219,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 +1236,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 +1252,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 +1267,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 +1285,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 +1299,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 +1346,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 +1363,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,7 +1405,9 @@ 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. @@ -1294,12 +1427,17 @@ 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. @@ -1321,11 +1459,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 +1476,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 +1490,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 +1519,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 +1534,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 +1594,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 +1611,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,7 +1653,9 @@ 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. @@ -1509,12 +1675,17 @@ 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. @@ -1536,11 +1707,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 +1724,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 +1738,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 +1767,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 +1782,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 +1802,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 +1823,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 +1842,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 +1873,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. @@ -1692,8 +1888,13 @@ def test_transport_adc(transport_class): 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(): @@ -1741,7 +1942,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 +1978,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 @@ -1893,7 +2098,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 +2111,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 +2217,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 +2245,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 +2288,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 +2308,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 +2328,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 +2350,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 +2376,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 +2386,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 +2395,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..922d8c0 100644 --- a/tests/unit/gapic/workflows_v1/test_workflows.py +++ b/tests/unit/gapic/workflows_v1/test_workflows.py @@ -86,7 +86,13 @@ def test__get_default_mtls_endpoint(): assert WorkflowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + WorkflowsClient, + WorkflowsAsyncClient, + ], +) def test_workflows_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -126,7 +132,13 @@ def test_workflows_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + WorkflowsClient, + WorkflowsAsyncClient, + ], +) def test_workflows_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -479,7 +491,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 +621,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 +642,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 +662,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 +679,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,7 +715,9 @@ 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. @@ -711,12 +737,17 @@ 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. @@ -738,11 +769,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 +786,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 +800,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 +829,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 +844,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 +875,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(), + ], + next_page_token="ghi", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -851,7 +909,8 @@ def test_list_workflows_pager(transport_name: str = "grpc"): 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 +925,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(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -882,7 +950,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,16 +968,27 @@ 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: @@ -919,7 +1000,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,12 +1018,21 @@ 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, ) @@ -951,10 +1043,17 @@ async def test_list_workflows_async_pages(): 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 +1091,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 +1108,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,7 +1150,9 @@ 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. @@ -1069,12 +1172,17 @@ 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. @@ -1094,11 +1202,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 +1219,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 +1233,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 +1260,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 +1275,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 +1324,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 +1341,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,7 +1372,9 @@ 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. @@ -1258,12 +1394,17 @@ 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. @@ -1285,11 +1426,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 +1465,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 +1482,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 +1519,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 +1534,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 +1570,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 +1587,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,7 +1618,9 @@ 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. @@ -1477,12 +1640,17 @@ 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. @@ -1504,11 +1672,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 +1689,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 +1703,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 +1732,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 +1747,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 +1796,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 +1813,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,7 +1844,9 @@ 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. @@ -1670,14 +1866,17 @@ 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=workflow.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. @@ -1699,13 +1898,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=workflow.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 +1933,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 +1949,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 +1982,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 +2003,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 +2024,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 +2043,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 +2074,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. @@ -1873,8 +2089,13 @@ def test_transport_adc(transport_class): 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(): @@ -1928,7 +2149,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 +2185,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 @@ -2080,7 +2305,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 +2318,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 +2420,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 +2437,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 +2457,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 +2500,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 +2520,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 +2540,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 +2562,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 +2588,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 +2598,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 +2607,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..3dd69d6 100644 --- a/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/tests/unit/gapic/workflows_v1beta/test_workflows.py @@ -86,7 +86,13 @@ def test__get_default_mtls_endpoint(): assert WorkflowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + WorkflowsClient, + WorkflowsAsyncClient, + ], +) def test_workflows_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -126,7 +132,13 @@ def test_workflows_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + WorkflowsClient, + WorkflowsAsyncClient, + ], +) def test_workflows_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -479,7 +491,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 +621,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 +642,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 +662,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 +679,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,7 +715,9 @@ 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. @@ -711,12 +737,17 @@ 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. @@ -738,11 +769,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 +786,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 +800,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 +829,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 +844,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 +875,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(), + ], + next_page_token="ghi", ), workflows.ListWorkflowsResponse( - workflows=[workflows.Workflow(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -851,7 +909,8 @@ def test_list_workflows_pager(transport_name: str = "grpc"): 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 +925,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(), workflows.Workflow(),], + workflows=[ + workflows.Workflow(), + ], + next_page_token="ghi", + ), + workflows.ListWorkflowsResponse( + workflows=[ + workflows.Workflow(), + workflows.Workflow(), + ], ), RuntimeError, ) @@ -882,7 +950,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,16 +968,27 @@ 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: @@ -919,7 +1000,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,12 +1018,21 @@ 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, ) @@ -951,10 +1043,17 @@ async def test_list_workflows_async_pages(): 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 +1091,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 +1108,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,7 +1150,9 @@ 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. @@ -1069,12 +1172,17 @@ 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. @@ -1094,11 +1202,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 +1219,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 +1233,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 +1260,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 +1275,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 +1324,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 +1341,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,7 +1372,9 @@ 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. @@ -1258,12 +1394,17 @@ 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. @@ -1285,11 +1426,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 +1465,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 +1482,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 +1519,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 +1534,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 +1570,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 +1587,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,7 +1618,9 @@ 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. @@ -1477,12 +1640,17 @@ 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. @@ -1504,11 +1672,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 +1689,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 +1703,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 +1732,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 +1747,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 +1796,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 +1813,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,7 +1844,9 @@ 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. @@ -1670,14 +1866,17 @@ 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=workflow.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. @@ -1699,13 +1898,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=workflow.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 +1933,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 +1949,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 +1982,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 +2003,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 +2024,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 +2043,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 +2074,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. @@ -1873,8 +2089,13 @@ def test_transport_adc(transport_class): 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(): @@ -1928,7 +2149,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 +2185,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 @@ -2080,7 +2305,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 +2318,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 +2420,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 +2437,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 +2457,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 +2500,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 +2520,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 +2540,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 +2562,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 +2588,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 +2598,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 +2607,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" From 1891da4c3ad068a5a6944f81d721d44044fad1d5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 16:46:30 +0000 Subject: [PATCH 02/15] chore(python): add E231 to .flake8 ignore list (#150) Source-Link: https://github.com/googleapis/synthtool/commit/7ff4aad2ec5af0380e8bd6da1fa06eaadf24ec81 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 87dd006..9e0a935 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 From 39496dd1094e7a32331722e720e6a0f2a07fa8cb Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 31 Mar 2022 15:18:17 -0600 Subject: [PATCH 03/15] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#151) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e0a935..22cc254 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:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z 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 From 063de3a604f97fc6de9bb6d7f5338fdba88375bb Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 31 Mar 2022 17:23:52 -0400 Subject: [PATCH 04/15] chore: allow releases on previous majors (#148) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: allow releases on previous majors * chore: use the latest post processor image * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update .OwlBot.lock.yaml Co-authored-by: Owl Bot Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .github/release-please.yml | 6 ++++++ owlbot.py | 1 + 2 files changed, 7 insertions(+) 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/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) From bc5f2d5a31c56c2a6764d2dc53611725e1068422 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 02:10:15 +0000 Subject: [PATCH 05/15] chore(python): Enable size-label bot (#153) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254..58a0b15 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..09c8d73 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From 45226ba9e95a102f988a0ac50c49b6a6334adfd2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:42:14 +0000 Subject: [PATCH 06/15] chore(python): refactor unit / system test dependency install (#154) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b15..fa57622 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 3addb4e..6ee5e8a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_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() @@ -81,23 +105,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( @@ -121,6 +163,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.""" @@ -143,13 +214,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: From 51c3fbcf32ea911b0918c730024fa0a893af3b1c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 07:05:50 -0400 Subject: [PATCH 07/15] chore(python): add license header to auto-label.yaml (#155) Source-Link: https://github.com/googleapis/synthtool/commit/eb78c980b52c7c6746d2edb77d9cf7aaa99a2aab Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa57622..bc893c9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 +# created: 2022-04-06T10:30:21.687684602Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d73..41bff0b 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +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 From f3ec9dadea8a3574a5413c635288242014b1a5ae Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 12 Apr 2022 23:52:11 +0000 Subject: [PATCH 08/15] chore: Use gapic-generator-python 0.65.0 (#158) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 440970084 Source-Link: https://github.com/googleapis/googleapis/commit/5e0a3d57254ab9857ccac77fc6ffade7b69a2dc7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b0c628a3fade768f225d76992791ea1ba2a881be Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 docs: fix type in docstring for map fields --- .../services/executions/async_client.py | 4 +- .../services/executions/client.py | 4 +- .../services/executions/transports/base.py | 5 ++ .../services/executions/transports/grpc.py | 4 + .../services/executions/async_client.py | 4 +- .../services/executions/client.py | 4 +- .../services/executions/transports/base.py | 5 ++ .../services/executions/transports/grpc.py | 4 + .../services/workflows/async_client.py | 6 +- .../workflows_v1/services/workflows/client.py | 6 +- .../services/workflows/transports/base.py | 5 ++ .../services/workflows/transports/grpc.py | 4 + google/cloud/workflows_v1/types/workflows.py | 2 +- .../services/workflows/async_client.py | 6 +- .../services/workflows/client.py | 6 +- .../services/workflows/transports/base.py | 5 ++ .../services/workflows/transports/grpc.py | 4 + .../cloud/workflows_v1beta/types/workflows.py | 2 +- .../gapic/executions_v1/test_executions.py | 81 ++++++++++++++----- .../executions_v1beta/test_executions.py | 81 ++++++++++++++----- .../unit/gapic/workflows_v1/test_workflows.py | 81 ++++++++++++++----- .../gapic/workflows_v1beta/test_workflows.py | 81 ++++++++++++++----- 22 files changed, 294 insertions(+), 110 deletions(-) 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 04df71d..22af024 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,7 +216,6 @@ async def list_executions( executions are ordered by their start time (newest first). - .. code-block:: python from google.cloud.workflows import executions_v1 @@ -331,7 +330,6 @@ 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 diff --git a/google/cloud/workflows/executions_v1/services/executions/client.py b/google/cloud/workflows/executions_v1/services/executions/client.py index 0ba3d95..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 @@ -466,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 @@ -581,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 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 0d08ccd..6b6e7d9 100644 --- a/google/cloud/workflows/executions_v1/services/executions/transports/base.py +++ b/google/cloud/workflows/executions_v1/services/executions/transports/base.py @@ -80,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" @@ -190,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 a8f422b..26f50a5 100644 --- a/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py +++ b/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py @@ -342,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_v1beta/services/executions/async_client.py b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py index 0000818..e17c50d 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,7 +217,6 @@ async def list_executions( executions are ordered by their start time (newest first). - .. code-block:: python from google.cloud.workflows import executions_v1beta @@ -332,7 +331,6 @@ 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 diff --git a/google/cloud/workflows/executions_v1beta/services/executions/client.py b/google/cloud/workflows/executions_v1beta/services/executions/client.py index efa8b6c..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 @@ -467,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 @@ -582,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 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 25d02cc..222fe3d 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py @@ -80,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" @@ -190,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 7dbca61..de7de6d 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py @@ -343,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_v1/services/workflows/async_client.py b/google/cloud/workflows_v1/services/workflows/async_client.py index 9546d68..4a2a442 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,7 +216,6 @@ 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 @@ -431,7 +430,6 @@ 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 @@ -576,7 +574,6 @@ 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 @@ -705,7 +702,6 @@ 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 diff --git a/google/cloud/workflows_v1/services/workflows/client.py b/google/cloud/workflows_v1/services/workflows/client.py index b4faa27..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 @@ -444,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 @@ -659,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 @@ -804,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 @@ -933,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 diff --git a/google/cloud/workflows_v1/services/workflows/transports/base.py b/google/cloud/workflows_v1/services/workflows/transports/base.py index a464d5c..9fb95db 100644 --- a/google/cloud/workflows_v1/services/workflows/transports/base.py +++ b/google/cloud/workflows_v1/services/workflows/transports/base.py @@ -82,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" @@ -210,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 8fc97df..42dc782 100644 --- a/google/cloud/workflows_v1/services/workflows/transports/grpc.py +++ b/google/cloud/workflows_v1/services/workflows/transports/grpc.py @@ -390,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 bf7792a..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 diff --git a/google/cloud/workflows_v1beta/services/workflows/async_client.py b/google/cloud/workflows_v1beta/services/workflows/async_client.py index d9849be..317445c 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,7 +216,6 @@ 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 @@ -431,7 +430,6 @@ 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 @@ -576,7 +574,6 @@ 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 @@ -705,7 +702,6 @@ 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 diff --git a/google/cloud/workflows_v1beta/services/workflows/client.py b/google/cloud/workflows_v1beta/services/workflows/client.py index 4f618a7..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 @@ -444,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 @@ -659,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 @@ -804,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 @@ -933,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 diff --git a/google/cloud/workflows_v1beta/services/workflows/transports/base.py b/google/cloud/workflows_v1beta/services/workflows/transports/base.py index b639849..64ba463 100644 --- a/google/cloud/workflows_v1beta/services/workflows/transports/base.py +++ b/google/cloud/workflows_v1beta/services/workflows/transports/base.py @@ -82,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" @@ -210,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 c39da15..10b4b9f 100644 --- a/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py +++ b/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py @@ -390,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 9cd98b2..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 diff --git a/tests/unit/gapic/executions_v1/test_executions.py b/tests/unit/gapic/executions_v1/test_executions.py index 6f6f882..d4ea4fa 100644 --- a/tests/unit/gapic/executions_v1/test_executions.py +++ b/tests/unit/gapic/executions_v1/test_executions.py @@ -85,24 +85,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ExecutionsClient, - ExecutionsAsyncClient, + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), ], ) -def test_executions_client_from_service_account_info(client_class): +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( @@ -131,27 +131,31 @@ def test_executions_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ExecutionsClient, - ExecutionsAsyncClient, + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), ], ) -def test_executions_client_from_service_account_file(client_class): +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(): @@ -987,7 +991,7 @@ async def test_list_executions_async_pager(): ) 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 @@ -1033,7 +1037,9 @@ async def test_list_executions_async_pages(): 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 @@ -1896,6 +1902,19 @@ 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( @@ -1941,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 @@ -2083,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(): diff --git a/tests/unit/gapic/executions_v1beta/test_executions.py b/tests/unit/gapic/executions_v1beta/test_executions.py index 27594e5..7ed7351 100644 --- a/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/tests/unit/gapic/executions_v1beta/test_executions.py @@ -87,24 +87,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ExecutionsClient, - ExecutionsAsyncClient, + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), ], ) -def test_executions_client_from_service_account_info(client_class): +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( @@ -133,27 +133,31 @@ def test_executions_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - ExecutionsClient, - ExecutionsAsyncClient, + (ExecutionsClient, "grpc"), + (ExecutionsAsyncClient, "grpc_asyncio"), ], ) -def test_executions_client_from_service_account_file(client_class): +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(): @@ -989,7 +993,7 @@ async def test_list_executions_async_pager(): ) 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 @@ -1035,7 +1039,9 @@ async def test_list_executions_async_pages(): 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 @@ -1886,6 +1892,19 @@ 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( @@ -1931,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 @@ -2073,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(): diff --git a/tests/unit/gapic/workflows_v1/test_workflows.py b/tests/unit/gapic/workflows_v1/test_workflows.py index 922d8c0..e7cda83 100644 --- a/tests/unit/gapic/workflows_v1/test_workflows.py +++ b/tests/unit/gapic/workflows_v1/test_workflows.py @@ -87,24 +87,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - WorkflowsClient, - WorkflowsAsyncClient, + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), ], ) -def test_workflows_client_from_service_account_info(client_class): +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( @@ -133,27 +133,31 @@ def test_workflows_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - WorkflowsClient, - WorkflowsAsyncClient, + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), ], ) -def test_workflows_client_from_service_account_file(client_class): +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(): @@ -991,7 +995,7 @@ async def test_list_workflows_async_pager(): ) 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 @@ -1037,7 +1041,9 @@ async def test_list_workflows_async_pages(): 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 @@ -2087,6 +2093,19 @@ 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( @@ -2138,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 @@ -2280,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(): diff --git a/tests/unit/gapic/workflows_v1beta/test_workflows.py b/tests/unit/gapic/workflows_v1beta/test_workflows.py index 3dd69d6..6417f8a 100644 --- a/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/tests/unit/gapic/workflows_v1beta/test_workflows.py @@ -87,24 +87,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - WorkflowsClient, - WorkflowsAsyncClient, + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), ], ) -def test_workflows_client_from_service_account_info(client_class): +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( @@ -133,27 +133,31 @@ def test_workflows_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - WorkflowsClient, - WorkflowsAsyncClient, + (WorkflowsClient, "grpc"), + (WorkflowsAsyncClient, "grpc_asyncio"), ], ) -def test_workflows_client_from_service_account_file(client_class): +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(): @@ -991,7 +995,7 @@ async def test_list_workflows_async_pager(): ) 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 @@ -1037,7 +1041,9 @@ async def test_list_workflows_async_pages(): 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 @@ -2087,6 +2093,19 @@ 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( @@ -2138,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 @@ -2280,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(): From df229da826f86b98699ea525c73e6ace6e7e3f3b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 13:11:54 -0400 Subject: [PATCH 09/15] chore: use gapic-generator-python 0.65.1 (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: https://github.com/googleapis/googleapis/commit/2a273915b3f70fe86c9d2a75470a0b83e48d0abf Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../snippet_metadata_executions_v1.json | 338 +++++++++++++- .../snippet_metadata_executions_v1beta.json | 338 +++++++++++++- .../snippet_metadata_workflows_v1.json | 434 +++++++++++++++++- .../snippet_metadata_workflows_v1beta.json | 434 +++++++++++++++++- 4 files changed, 1472 insertions(+), 72 deletions(-) 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" } ] } From 8ca1650091742a043aa8cd210b69afc42860a5bb Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 21:15:53 -0400 Subject: [PATCH 10/15] chore(python): add nox session to sort python imports (#161) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bc893c9..7c454ab 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 -# created: 2022-04-06T10:30:21.687684602Z + digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 +# created: 2022-04-20T23:42:53.970438194Z diff --git a/noxfile.py b/noxfile.py index 6ee5e8a..92da31f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,7 +25,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +84,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +95,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *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, ) From ae6051afcad75e9c32d08ff49773ac9309a9c74c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 12:15:24 -0400 Subject: [PATCH 11/15] chore(python): use ubuntu 22.04 in docs image (#163) Source-Link: https://github.com/googleapis/synthtool/commit/f15cc72fb401b4861cedebb10af74afe428fb1f8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/docker/docs/Dockerfile | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7c454ab..64f82d6 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 -# created: 2022-04-20T23:42:53.970438194Z + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z 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"] From 623b4ecccebd923d8a8761d672cdbd193a6b3736 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 28 Apr 2022 08:08:51 -0400 Subject: [PATCH 12/15] chore: use gapic-generator-python 0.65.2 (#164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: https://github.com/googleapis/googleapis/commit/f91b6cf82e929280f6562f6110957c654bd9e2e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/16eb36095c294e712c74a1bf23550817b42174e5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/executions/async_client.py | 24 +++++------ .../services/executions/async_client.py | 24 +++++------ .../services/workflows/async_client.py | 30 ++++++------- .../services/workflows/async_client.py | 30 ++++++------- .../gapic/executions_v1/test_executions.py | 34 +++++++-------- .../executions_v1beta/test_executions.py | 34 +++++++-------- .../unit/gapic/workflows_v1/test_workflows.py | 42 +++++++++---------- .../gapic/workflows_v1beta/test_workflows.py | 42 +++++++++---------- 8 files changed, 130 insertions(+), 130 deletions(-) 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 22af024..995cf5b 100644 --- a/google/cloud/workflows/executions_v1/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1/services/executions/async_client.py @@ -220,9 +220,9 @@ async def list_executions( 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( @@ -233,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: @@ -334,9 +334,9 @@ async def create_execution( 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( @@ -344,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) @@ -441,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( @@ -451,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) @@ -538,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( @@ -548,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) 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 e17c50d..dc51e4d 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py @@ -221,9 +221,9 @@ async def list_executions( 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( @@ -234,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: @@ -335,9 +335,9 @@ async def create_execution( 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( @@ -345,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) @@ -442,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( @@ -452,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) @@ -539,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( @@ -549,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) diff --git a/google/cloud/workflows_v1/services/workflows/async_client.py b/google/cloud/workflows_v1/services/workflows/async_client.py index 4a2a442..bd9ae57 100644 --- a/google/cloud/workflows_v1/services/workflows/async_client.py +++ b/google/cloud/workflows_v1/services/workflows/async_client.py @@ -220,9 +220,9 @@ async def list_workflows( 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( @@ -233,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: @@ -332,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( @@ -342,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) @@ -434,9 +434,9 @@ async def create_workflow( 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() @@ -453,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) @@ -578,9 +578,9 @@ async def delete_workflow( 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( @@ -592,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) @@ -706,9 +706,9 @@ async def update_workflow( 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() @@ -723,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) diff --git a/google/cloud/workflows_v1beta/services/workflows/async_client.py b/google/cloud/workflows_v1beta/services/workflows/async_client.py index 317445c..378dc12 100644 --- a/google/cloud/workflows_v1beta/services/workflows/async_client.py +++ b/google/cloud/workflows_v1beta/services/workflows/async_client.py @@ -220,9 +220,9 @@ async def list_workflows( 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( @@ -233,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: @@ -332,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( @@ -342,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) @@ -434,9 +434,9 @@ async def create_workflow( 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() @@ -453,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) @@ -578,9 +578,9 @@ async def delete_workflow( 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( @@ -592,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) @@ -706,9 +706,9 @@ async def update_workflow( 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() @@ -723,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) diff --git a/tests/unit/gapic/executions_v1/test_executions.py b/tests/unit/gapic/executions_v1/test_executions.py index d4ea4fa..5310384 100644 --- a/tests/unit/gapic/executions_v1/test_executions.py +++ b/tests/unit/gapic/executions_v1/test_executions.py @@ -723,7 +723,7 @@ def test_list_executions_field_headers(): # 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: @@ -739,7 +739,7 @@ def test_list_executions_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -753,7 +753,7 @@ async def test_list_executions_field_headers_async(): # 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: @@ -771,7 +771,7 @@ async def test_list_executions_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -902,7 +902,7 @@ 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) @@ -1163,7 +1163,7 @@ def test_create_execution_field_headers(): # 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: @@ -1179,7 +1179,7 @@ def test_create_execution_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1193,7 +1193,7 @@ async def test_create_execution_field_headers_async(): # 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: @@ -1211,7 +1211,7 @@ async def test_create_execution_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1425,7 +1425,7 @@ def test_get_execution_field_headers(): # 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: @@ -1441,7 +1441,7 @@ def test_get_execution_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1455,7 +1455,7 @@ async def test_get_execution_field_headers_async(): # 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: @@ -1473,7 +1473,7 @@ async def test_get_execution_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1677,7 +1677,7 @@ def test_cancel_execution_field_headers(): # 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: @@ -1693,7 +1693,7 @@ def test_cancel_execution_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1707,7 +1707,7 @@ async def test_cancel_execution_field_headers_async(): # 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: @@ -1725,7 +1725,7 @@ async def test_cancel_execution_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/executions_v1beta/test_executions.py b/tests/unit/gapic/executions_v1beta/test_executions.py index 7ed7351..675ed58 100644 --- a/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/tests/unit/gapic/executions_v1beta/test_executions.py @@ -725,7 +725,7 @@ def test_list_executions_field_headers(): # 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: @@ -741,7 +741,7 @@ def test_list_executions_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -755,7 +755,7 @@ async def test_list_executions_field_headers_async(): # 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: @@ -773,7 +773,7 @@ async def test_list_executions_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -904,7 +904,7 @@ 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) @@ -1161,7 +1161,7 @@ def test_create_execution_field_headers(): # 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: @@ -1177,7 +1177,7 @@ def test_create_execution_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1191,7 +1191,7 @@ async def test_create_execution_field_headers_async(): # 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: @@ -1209,7 +1209,7 @@ async def test_create_execution_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1419,7 +1419,7 @@ def test_get_execution_field_headers(): # 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: @@ -1435,7 +1435,7 @@ def test_get_execution_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1449,7 +1449,7 @@ async def test_get_execution_field_headers_async(): # 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: @@ -1467,7 +1467,7 @@ async def test_get_execution_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1667,7 +1667,7 @@ def test_cancel_execution_field_headers(): # 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: @@ -1683,7 +1683,7 @@ def test_cancel_execution_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1697,7 +1697,7 @@ async def test_cancel_execution_field_headers_async(): # 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: @@ -1715,7 +1715,7 @@ async def test_cancel_execution_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/workflows_v1/test_workflows.py b/tests/unit/gapic/workflows_v1/test_workflows.py index e7cda83..be99bcd 100644 --- a/tests/unit/gapic/workflows_v1/test_workflows.py +++ b/tests/unit/gapic/workflows_v1/test_workflows.py @@ -727,7 +727,7 @@ def test_list_workflows_field_headers(): # 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: @@ -743,7 +743,7 @@ def test_list_workflows_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -757,7 +757,7 @@ async def test_list_workflows_field_headers_async(): # 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: @@ -775,7 +775,7 @@ async def test_list_workflows_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -906,7 +906,7 @@ 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) @@ -1164,7 +1164,7 @@ def test_get_workflow_field_headers(): # 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: @@ -1180,7 +1180,7 @@ def test_get_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1194,7 +1194,7 @@ async def test_get_workflow_field_headers_async(): # 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: @@ -1210,7 +1210,7 @@ async def test_get_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1386,7 +1386,7 @@ def test_create_workflow_field_headers(): # 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: @@ -1402,7 +1402,7 @@ def test_create_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1416,7 +1416,7 @@ async def test_create_workflow_field_headers_async(): # 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: @@ -1434,7 +1434,7 @@ async def test_create_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1632,7 +1632,7 @@ def test_delete_workflow_field_headers(): # 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: @@ -1648,7 +1648,7 @@ def test_delete_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1662,7 +1662,7 @@ async def test_delete_workflow_field_headers_async(): # 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: @@ -1680,7 +1680,7 @@ async def test_delete_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1858,7 +1858,7 @@ def test_update_workflow_field_headers(): # 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: @@ -1874,7 +1874,7 @@ def test_update_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workflow.name=workflow.name/value", + "workflow.name=name_value", ) in kw["metadata"] @@ -1888,7 +1888,7 @@ async def test_update_workflow_field_headers_async(): # 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: @@ -1906,7 +1906,7 @@ async def test_update_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workflow.name=workflow.name/value", + "workflow.name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/workflows_v1beta/test_workflows.py b/tests/unit/gapic/workflows_v1beta/test_workflows.py index 6417f8a..dfc95d0 100644 --- a/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/tests/unit/gapic/workflows_v1beta/test_workflows.py @@ -727,7 +727,7 @@ def test_list_workflows_field_headers(): # 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: @@ -743,7 +743,7 @@ def test_list_workflows_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -757,7 +757,7 @@ async def test_list_workflows_field_headers_async(): # 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: @@ -775,7 +775,7 @@ async def test_list_workflows_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -906,7 +906,7 @@ 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) @@ -1164,7 +1164,7 @@ def test_get_workflow_field_headers(): # 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: @@ -1180,7 +1180,7 @@ def test_get_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1194,7 +1194,7 @@ async def test_get_workflow_field_headers_async(): # 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: @@ -1210,7 +1210,7 @@ async def test_get_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1386,7 +1386,7 @@ def test_create_workflow_field_headers(): # 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: @@ -1402,7 +1402,7 @@ def test_create_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1416,7 +1416,7 @@ async def test_create_workflow_field_headers_async(): # 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: @@ -1434,7 +1434,7 @@ async def test_create_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1632,7 +1632,7 @@ def test_delete_workflow_field_headers(): # 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: @@ -1648,7 +1648,7 @@ def test_delete_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1662,7 +1662,7 @@ async def test_delete_workflow_field_headers_async(): # 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: @@ -1680,7 +1680,7 @@ async def test_delete_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1858,7 +1858,7 @@ def test_update_workflow_field_headers(): # 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: @@ -1874,7 +1874,7 @@ def test_update_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workflow.name=workflow.name/value", + "workflow.name=name_value", ) in kw["metadata"] @@ -1888,7 +1888,7 @@ async def test_update_workflow_field_headers_async(): # 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: @@ -1906,7 +1906,7 @@ async def test_update_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "workflow.name=workflow.name/value", + "workflow.name=name_value", ) in kw["metadata"] From d2667f264f020d03f83d4ff5d0fcd4bc5ba5f5cc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 12:10:27 -0400 Subject: [PATCH 13/15] chore: [autoapprove] update readme_gen.py to include autoescape True (#165) Source-Link: https://github.com/googleapis/synthtool/commit/6b4d5a6407d740beb4158b302194a62a4108a8a6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- scripts/readme-gen/readme_gen.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 64f82d6..b631901 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd -# created: 2022-04-21T15:43:16.246106921Z + digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 +# created: 2022-05-05T15:17:27.599381182Z 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') From 88a2adeb85b566f7f8f929e5fbaa520fde5be8da Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 23:26:27 +0000 Subject: [PATCH 14/15] chore(python): auto approve template changes (#166) Source-Link: https://github.com/googleapis/synthtool/commit/453a5d9c9a55d1969240a37d36cec626d20a9024 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-approve.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/auto-approve.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b631901..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 -# created: 2022-05-05T15:17:27.599381182Z + 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" From 8914c76abf3554c7b9745c7a3609c8ab751c89a3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 08:57:19 -0400 Subject: [PATCH 15/15] chore(main): release 1.6.2 (#159) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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/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__))