From b5792050a6059c359681032838a993cf724615cb 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:54:48 +0000 Subject: [PATCH] chore(python): use black==22.3.0 (#396) 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 +- packages/google-cloud-asset/docs/conf.py | 13 +- .../services/asset_service/async_client.py | 108 +- .../asset_v1/services/asset_service/client.py | 193 +++- .../services/asset_service/transports/base.py | 26 +- .../services/asset_service/transports/grpc.py | 3 +- .../cloud/asset_v1/types/asset_service.py | 596 ++++++++-- .../google/cloud/asset_v1/types/assets.py | 452 ++++++-- .../services/asset_service/async_client.py | 28 +- .../services/asset_service/client.py | 69 +- .../services/asset_service/transports/base.py | 10 +- .../services/asset_service/transports/grpc.py | 3 +- .../asset_v1p1beta1/types/asset_service.py | 68 +- .../cloud/asset_v1p1beta1/types/assets.py | 84 +- .../services/asset_service/async_client.py | 37 +- .../services/asset_service/client.py | 88 +- .../services/asset_service/transports/base.py | 18 +- .../services/asset_service/transports/grpc.py | 3 +- .../asset_v1p2beta1/types/asset_service.py | 93 +- .../cloud/asset_v1p2beta1/types/assets.py | 94 +- .../services/asset_service/async_client.py | 18 +- .../services/asset_service/client.py | 59 +- .../services/asset_service/transports/base.py | 10 +- .../services/asset_service/transports/grpc.py | 3 +- .../asset_v1p4beta1/types/asset_service.py | 177 ++- .../cloud/asset_v1p4beta1/types/assets.py | 106 +- .../services/asset_service/async_client.py | 16 +- .../services/asset_service/client.py | 81 +- .../services/asset_service/transports/base.py | 10 +- .../services/asset_service/transports/grpc.py | 3 +- .../asset_v1p5beta1/types/asset_service.py | 55 +- .../cloud/asset_v1p5beta1/types/assets.py | 68 +- packages/google-cloud-asset/noxfile.py | 9 +- .../samples/snippets/noxfile.py | 2 +- .../unit/gapic/asset_v1/test_asset_service.py | 1005 +++++++++++++---- .../asset_v1p1beta1/test_asset_service.py | 285 +++-- .../asset_v1p2beta1/test_asset_service.py | 397 +++++-- .../asset_v1p4beta1/test_asset_service.py | 145 ++- .../asset_v1p5beta1/test_asset_service.py | 236 +++- 39 files changed, 3644 insertions(+), 1029 deletions(-) diff --git a/packages/google-cloud-asset/.github/.OwlBot.lock.yaml b/packages/google-cloud-asset/.github/.OwlBot.lock.yaml index 44c78f7cc12d..87dd00611576 100644 --- a/packages/google-cloud-asset/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-asset/.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/packages/google-cloud-asset/docs/conf.py b/packages/google-cloud-asset/docs/conf.py index 9b9e60cba417..38249472c335 100644 --- a/packages/google-cloud-asset/docs/conf.py +++ b/packages/google-cloud-asset/docs/conf.py @@ -314,7 +314,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (root_doc, "google-cloud-asset", "google-cloud-asset Documentation", [author], 1,) + ( + root_doc, + "google-cloud-asset", + "google-cloud-asset Documentation", + [author], + 1, + ) ] # If true, show URL addresses after external links. @@ -355,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/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/async_client.py b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/async_client.py index 1426560c2457..0c02d6a25219 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/async_client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/async_client.py @@ -302,7 +302,12 @@ def sample_export_assets(): ) # 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( @@ -417,12 +422,20 @@ def sample_list_assets(): ) # 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.ListAssetsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -505,7 +518,12 @@ def sample_batch_get_assets_history(): ) # 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 @@ -614,7 +632,12 @@ def sample_create_feed(): ) # 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 @@ -720,7 +743,12 @@ def sample_get_feed(): ) # 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 @@ -823,7 +851,12 @@ def sample_list_feeds(): ) # 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 @@ -925,7 +958,12 @@ def sample_update_feed(): ) # 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 @@ -1018,7 +1056,10 @@ def sample_delete_feed(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def search_all_resources( @@ -1213,12 +1254,20 @@ def sample_search_all_resources(): ) # 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.SearchAllResourcesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1395,12 +1444,20 @@ def sample_search_all_iam_policies(): ) # 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.SearchAllIamPoliciesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1485,7 +1542,12 @@ def sample_analyze_iam_policy(): ) # 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 @@ -1582,7 +1644,12 @@ def sample_analyze_iam_policy_longrunning(): ) # 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( @@ -1666,7 +1733,12 @@ def sample_analyze_move(): ) # 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 @@ -1680,7 +1752,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-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/client.py b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/client.py index 05684ef9ebee..2d13cd00685c 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/client.py @@ -57,7 +57,10 @@ class AssetServiceClientMeta(type): _transport_registry["grpc"] = AssetServiceGrpcTransport _transport_registry["grpc_asyncio"] = AssetServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AssetServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AssetServiceTransport]: """Returns an appropriate transport class. Args: @@ -162,10 +165,14 @@ def transport(self) -> AssetServiceTransport: return self._transport @staticmethod - def access_level_path(access_policy: str, access_level: str,) -> str: + def access_level_path( + access_policy: str, + access_level: str, + ) -> str: """Returns a fully-qualified access_level string.""" return "accessPolicies/{access_policy}/accessLevels/{access_level}".format( - access_policy=access_policy, access_level=access_level, + access_policy=access_policy, + access_level=access_level, ) @staticmethod @@ -178,9 +185,13 @@ def parse_access_level_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def access_policy_path(access_policy: str,) -> str: + def access_policy_path( + access_policy: str, + ) -> str: """Returns a fully-qualified access_policy string.""" - return "accessPolicies/{access_policy}".format(access_policy=access_policy,) + return "accessPolicies/{access_policy}".format( + access_policy=access_policy, + ) @staticmethod def parse_access_policy_path(path: str) -> Dict[str, str]: @@ -194,9 +205,15 @@ def asset_path() -> str: return "*".format() @staticmethod - def feed_path(project: str, feed: str,) -> str: + def feed_path( + project: str, + feed: str, + ) -> str: """Returns a fully-qualified feed string.""" - return "projects/{project}/feeds/{feed}".format(project=project, feed=feed,) + return "projects/{project}/feeds/{feed}".format( + project=project, + feed=feed, + ) @staticmethod def parse_feed_path(path: str) -> Dict[str, str]: @@ -205,10 +222,16 @@ def parse_feed_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def inventory_path(project: str, location: str, instance: str,) -> str: + def inventory_path( + project: str, + location: str, + instance: str, + ) -> str: """Returns a fully-qualified inventory string.""" return "projects/{project}/locations/{location}/instances/{instance}/inventory".format( - project=project, location=location, instance=instance, + project=project, + location=location, + instance=instance, ) @staticmethod @@ -221,10 +244,14 @@ def parse_inventory_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def service_perimeter_path(access_policy: str, service_perimeter: str,) -> str: + def service_perimeter_path( + access_policy: str, + service_perimeter: str, + ) -> str: """Returns a fully-qualified service_perimeter string.""" return "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format( - access_policy=access_policy, service_perimeter=service_perimeter, + access_policy=access_policy, + service_perimeter=service_perimeter, ) @staticmethod @@ -237,7 +264,9 @@ def parse_service_perimeter_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, @@ -250,9 +279,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]: @@ -261,9 +294,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]: @@ -272,9 +309,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]: @@ -283,10 +324,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 @@ -549,7 +594,12 @@ def sample_export_assets(): ) # 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( @@ -654,12 +704,20 @@ def sample_list_assets(): ) # 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.ListAssetsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -733,7 +791,12 @@ def sample_batch_get_assets_history(): ) # 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 @@ -842,7 +905,12 @@ def sample_create_feed(): ) # 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 @@ -938,7 +1006,12 @@ def sample_get_feed(): ) # 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 @@ -1031,7 +1104,12 @@ def sample_list_feeds(): ) # 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 @@ -1133,7 +1211,12 @@ def sample_update_feed(): ) # 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 @@ -1216,7 +1299,10 @@ def sample_delete_feed(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def search_all_resources( @@ -1402,12 +1488,20 @@ def sample_search_all_resources(): ) # 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.SearchAllResourcesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1575,12 +1669,20 @@ def sample_search_all_iam_policies(): ) # 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.SearchAllIamPoliciesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1657,7 +1759,12 @@ def sample_analyze_iam_policy(): ) # 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 @@ -1757,7 +1864,12 @@ def sample_analyze_iam_policy_longrunning(): ) # 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( @@ -1842,7 +1954,12 @@ def sample_analyze_move(): ) # 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 @@ -1863,7 +1980,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/base.py b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/base.py index 8b071d9f9d5a..48c85f1186b0 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/base.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/base.py @@ -32,7 +32,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -122,7 +124,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.export_assets: gapic_v1.method.wrap_method( - self.export_assets, default_timeout=60.0, client_info=client_info, + self.export_assets, + default_timeout=60.0, + client_info=client_info, ), self.list_assets: gapic_v1.method.wrap_method( self.list_assets, @@ -155,7 +159,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_feed: gapic_v1.method.wrap_method( - self.create_feed, default_timeout=60.0, client_info=client_info, + self.create_feed, + default_timeout=60.0, + client_info=client_info, ), self.get_feed: gapic_v1.method.wrap_method( self.get_feed, @@ -188,7 +194,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_feed: gapic_v1.method.wrap_method( - self.update_feed, default_timeout=60.0, client_info=client_info, + self.update_feed, + default_timeout=60.0, + client_info=client_info, ), self.delete_feed: gapic_v1.method.wrap_method( self.delete_feed, @@ -253,16 +261,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.analyze_move: gapic_v1.method.wrap_method( - self.analyze_move, default_timeout=None, client_info=client_info, + self.analyze_move, + 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/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py index d4f96195bdd7..00b273a5be71 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/transports/grpc.py @@ -228,8 +228,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/packages/google-cloud-asset/google/cloud/asset_v1/types/asset_service.py b/packages/google-cloud-asset/google/cloud/asset_v1/types/asset_service.py index 1362c0cde07a..f96d53c8a8ae 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/types/asset_service.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/types/asset_service.py @@ -89,7 +89,11 @@ class AnalyzeIamPolicyLongrunningMetadata(proto.Message): created. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) class ExportAssetsRequest(proto.Message): @@ -160,12 +164,33 @@ class ExportAssetsRequest(proto.Message): for all supported asset types and relationship types. """ - parent = proto.Field(proto.STRING, number=1,) - read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - content_type = proto.Field(proto.ENUM, number=4, enum="ContentType",) - output_config = proto.Field(proto.MESSAGE, number=5, message="OutputConfig",) - relationship_types = proto.RepeatedField(proto.STRING, number=6,) + parent = proto.Field( + proto.STRING, + number=1, + ) + read_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + content_type = proto.Field( + proto.ENUM, + number=4, + enum="ContentType", + ) + output_config = proto.Field( + proto.MESSAGE, + number=5, + message="OutputConfig", + ) + relationship_types = proto.RepeatedField( + proto.STRING, + number=6, + ) class ExportAssetsResponse(proto.Message): @@ -190,9 +215,21 @@ class ExportAssetsResponse(proto.Message): it exceeds a single Google Cloud Storage object limit. """ - read_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - output_config = proto.Field(proto.MESSAGE, number=2, message="OutputConfig",) - output_result = proto.Field(proto.MESSAGE, number=3, message="OutputResult",) + read_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + output_config = proto.Field( + proto.MESSAGE, + number=2, + message="OutputConfig", + ) + output_result = proto.Field( + proto.MESSAGE, + number=3, + message="OutputResult", + ) class ListAssetsRequest(proto.Message): @@ -269,13 +306,36 @@ class ListAssetsRequest(proto.Message): for all supported asset types and relationship types. """ - parent = proto.Field(proto.STRING, number=1,) - read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - content_type = proto.Field(proto.ENUM, number=4, enum="ContentType",) - page_size = proto.Field(proto.INT32, number=5,) - page_token = proto.Field(proto.STRING, number=6,) - relationship_types = proto.RepeatedField(proto.STRING, number=7,) + parent = proto.Field( + proto.STRING, + number=1, + ) + read_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + content_type = proto.Field( + proto.ENUM, + number=4, + enum="ContentType", + ) + page_size = proto.Field( + proto.INT32, + number=5, + ) + page_token = proto.Field( + proto.STRING, + number=6, + ) + relationship_types = proto.RepeatedField( + proto.STRING, + number=7, + ) class ListAssetsResponse(proto.Message): @@ -297,9 +357,20 @@ class ListAssetsResponse(proto.Message): def raw_page(self): return self - read_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - assets = proto.RepeatedField(proto.MESSAGE, number=2, message=gca_assets.Asset,) - next_page_token = proto.Field(proto.STRING, number=3,) + read_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + assets = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=gca_assets.Asset, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, + ) class BatchGetAssetsHistoryRequest(proto.Message): @@ -351,13 +422,28 @@ class BatchGetAssetsHistoryRequest(proto.Message): for all supported asset types and relationship types. """ - parent = proto.Field(proto.STRING, number=1,) - asset_names = proto.RepeatedField(proto.STRING, number=2,) - content_type = proto.Field(proto.ENUM, number=3, enum="ContentType",) + parent = proto.Field( + proto.STRING, + number=1, + ) + asset_names = proto.RepeatedField( + proto.STRING, + number=2, + ) + content_type = proto.Field( + proto.ENUM, + number=3, + enum="ContentType", + ) read_time_window = proto.Field( - proto.MESSAGE, number=4, message=gca_assets.TimeWindow, + proto.MESSAGE, + number=4, + message=gca_assets.TimeWindow, + ) + relationship_types = proto.RepeatedField( + proto.STRING, + number=5, ) - relationship_types = proto.RepeatedField(proto.STRING, number=5,) class BatchGetAssetsHistoryResponse(proto.Message): @@ -369,7 +455,9 @@ class BatchGetAssetsHistoryResponse(proto.Message): """ assets = proto.RepeatedField( - proto.MESSAGE, number=1, message=gca_assets.TemporalAsset, + proto.MESSAGE, + number=1, + message=gca_assets.TemporalAsset, ) @@ -398,9 +486,19 @@ class CreateFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - parent = proto.Field(proto.STRING, number=1,) - feed_id = proto.Field(proto.STRING, number=2,) - feed = proto.Field(proto.MESSAGE, number=3, message="Feed",) + parent = proto.Field( + proto.STRING, + number=1, + ) + feed_id = proto.Field( + proto.STRING, + number=2, + ) + feed = proto.Field( + proto.MESSAGE, + number=3, + message="Feed", + ) class GetFeedRequest(proto.Message): @@ -414,7 +512,10 @@ class GetFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListFeedsRequest(proto.Message): @@ -430,7 +531,10 @@ class ListFeedsRequest(proto.Message): "projects/my-project-id"). """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) class ListFeedsResponse(proto.Message): @@ -441,7 +545,11 @@ class ListFeedsResponse(proto.Message): A list of feeds. """ - feeds = proto.RepeatedField(proto.MESSAGE, number=1, message="Feed",) + feeds = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Feed", + ) class UpdateFeedRequest(proto.Message): @@ -460,9 +568,15 @@ class UpdateFeedRequest(proto.Message): contain fields that are immutable or only set by the server. """ - feed = proto.Field(proto.MESSAGE, number=1, message="Feed",) + feed = proto.Field( + proto.MESSAGE, + number=1, + message="Feed", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -477,7 +591,10 @@ class DeleteFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class OutputConfig(proto.Message): @@ -504,10 +621,16 @@ class OutputConfig(proto.Message): """ gcs_destination = proto.Field( - proto.MESSAGE, number=1, oneof="destination", message="GcsDestination", + proto.MESSAGE, + number=1, + oneof="destination", + message="GcsDestination", ) bigquery_destination = proto.Field( - proto.MESSAGE, number=2, oneof="destination", message="BigQueryDestination", + proto.MESSAGE, + number=2, + oneof="destination", + message="BigQueryDestination", ) @@ -524,7 +647,10 @@ class OutputResult(proto.Message): """ gcs_result = proto.Field( - proto.MESSAGE, number=1, oneof="result", message="GcsOutputResult", + proto.MESSAGE, + number=1, + oneof="result", + message="GcsOutputResult", ) @@ -537,7 +663,10 @@ class GcsOutputResult(proto.Message): "gs://bucket_name/object_name". """ - uris = proto.RepeatedField(proto.STRING, number=1,) + uris = proto.RepeatedField( + proto.STRING, + number=1, + ) class GcsDestination(proto.Message): @@ -578,8 +707,16 @@ class GcsDestination(proto.Message): This field is a member of `oneof`_ ``object_uri``. """ - uri = proto.Field(proto.STRING, number=1, oneof="object_uri",) - uri_prefix = proto.Field(proto.STRING, number=2, oneof="object_uri",) + uri = proto.Field( + proto.STRING, + number=1, + oneof="object_uri", + ) + uri_prefix = proto.Field( + proto.STRING, + number=2, + oneof="object_uri", + ) class BigQueryDestination(proto.Message): @@ -660,11 +797,27 @@ class BigQueryDestination(proto.Message): a table. """ - dataset = proto.Field(proto.STRING, number=1,) - table = proto.Field(proto.STRING, number=2,) - force = proto.Field(proto.BOOL, number=3,) - partition_spec = proto.Field(proto.MESSAGE, number=4, message="PartitionSpec",) - separate_tables_per_asset_type = proto.Field(proto.BOOL, number=5,) + dataset = proto.Field( + proto.STRING, + number=1, + ) + table = proto.Field( + proto.STRING, + number=2, + ) + force = proto.Field( + proto.BOOL, + number=3, + ) + partition_spec = proto.Field( + proto.MESSAGE, + number=4, + message="PartitionSpec", + ) + separate_tables_per_asset_type = proto.Field( + proto.BOOL, + number=5, + ) class PartitionSpec(proto.Message): @@ -688,7 +841,11 @@ class PartitionKey(proto.Enum): READ_TIME = 1 REQUEST_TIME = 2 - partition_key = proto.Field(proto.ENUM, number=1, enum=PartitionKey,) + partition_key = proto.Field( + proto.ENUM, + number=1, + enum=PartitionKey, + ) class PubsubDestination(proto.Message): @@ -700,7 +857,10 @@ class PubsubDestination(proto.Message): ``projects/PROJECT_ID/topics/TOPIC_ID``. """ - topic = proto.Field(proto.STRING, number=1,) + topic = proto.Field( + proto.STRING, + number=1, + ) class FeedOutputConfig(proto.Message): @@ -716,7 +876,10 @@ class FeedOutputConfig(proto.Message): """ pubsub_destination = proto.Field( - proto.MESSAGE, number=1, oneof="destination", message="PubsubDestination", + proto.MESSAGE, + number=1, + oneof="destination", + message="PubsubDestination", ) @@ -800,15 +963,37 @@ class Feed(proto.Message): for all supported asset types and relationship types. """ - name = proto.Field(proto.STRING, number=1,) - asset_names = proto.RepeatedField(proto.STRING, number=2,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - content_type = proto.Field(proto.ENUM, number=4, enum="ContentType",) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_names = proto.RepeatedField( + proto.STRING, + number=2, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + content_type = proto.Field( + proto.ENUM, + number=4, + enum="ContentType", + ) feed_output_config = proto.Field( - proto.MESSAGE, number=5, message="FeedOutputConfig", + proto.MESSAGE, + number=5, + message="FeedOutputConfig", + ) + condition = proto.Field( + proto.MESSAGE, + number=6, + message=expr_pb2.Expr, + ) + relationship_types = proto.RepeatedField( + proto.STRING, + number=7, ) - condition = proto.Field(proto.MESSAGE, number=6, message=expr_pb2.Expr,) - relationship_types = proto.RepeatedField(proto.STRING, number=7,) class SearchAllResourcesRequest(proto.Message): @@ -963,13 +1148,35 @@ class SearchAllResourcesRequest(proto.Message): INVALID_ARGUMENT error. """ - scope = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - page_size = proto.Field(proto.INT32, number=4,) - page_token = proto.Field(proto.STRING, number=5,) - order_by = proto.Field(proto.STRING, number=6,) - read_mask = proto.Field(proto.MESSAGE, number=8, message=field_mask_pb2.FieldMask,) + scope = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=5, + ) + order_by = proto.Field( + proto.STRING, + number=6, + ) + read_mask = proto.Field( + proto.MESSAGE, + number=8, + message=field_mask_pb2.FieldMask, + ) class SearchAllResourcesResponse(proto.Message): @@ -992,9 +1199,14 @@ def raw_page(self): return self results = proto.RepeatedField( - proto.MESSAGE, number=1, message=gca_assets.ResourceSearchResult, + proto.MESSAGE, + number=1, + message=gca_assets.ResourceSearchResult, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class SearchAllIamPoliciesRequest(proto.Message): @@ -1110,12 +1322,30 @@ class SearchAllIamPoliciesRequest(proto.Message): ``policy``) are not supported. """ - scope = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) - asset_types = proto.RepeatedField(proto.STRING, number=5,) - order_by = proto.Field(proto.STRING, number=7,) + scope = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=5, + ) + order_by = proto.Field( + proto.STRING, + number=7, + ) class SearchAllIamPoliciesResponse(proto.Message): @@ -1138,9 +1368,14 @@ def raw_page(self): return self results = proto.RepeatedField( - proto.MESSAGE, number=1, message=gca_assets.IamPolicySearchResult, + proto.MESSAGE, + number=1, + message=gca_assets.IamPolicySearchResult, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class IamPolicyAnalysisQuery(proto.Message): @@ -1190,7 +1425,10 @@ class ResourceSelector(proto.Message): types `__. """ - full_resource_name = proto.Field(proto.STRING, number=1,) + full_resource_name = proto.Field( + proto.STRING, + number=1, + ) class IdentitySelector(proto.Message): r"""Specifies an identity for which to determine resource access, @@ -1212,7 +1450,10 @@ class IdentitySelector(proto.Message): supported. You must give a specific identity. """ - identity = proto.Field(proto.STRING, number=1,) + identity = proto.Field( + proto.STRING, + number=1, + ) class AccessSelector(proto.Message): r"""Specifies roles and/or permissions to analyze, to determine @@ -1229,8 +1470,14 @@ class AccessSelector(proto.Message): result. """ - roles = proto.RepeatedField(proto.STRING, number=1,) - permissions = proto.RepeatedField(proto.STRING, number=2,) + roles = proto.RepeatedField( + proto.STRING, + number=1, + ) + permissions = proto.RepeatedField( + proto.STRING, + number=2, + ) class Options(proto.Message): r"""Contains query options. @@ -1324,12 +1571,30 @@ class Options(proto.Message): Default is false. """ - expand_groups = proto.Field(proto.BOOL, number=1,) - expand_roles = proto.Field(proto.BOOL, number=2,) - expand_resources = proto.Field(proto.BOOL, number=3,) - output_resource_edges = proto.Field(proto.BOOL, number=4,) - output_group_edges = proto.Field(proto.BOOL, number=5,) - analyze_service_account_impersonation = proto.Field(proto.BOOL, number=6,) + expand_groups = proto.Field( + proto.BOOL, + number=1, + ) + expand_roles = proto.Field( + proto.BOOL, + number=2, + ) + expand_resources = proto.Field( + proto.BOOL, + number=3, + ) + output_resource_edges = proto.Field( + proto.BOOL, + number=4, + ) + output_group_edges = proto.Field( + proto.BOOL, + number=5, + ) + analyze_service_account_impersonation = proto.Field( + proto.BOOL, + number=6, + ) class ConditionContext(proto.Message): r"""The IAM conditions context. @@ -1353,12 +1618,35 @@ class ConditionContext(proto.Message): message=timestamp_pb2.Timestamp, ) - scope = proto.Field(proto.STRING, number=1,) - resource_selector = proto.Field(proto.MESSAGE, number=2, message=ResourceSelector,) - identity_selector = proto.Field(proto.MESSAGE, number=3, message=IdentitySelector,) - access_selector = proto.Field(proto.MESSAGE, number=4, message=AccessSelector,) - options = proto.Field(proto.MESSAGE, number=5, message=Options,) - condition_context = proto.Field(proto.MESSAGE, number=6, message=ConditionContext,) + scope = proto.Field( + proto.STRING, + number=1, + ) + resource_selector = proto.Field( + proto.MESSAGE, + number=2, + message=ResourceSelector, + ) + identity_selector = proto.Field( + proto.MESSAGE, + number=3, + message=IdentitySelector, + ) + access_selector = proto.Field( + proto.MESSAGE, + number=4, + message=AccessSelector, + ) + options = proto.Field( + proto.MESSAGE, + number=5, + message=Options, + ) + condition_context = proto.Field( + proto.MESSAGE, + number=6, + message=ConditionContext, + ) class AnalyzeIamPolicyRequest(proto.Message): @@ -1384,10 +1672,14 @@ class AnalyzeIamPolicyRequest(proto.Message): """ analysis_query = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisQuery", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisQuery", ) execution_timeout = proto.Field( - proto.MESSAGE, number=2, message=duration_pb2.Duration, + proto.MESSAGE, + number=2, + message=duration_pb2.Duration, ) @@ -1432,21 +1724,39 @@ class IamPolicyAnalysis(proto.Message): """ analysis_query = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisQuery", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisQuery", ) analysis_results = proto.RepeatedField( - proto.MESSAGE, number=2, message=gca_assets.IamPolicyAnalysisResult, + proto.MESSAGE, + number=2, + message=gca_assets.IamPolicyAnalysisResult, + ) + fully_explored = proto.Field( + proto.BOOL, + number=3, ) - fully_explored = proto.Field(proto.BOOL, number=3,) non_critical_errors = proto.RepeatedField( - proto.MESSAGE, number=5, message=gca_assets.IamPolicyAnalysisState, + proto.MESSAGE, + number=5, + message=gca_assets.IamPolicyAnalysisState, ) - main_analysis = proto.Field(proto.MESSAGE, number=1, message=IamPolicyAnalysis,) + main_analysis = proto.Field( + proto.MESSAGE, + number=1, + message=IamPolicyAnalysis, + ) service_account_impersonation_analysis = proto.RepeatedField( - proto.MESSAGE, number=2, message=IamPolicyAnalysis, + proto.MESSAGE, + number=2, + message=IamPolicyAnalysis, + ) + fully_explored = proto.Field( + proto.BOOL, + number=3, ) - fully_explored = proto.Field(proto.BOOL, number=3,) class IamPolicyAnalysisOutputConfig(proto.Message): @@ -1489,7 +1799,10 @@ class GcsDestination(proto.Message): it will be overwritten with the analysis result. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class BigQueryDestination(proto.Message): r"""A BigQuery destination. @@ -1545,20 +1858,35 @@ class PartitionKey(proto.Enum): PARTITION_KEY_UNSPECIFIED = 0 REQUEST_TIME = 1 - dataset = proto.Field(proto.STRING, number=1,) - table_prefix = proto.Field(proto.STRING, number=2,) + dataset = proto.Field( + proto.STRING, + number=1, + ) + table_prefix = proto.Field( + proto.STRING, + number=2, + ) partition_key = proto.Field( proto.ENUM, number=3, enum="IamPolicyAnalysisOutputConfig.BigQueryDestination.PartitionKey", ) - write_disposition = proto.Field(proto.STRING, number=4,) + write_disposition = proto.Field( + proto.STRING, + number=4, + ) gcs_destination = proto.Field( - proto.MESSAGE, number=1, oneof="destination", message=GcsDestination, + proto.MESSAGE, + number=1, + oneof="destination", + message=GcsDestination, ) bigquery_destination = proto.Field( - proto.MESSAGE, number=2, oneof="destination", message=BigQueryDestination, + proto.MESSAGE, + number=2, + oneof="destination", + message=BigQueryDestination, ) @@ -1575,10 +1903,14 @@ class AnalyzeIamPolicyLongrunningRequest(proto.Message): """ analysis_query = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisQuery", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisQuery", ) output_config = proto.Field( - proto.MESSAGE, number=2, message="IamPolicyAnalysisOutputConfig", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisOutputConfig", ) @@ -1620,9 +1952,19 @@ class AnalysisView(proto.Enum): FULL = 1 BASIC = 2 - resource = proto.Field(proto.STRING, number=1,) - destination_parent = proto.Field(proto.STRING, number=2,) - view = proto.Field(proto.ENUM, number=3, enum=AnalysisView,) + resource = proto.Field( + proto.STRING, + number=1, + ) + destination_parent = proto.Field( + proto.STRING, + number=2, + ) + view = proto.Field( + proto.ENUM, + number=3, + enum=AnalysisView, + ) class AnalyzeMoveResponse(proto.Message): @@ -1636,7 +1978,9 @@ class AnalyzeMoveResponse(proto.Message): """ move_analysis = proto.RepeatedField( - proto.MESSAGE, number=1, message="MoveAnalysis", + proto.MESSAGE, + number=1, + message="MoveAnalysis", ) @@ -1666,12 +2010,21 @@ class MoveAnalysis(proto.Message): This field is a member of `oneof`_ ``result``. """ - display_name = proto.Field(proto.STRING, number=1,) + display_name = proto.Field( + proto.STRING, + number=1, + ) analysis = proto.Field( - proto.MESSAGE, number=2, oneof="result", message="MoveAnalysisResult", + proto.MESSAGE, + number=2, + oneof="result", + message="MoveAnalysisResult", ) error = proto.Field( - proto.MESSAGE, number=3, oneof="result", message=status_pb2.Status, + proto.MESSAGE, + number=3, + oneof="result", + message=status_pb2.Status, ) @@ -1691,8 +2044,16 @@ class MoveAnalysisResult(proto.Message): but will not block moves at runtime. """ - blockers = proto.RepeatedField(proto.MESSAGE, number=1, message="MoveImpact",) - warnings = proto.RepeatedField(proto.MESSAGE, number=2, message="MoveImpact",) + blockers = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="MoveImpact", + ) + warnings = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="MoveImpact", + ) class MoveImpact(proto.Message): @@ -1704,7 +2065,10 @@ class MoveImpact(proto.Message): message. """ - detail = proto.Field(proto.STRING, number=1,) + detail = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/types/assets.py b/packages/google-cloud-asset/google/cloud/asset_v1/types/assets.py index 61e9c175d1c1..0e464bd4ffeb 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/types/assets.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/types/assets.py @@ -78,11 +78,30 @@ class PriorAssetState(proto.Enum): DOES_NOT_EXIST = 3 DELETED = 4 - window = proto.Field(proto.MESSAGE, number=1, message="TimeWindow",) - deleted = proto.Field(proto.BOOL, number=2,) - asset = proto.Field(proto.MESSAGE, number=3, message="Asset",) - prior_asset_state = proto.Field(proto.ENUM, number=4, enum=PriorAssetState,) - prior_asset = proto.Field(proto.MESSAGE, number=5, message="Asset",) + window = proto.Field( + proto.MESSAGE, + number=1, + message="TimeWindow", + ) + deleted = proto.Field( + proto.BOOL, + number=2, + ) + asset = proto.Field( + proto.MESSAGE, + number=3, + message="Asset", + ) + prior_asset_state = proto.Field( + proto.ENUM, + number=4, + enum=PriorAssetState, + ) + prior_asset = proto.Field( + proto.MESSAGE, + number=5, + message="Asset", + ) class TimeWindow(proto.Message): @@ -97,8 +116,16 @@ class TimeWindow(proto.Message): instead. """ - start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + start_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class Asset(proto.Message): @@ -194,14 +221,32 @@ class Asset(proto.Message): """ update_time = proto.Field( - proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=11, + message=timestamp_pb2.Timestamp, + ) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message="Resource", + ) + iam_policy = proto.Field( + proto.MESSAGE, + number=4, + message=policy_pb2.Policy, ) - name = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - resource = proto.Field(proto.MESSAGE, number=3, message="Resource",) - iam_policy = proto.Field(proto.MESSAGE, number=4, message=policy_pb2.Policy,) org_policy = proto.RepeatedField( - proto.MESSAGE, number=6, message=orgpolicy_pb2.Policy, + proto.MESSAGE, + number=6, + message=orgpolicy_pb2.Policy, ) access_policy = proto.Field( proto.MESSAGE, @@ -221,9 +266,20 @@ class Asset(proto.Message): oneof="access_context_policy", message=service_perimeter_pb2.ServicePerimeter, ) - os_inventory = proto.Field(proto.MESSAGE, number=12, message=Inventory,) - related_assets = proto.Field(proto.MESSAGE, number=13, message="RelatedAssets",) - ancestors = proto.RepeatedField(proto.STRING, number=10,) + os_inventory = proto.Field( + proto.MESSAGE, + number=12, + message=Inventory, + ) + related_assets = proto.Field( + proto.MESSAGE, + number=13, + message="RelatedAssets", + ) + ancestors = proto.RepeatedField( + proto.STRING, + number=10, + ) class Resource(proto.Message): @@ -275,13 +331,35 @@ class Resource(proto.Message): https://cloud.google.com/about/locations/. """ - version = proto.Field(proto.STRING, number=1,) - discovery_document_uri = proto.Field(proto.STRING, number=2,) - discovery_name = proto.Field(proto.STRING, number=3,) - resource_url = proto.Field(proto.STRING, number=4,) - parent = proto.Field(proto.STRING, number=5,) - data = proto.Field(proto.MESSAGE, number=6, message=struct_pb2.Struct,) - location = proto.Field(proto.STRING, number=8,) + version = proto.Field( + proto.STRING, + number=1, + ) + discovery_document_uri = proto.Field( + proto.STRING, + number=2, + ) + discovery_name = proto.Field( + proto.STRING, + number=3, + ) + resource_url = proto.Field( + proto.STRING, + number=4, + ) + parent = proto.Field( + proto.STRING, + number=5, + ) + data = proto.Field( + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, + ) + location = proto.Field( + proto.STRING, + number=8, + ) class RelatedAssets(proto.Message): @@ -295,9 +373,15 @@ class RelatedAssets(proto.Message): """ relationship_attributes = proto.Field( - proto.MESSAGE, number=1, message="RelationshipAttributes", + proto.MESSAGE, + number=1, + message="RelationshipAttributes", + ) + assets = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="RelatedAsset", ) - assets = proto.RepeatedField(proto.MESSAGE, number=2, message="RelatedAsset",) class RelationshipAttributes(proto.Message): @@ -319,10 +403,22 @@ class RelationshipAttributes(proto.Message): ``attaches`` """ - type_ = proto.Field(proto.STRING, number=4,) - source_resource_type = proto.Field(proto.STRING, number=1,) - target_resource_type = proto.Field(proto.STRING, number=2,) - action = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.STRING, + number=4, + ) + source_resource_type = proto.Field( + proto.STRING, + number=1, + ) + target_resource_type = proto.Field( + proto.STRING, + number=2, + ) + action = proto.Field( + proto.STRING, + number=3, + ) class RelatedAsset(proto.Message): @@ -362,9 +458,18 @@ class RelatedAsset(proto.Message): ``["projects/123456789", "folders/5432", "organizations/1234"]`` """ - asset = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - ancestors = proto.RepeatedField(proto.STRING, number=3,) + asset = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + ancestors = proto.RepeatedField( + proto.STRING, + number=3, + ) class ResourceSearchResult(proto.Message): @@ -612,38 +717,94 @@ class ResourceSearchResult(proto.Message): ``cloudresourcemanager.googleapis.com/Project`` """ - name = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - project = proto.Field(proto.STRING, number=3,) - folders = proto.RepeatedField(proto.STRING, number=17,) - organization = proto.Field(proto.STRING, number=18,) - display_name = proto.Field(proto.STRING, number=4,) - description = proto.Field(proto.STRING, number=5,) - location = proto.Field(proto.STRING, number=6,) - labels = proto.MapField(proto.STRING, proto.STRING, number=7,) - network_tags = proto.RepeatedField(proto.STRING, number=8,) - kms_key = proto.Field(proto.STRING, number=10,) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + project = proto.Field( + proto.STRING, + number=3, + ) + folders = proto.RepeatedField( + proto.STRING, + number=17, + ) + organization = proto.Field( + proto.STRING, + number=18, + ) + display_name = proto.Field( + proto.STRING, + number=4, + ) + description = proto.Field( + proto.STRING, + number=5, + ) + location = proto.Field( + proto.STRING, + number=6, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=7, + ) + network_tags = proto.RepeatedField( + proto.STRING, + number=8, + ) + kms_key = proto.Field( + proto.STRING, + number=10, + ) create_time = proto.Field( - proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=11, + message=timestamp_pb2.Timestamp, ) update_time = proto.Field( - proto.MESSAGE, number=12, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=12, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.STRING, + number=13, ) - state = proto.Field(proto.STRING, number=13,) additional_attributes = proto.Field( - proto.MESSAGE, number=9, message=struct_pb2.Struct, + proto.MESSAGE, + number=9, + message=struct_pb2.Struct, + ) + parent_full_resource_name = proto.Field( + proto.STRING, + number=19, ) - parent_full_resource_name = proto.Field(proto.STRING, number=19,) versioned_resources = proto.RepeatedField( - proto.MESSAGE, number=16, message="VersionedResource", + proto.MESSAGE, + number=16, + message="VersionedResource", ) attached_resources = proto.RepeatedField( - proto.MESSAGE, number=20, message="AttachedResource", + proto.MESSAGE, + number=20, + message="AttachedResource", ) relationships = proto.MapField( - proto.STRING, proto.MESSAGE, number=21, message="RelatedResources", + proto.STRING, + proto.MESSAGE, + number=21, + message="RelatedResources", + ) + parent_asset_type = proto.Field( + proto.STRING, + number=103, ) - parent_asset_type = proto.Field(proto.STRING, number=103,) class VersionedResource(proto.Message): @@ -672,8 +833,15 @@ class VersionedResource(proto.Message): ``https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types`` """ - version = proto.Field(proto.STRING, number=1,) - resource = proto.Field(proto.MESSAGE, number=2, message=struct_pb2.Struct,) + version = proto.Field( + proto.STRING, + number=1, + ) + resource = proto.Field( + proto.MESSAGE, + number=2, + message=struct_pb2.Struct, + ) class AttachedResource(proto.Message): @@ -698,9 +866,14 @@ class AttachedResource(proto.Message): migration. """ - asset_type = proto.Field(proto.STRING, number=1,) + asset_type = proto.Field( + proto.STRING, + number=1, + ) versioned_resources = proto.RepeatedField( - proto.MESSAGE, number=3, message="VersionedResource", + proto.MESSAGE, + number=3, + message="VersionedResource", ) @@ -714,7 +887,9 @@ class RelatedResources(proto.Message): """ related_resources = proto.RepeatedField( - proto.MESSAGE, number=1, message="RelatedResource", + proto.MESSAGE, + number=1, + message="RelatedResource", ) @@ -730,8 +905,14 @@ class RelatedResource(proto.Message): ``//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123`` """ - asset_type = proto.Field(proto.STRING, number=1,) - full_resource_name = proto.Field(proto.STRING, number=2,) + asset_type = proto.Field( + proto.STRING, + number=1, + ) + full_resource_name = proto.Field( + proto.STRING, + number=2, + ) class IamPolicySearchResult(proto.Message): @@ -842,7 +1023,10 @@ class Permissions(proto.Message): ``compute.disk.get``. """ - permissions = proto.RepeatedField(proto.STRING, number=1,) + permissions = proto.RepeatedField( + proto.STRING, + number=1, + ) matched_permissions = proto.MapField( proto.STRING, @@ -851,13 +1035,36 @@ class Permissions(proto.Message): message="IamPolicySearchResult.Explanation.Permissions", ) - resource = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=5,) - project = proto.Field(proto.STRING, number=2,) - folders = proto.RepeatedField(proto.STRING, number=6,) - organization = proto.Field(proto.STRING, number=7,) - policy = proto.Field(proto.MESSAGE, number=3, message=policy_pb2.Policy,) - explanation = proto.Field(proto.MESSAGE, number=4, message=Explanation,) + resource = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=5, + ) + project = proto.Field( + proto.STRING, + number=2, + ) + folders = proto.RepeatedField( + proto.STRING, + number=6, + ) + organization = proto.Field( + proto.STRING, + number=7, + ) + policy = proto.Field( + proto.MESSAGE, + number=3, + message=policy_pb2.Policy, + ) + explanation = proto.Field( + proto.MESSAGE, + number=4, + message=Explanation, + ) class IamPolicyAnalysisState(proto.Message): @@ -880,8 +1087,15 @@ class IamPolicyAnalysisState(proto.Message): of failure. """ - code = proto.Field(proto.ENUM, number=1, enum=code_pb2.Code,) - cause = proto.Field(proto.STRING, number=2,) + code = proto.Field( + proto.ENUM, + number=1, + enum=code_pb2.Code, + ) + cause = proto.Field( + proto.STRING, + number=2, + ) class ConditionEvaluation(proto.Message): @@ -899,7 +1113,11 @@ class EvaluationValue(proto.Enum): FALSE = 2 CONDITIONAL = 3 - evaluation_value = proto.Field(proto.ENUM, number=1, enum=EvaluationValue,) + evaluation_value = proto.Field( + proto.ENUM, + number=1, + enum=EvaluationValue, + ) class IamPolicyAnalysisResult(proto.Message): @@ -942,9 +1160,14 @@ class Resource(proto.Message): The analysis state of this resource. """ - full_resource_name = proto.Field(proto.STRING, number=1,) + full_resource_name = proto.Field( + proto.STRING, + number=1, + ) analysis_state = proto.Field( - proto.MESSAGE, number=2, message="IamPolicyAnalysisState", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisState", ) class Access(proto.Message): @@ -970,10 +1193,20 @@ class Access(proto.Message): The analysis state of this access. """ - role = proto.Field(proto.STRING, number=1, oneof="oneof_access",) - permission = proto.Field(proto.STRING, number=2, oneof="oneof_access",) + role = proto.Field( + proto.STRING, + number=1, + oneof="oneof_access", + ) + permission = proto.Field( + proto.STRING, + number=2, + oneof="oneof_access", + ) analysis_state = proto.Field( - proto.MESSAGE, number=3, message="IamPolicyAnalysisState", + proto.MESSAGE, + number=3, + message="IamPolicyAnalysisState", ) class Identity(proto.Message): @@ -997,9 +1230,14 @@ class Identity(proto.Message): The analysis state of this identity. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) analysis_state = proto.Field( - proto.MESSAGE, number=2, message="IamPolicyAnalysisState", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisState", ) class Edge(proto.Message): @@ -1016,8 +1254,14 @@ class Edge(proto.Message): node or an email of an identity. """ - source_node = proto.Field(proto.STRING, number=1,) - target_node = proto.Field(proto.STRING, number=2,) + source_node = proto.Field( + proto.STRING, + number=1, + ) + target_node = proto.Field( + proto.STRING, + number=2, + ) class AccessControlList(proto.Message): r"""An access control list, derived from the above IAM policy binding, @@ -1068,16 +1312,24 @@ class AccessControlList(proto.Message): """ resources = proto.RepeatedField( - proto.MESSAGE, number=1, message="IamPolicyAnalysisResult.Resource", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisResult.Resource", ) accesses = proto.RepeatedField( - proto.MESSAGE, number=2, message="IamPolicyAnalysisResult.Access", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisResult.Access", ) resource_edges = proto.RepeatedField( - proto.MESSAGE, number=3, message="IamPolicyAnalysisResult.Edge", + proto.MESSAGE, + number=3, + message="IamPolicyAnalysisResult.Edge", ) condition_evaluation = proto.Field( - proto.MESSAGE, number=4, message="ConditionEvaluation", + proto.MESSAGE, + number=4, + message="ConditionEvaluation", ) class IdentityList(proto.Message): @@ -1106,19 +1358,39 @@ class IdentityList(proto.Message): """ identities = proto.RepeatedField( - proto.MESSAGE, number=1, message="IamPolicyAnalysisResult.Identity", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisResult.Identity", ) group_edges = proto.RepeatedField( - proto.MESSAGE, number=2, message="IamPolicyAnalysisResult.Edge", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisResult.Edge", ) - attached_resource_full_name = proto.Field(proto.STRING, number=1,) - iam_binding = proto.Field(proto.MESSAGE, number=2, message=policy_pb2.Binding,) + attached_resource_full_name = proto.Field( + proto.STRING, + number=1, + ) + iam_binding = proto.Field( + proto.MESSAGE, + number=2, + message=policy_pb2.Binding, + ) access_control_lists = proto.RepeatedField( - proto.MESSAGE, number=3, message=AccessControlList, + proto.MESSAGE, + number=3, + message=AccessControlList, + ) + identity_list = proto.Field( + proto.MESSAGE, + number=4, + message=IdentityList, + ) + fully_explored = proto.Field( + proto.BOOL, + number=5, ) - identity_list = proto.Field(proto.MESSAGE, number=4, message=IdentityList,) - fully_explored = proto.Field(proto.BOOL, number=5,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/async_client.py b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/async_client.py index ce4f8da15206..5afe35267521 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/async_client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/async_client.py @@ -327,12 +327,20 @@ def sample_search_all_resources(): ) # 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.SearchAllResourcesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -461,12 +469,20 @@ def sample_search_all_iam_policies(): ) # 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.SearchAllIamPoliciesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -481,7 +497,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-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/client.py b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/client.py index 2a782cf8e172..fd5b82b7db36 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/client.py @@ -54,7 +54,10 @@ class AssetServiceClientMeta(type): _transport_registry["grpc"] = AssetServiceGrpcTransport _transport_registry["grpc_asyncio"] = AssetServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AssetServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AssetServiceTransport]: """Returns an appropriate transport class. Args: @@ -159,7 +162,9 @@ def transport(self) -> AssetServiceTransport: return self._transport @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, @@ -172,9 +177,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]: @@ -183,9 +192,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]: @@ -194,9 +207,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]: @@ -205,10 +222,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 @@ -502,12 +523,20 @@ def sample_search_all_resources(): ) # 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.SearchAllResourcesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -626,12 +655,20 @@ def sample_search_all_iam_policies(): ) # 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.SearchAllIamPoliciesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -653,7 +690,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/base.py b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/base.py index 5983397f8d28..81debf27be90 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/base.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -153,9 +155,9 @@ def _prep_wrapped_messages(self, 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/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/grpc.py b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/grpc.py index 4577e66bda0d..abdb3ddebcd3 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/grpc.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/services/asset_service/transports/grpc.py @@ -224,8 +224,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/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/asset_service.py b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/asset_service.py index 4fecd5f4380d..16d1a6025519 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/asset_service.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/asset_service.py @@ -70,12 +70,30 @@ class SearchAllResourcesRequest(proto.Message): example, " foo , bar desc ". """ - scope = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - page_size = proto.Field(proto.INT32, number=4,) - page_token = proto.Field(proto.STRING, number=5,) - order_by = proto.Field(proto.STRING, number=10,) + scope = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=5, + ) + order_by = proto.Field( + proto.STRING, + number=10, + ) class SearchAllResourcesResponse(proto.Message): @@ -97,9 +115,14 @@ def raw_page(self): return self results = proto.RepeatedField( - proto.MESSAGE, number=1, message=assets.StandardResourceMetadata, + proto.MESSAGE, + number=1, + message=assets.StandardResourceMetadata, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class SearchAllIamPoliciesRequest(proto.Message): @@ -135,10 +158,22 @@ class SearchAllIamPoliciesRequest(proto.Message): identical to those in the previous call. """ - scope = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + scope = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class SearchAllIamPoliciesResponse(proto.Message): @@ -161,9 +196,14 @@ def raw_page(self): return self results = proto.RepeatedField( - proto.MESSAGE, number=1, message=assets.IamPolicySearchResult, + proto.MESSAGE, + number=1, + message=assets.IamPolicySearchResult, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/assets.py b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/assets.py index ed04df7692d6..abb2ec24da28 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/assets.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p1beta1/types/assets.py @@ -20,7 +20,11 @@ __protobuf__ = proto.module( package="google.cloud.asset.v1p1beta1", - manifest={"StandardResourceMetadata", "IamPolicySearchResult", "Permissions",}, + manifest={ + "StandardResourceMetadata", + "IamPolicySearchResult", + "Permissions", + }, ) @@ -67,15 +71,43 @@ class StandardResourceMetadata(proto.Message): for more information. """ - name = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - project = proto.Field(proto.STRING, number=3,) - display_name = proto.Field(proto.STRING, number=4,) - description = proto.Field(proto.STRING, number=5,) - additional_attributes = proto.RepeatedField(proto.STRING, number=10,) - location = proto.Field(proto.STRING, number=11,) - labels = proto.MapField(proto.STRING, proto.STRING, number=12,) - network_tags = proto.RepeatedField(proto.STRING, number=13,) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + project = proto.Field( + proto.STRING, + number=3, + ) + display_name = proto.Field( + proto.STRING, + number=4, + ) + description = proto.Field( + proto.STRING, + number=5, + ) + additional_attributes = proto.RepeatedField( + proto.STRING, + number=10, + ) + location = proto.Field( + proto.STRING, + number=11, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=12, + ) + network_tags = proto.RepeatedField( + proto.STRING, + number=13, + ) class IamPolicySearchResult(proto.Message): @@ -121,13 +153,30 @@ class Explanation(proto.Message): """ matched_permissions = proto.MapField( - proto.STRING, proto.MESSAGE, number=1, message="Permissions", + proto.STRING, + proto.MESSAGE, + number=1, + message="Permissions", ) - resource = proto.Field(proto.STRING, number=1,) - project = proto.Field(proto.STRING, number=3,) - policy = proto.Field(proto.MESSAGE, number=4, message=policy_pb2.Policy,) - explanation = proto.Field(proto.MESSAGE, number=5, message=Explanation,) + resource = proto.Field( + proto.STRING, + number=1, + ) + project = proto.Field( + proto.STRING, + number=3, + ) + policy = proto.Field( + proto.MESSAGE, + number=4, + message=policy_pb2.Policy, + ) + explanation = proto.Field( + proto.MESSAGE, + number=5, + message=Explanation, + ) class Permissions(proto.Message): @@ -139,7 +188,10 @@ class Permissions(proto.Message): string: "compute.disk.get". """ - permissions = proto.RepeatedField(proto.STRING, number=1,) + permissions = proto.RepeatedField( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/async_client.py b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/async_client.py index 32c171a4956c..a2e5f053b166 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/async_client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/async_client.py @@ -301,7 +301,12 @@ def sample_create_feed(): ) # 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 @@ -407,7 +412,12 @@ def sample_get_feed(): ) # 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 @@ -510,7 +520,12 @@ def sample_list_feeds(): ) # 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 @@ -612,7 +627,12 @@ def sample_update_feed(): ) # 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 @@ -705,7 +725,10 @@ def sample_delete_feed(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): @@ -717,7 +740,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-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/client.py b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/client.py index 4c9054065313..077e13f8c411 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/client.py @@ -52,7 +52,10 @@ class AssetServiceClientMeta(type): _transport_registry["grpc"] = AssetServiceGrpcTransport _transport_registry["grpc_asyncio"] = AssetServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AssetServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AssetServiceTransport]: """Returns an appropriate transport class. Args: @@ -157,9 +160,15 @@ def transport(self) -> AssetServiceTransport: return self._transport @staticmethod - def feed_path(project: str, feed: str,) -> str: + def feed_path( + project: str, + feed: str, + ) -> str: """Returns a fully-qualified feed string.""" - return "projects/{project}/feeds/{feed}".format(project=project, feed=feed,) + return "projects/{project}/feeds/{feed}".format( + project=project, + feed=feed, + ) @staticmethod def parse_feed_path(path: str) -> Dict[str, str]: @@ -168,7 +177,9 @@ def parse_feed_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, @@ -181,9 +192,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]: @@ -192,9 +207,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]: @@ -203,9 +222,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]: @@ -214,10 +237,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 @@ -495,7 +522,12 @@ def sample_create_feed(): ) # 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 @@ -591,7 +623,12 @@ def sample_get_feed(): ) # 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 @@ -684,7 +721,12 @@ def sample_list_feeds(): ) # 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 @@ -786,7 +828,12 @@ def sample_update_feed(): ) # 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 @@ -869,7 +916,10 @@ def sample_delete_feed(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): @@ -888,7 +938,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/base.py b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/base.py index bc16b6fb4d62..f2529afceae6 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/base.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/base.py @@ -30,7 +30,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -120,7 +122,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_feed: gapic_v1.method.wrap_method( - self.create_feed, default_timeout=60.0, client_info=client_info, + self.create_feed, + default_timeout=60.0, + client_info=client_info, ), self.get_feed: gapic_v1.method.wrap_method( self.get_feed, @@ -153,7 +157,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_feed: gapic_v1.method.wrap_method( - self.update_feed, default_timeout=60.0, client_info=client_info, + self.update_feed, + default_timeout=60.0, + client_info=client_info, ), self.delete_feed: gapic_v1.method.wrap_method( self.delete_feed, @@ -175,9 +181,9 @@ def _prep_wrapped_messages(self, 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/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/grpc.py b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/grpc.py index 9896364eb3ea..2b6aac8cd05a 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/transports/grpc.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/services/asset_service/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/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/asset_service.py b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/asset_service.py index 64fcda034ccd..74da92524501 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/asset_service.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/asset_service.py @@ -69,9 +69,19 @@ class CreateFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - parent = proto.Field(proto.STRING, number=1,) - feed_id = proto.Field(proto.STRING, number=2,) - feed = proto.Field(proto.MESSAGE, number=3, message="Feed",) + parent = proto.Field( + proto.STRING, + number=1, + ) + feed_id = proto.Field( + proto.STRING, + number=2, + ) + feed = proto.Field( + proto.MESSAGE, + number=3, + message="Feed", + ) class GetFeedRequest(proto.Message): @@ -85,7 +95,10 @@ class GetFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListFeedsRequest(proto.Message): @@ -101,7 +114,10 @@ class ListFeedsRequest(proto.Message): "projects/my-project-id"). """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) class ListFeedsResponse(proto.Message): @@ -112,7 +128,11 @@ class ListFeedsResponse(proto.Message): A list of feeds. """ - feeds = proto.RepeatedField(proto.MESSAGE, number=1, message="Feed",) + feeds = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Feed", + ) class UpdateFeedRequest(proto.Message): @@ -131,9 +151,15 @@ class UpdateFeedRequest(proto.Message): contain fields that are immutable or only set by the server. """ - feed = proto.Field(proto.MESSAGE, number=1, message="Feed",) + feed = proto.Field( + proto.MESSAGE, + number=1, + message="Feed", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -148,7 +174,10 @@ class DeleteFeedRequest(proto.Message): organizations/organization_number/feeds/feed_id """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class OutputConfig(proto.Message): @@ -164,7 +193,10 @@ class OutputConfig(proto.Message): """ gcs_destination = proto.Field( - proto.MESSAGE, number=1, oneof="destination", message="GcsDestination", + proto.MESSAGE, + number=1, + oneof="destination", + message="GcsDestination", ) @@ -185,7 +217,11 @@ class GcsDestination(proto.Message): This field is a member of `oneof`_ ``object_uri``. """ - uri = proto.Field(proto.STRING, number=1, oneof="object_uri",) + uri = proto.Field( + proto.STRING, + number=1, + oneof="object_uri", + ) class PubsubDestination(proto.Message): @@ -197,7 +233,10 @@ class PubsubDestination(proto.Message): example: ``projects/PROJECT_ID/topics/TOPIC_ID``. """ - topic = proto.Field(proto.STRING, number=1,) + topic = proto.Field( + proto.STRING, + number=1, + ) class FeedOutputConfig(proto.Message): @@ -213,7 +252,10 @@ class FeedOutputConfig(proto.Message): """ pubsub_destination = proto.Field( - proto.MESSAGE, number=1, oneof="destination", message="PubsubDestination", + proto.MESSAGE, + number=1, + oneof="destination", + message="PubsubDestination", ) @@ -263,12 +305,27 @@ class Feed(proto.Message): where the asset updates are published to. """ - name = proto.Field(proto.STRING, number=1,) - asset_names = proto.RepeatedField(proto.STRING, number=2,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - content_type = proto.Field(proto.ENUM, number=4, enum="ContentType",) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_names = proto.RepeatedField( + proto.STRING, + number=2, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + content_type = proto.Field( + proto.ENUM, + number=4, + enum="ContentType", + ) feed_output_config = proto.Field( - proto.MESSAGE, number=5, message="FeedOutputConfig", + proto.MESSAGE, + number=5, + message="FeedOutputConfig", ) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/assets.py b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/assets.py index cf7791d664f1..97514ebe2f0b 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/assets.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p2beta1/types/assets.py @@ -22,7 +22,12 @@ __protobuf__ = proto.module( package="google.cloud.asset.v1p2beta1", - manifest={"TemporalAsset", "TimeWindow", "Asset", "Resource",}, + manifest={ + "TemporalAsset", + "TimeWindow", + "Asset", + "Resource", + }, ) @@ -41,9 +46,20 @@ class TemporalAsset(proto.Message): Asset. """ - window = proto.Field(proto.MESSAGE, number=1, message="TimeWindow",) - deleted = proto.Field(proto.BOOL, number=2,) - asset = proto.Field(proto.MESSAGE, number=3, message="Asset",) + window = proto.Field( + proto.MESSAGE, + number=1, + message="TimeWindow", + ) + deleted = proto.Field( + proto.BOOL, + number=2, + ) + asset = proto.Field( + proto.MESSAGE, + number=3, + message="Asset", + ) class TimeWindow(proto.Message): @@ -57,8 +73,16 @@ class TimeWindow(proto.Message): Current timestamp if not specified. """ - start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + start_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class Asset(proto.Message): @@ -93,11 +117,28 @@ class Asset(proto.Message): "organizations/1234"] """ - name = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - resource = proto.Field(proto.MESSAGE, number=3, message="Resource",) - iam_policy = proto.Field(proto.MESSAGE, number=4, message=policy_pb2.Policy,) - ancestors = proto.RepeatedField(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message="Resource", + ) + iam_policy = proto.Field( + proto.MESSAGE, + number=4, + message=policy_pb2.Policy, + ) + ancestors = proto.RepeatedField( + proto.STRING, + number=6, + ) class Resource(proto.Message): @@ -143,12 +184,31 @@ class Resource(proto.Message): be present. """ - version = proto.Field(proto.STRING, number=1,) - discovery_document_uri = proto.Field(proto.STRING, number=2,) - discovery_name = proto.Field(proto.STRING, number=3,) - resource_url = proto.Field(proto.STRING, number=4,) - parent = proto.Field(proto.STRING, number=5,) - data = proto.Field(proto.MESSAGE, number=6, message=struct_pb2.Struct,) + version = proto.Field( + proto.STRING, + number=1, + ) + discovery_document_uri = proto.Field( + proto.STRING, + number=2, + ) + discovery_name = proto.Field( + proto.STRING, + number=3, + ) + resource_url = proto.Field( + proto.STRING, + number=4, + ) + parent = proto.Field( + proto.STRING, + number=5, + ) + data = proto.Field( + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/async_client.py b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/async_client.py index 8240dfeff12f..039c5893ef9b 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/async_client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/async_client.py @@ -279,7 +279,12 @@ def sample_analyze_iam_policy(): ) # 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 @@ -369,7 +374,12 @@ def sample_export_iam_policy_analysis(): ) # 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( @@ -391,7 +401,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-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/client.py b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/client.py index feefa82d2500..4a4f701369fc 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/client.py @@ -55,7 +55,10 @@ class AssetServiceClientMeta(type): _transport_registry["grpc"] = AssetServiceGrpcTransport _transport_registry["grpc_asyncio"] = AssetServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AssetServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AssetServiceTransport]: """Returns an appropriate transport class. Args: @@ -160,7 +163,9 @@ def transport(self) -> AssetServiceTransport: return self._transport @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, @@ -173,9 +178,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]: @@ -184,9 +193,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]: @@ -195,9 +208,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]: @@ -206,10 +223,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 @@ -456,7 +477,12 @@ def sample_analyze_iam_policy(): ) # 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 @@ -549,7 +575,12 @@ def sample_export_iam_policy_analysis(): ) # 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( @@ -578,7 +609,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/base.py b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/base.py index eebdaa0a7317..3bd030c65557 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/base.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -144,9 +146,9 @@ def _prep_wrapped_messages(self, 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/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/grpc.py b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/grpc.py index 333d88da5b3b..ab75d3c77e50 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/grpc.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/services/asset_service/transports/grpc.py @@ -227,8 +227,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/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/asset_service.py b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/asset_service.py index 021dd41a6d18..92c0f4633770 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/asset_service.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/asset_service.py @@ -71,7 +71,10 @@ class ResourceSelector(proto.Message): . """ - full_resource_name = proto.Field(proto.STRING, number=1,) + full_resource_name = proto.Field( + proto.STRING, + number=1, + ) class IdentitySelector(proto.Message): r"""Specifies an identity for which to determine resource access, @@ -85,7 +88,10 @@ class IdentitySelector(proto.Message): binding `__. """ - identity = proto.Field(proto.STRING, number=1,) + identity = proto.Field( + proto.STRING, + number=1, + ) class AccessSelector(proto.Message): r"""Specifies roles and/or permissions to analyze, to determine @@ -101,13 +107,34 @@ class AccessSelector(proto.Message): result. """ - roles = proto.RepeatedField(proto.STRING, number=1,) - permissions = proto.RepeatedField(proto.STRING, number=2,) + roles = proto.RepeatedField( + proto.STRING, + number=1, + ) + permissions = proto.RepeatedField( + proto.STRING, + number=2, + ) - parent = proto.Field(proto.STRING, number=1,) - resource_selector = proto.Field(proto.MESSAGE, number=2, message=ResourceSelector,) - identity_selector = proto.Field(proto.MESSAGE, number=3, message=IdentitySelector,) - access_selector = proto.Field(proto.MESSAGE, number=4, message=AccessSelector,) + parent = proto.Field( + proto.STRING, + number=1, + ) + resource_selector = proto.Field( + proto.MESSAGE, + number=2, + message=ResourceSelector, + ) + identity_selector = proto.Field( + proto.MESSAGE, + number=3, + message=IdentitySelector, + ) + access_selector = proto.Field( + proto.MESSAGE, + number=4, + message=AccessSelector, + ) class AnalyzeIamPolicyRequest(proto.Message): @@ -208,20 +235,46 @@ class Options(proto.Message): Default is empty. """ - expand_groups = proto.Field(proto.BOOL, number=1,) - expand_roles = proto.Field(proto.BOOL, number=2,) - expand_resources = proto.Field(proto.BOOL, number=3,) - output_resource_edges = proto.Field(proto.BOOL, number=4,) - output_group_edges = proto.Field(proto.BOOL, number=5,) - analyze_service_account_impersonation = proto.Field(proto.BOOL, number=6,) + expand_groups = proto.Field( + proto.BOOL, + number=1, + ) + expand_roles = proto.Field( + proto.BOOL, + number=2, + ) + expand_resources = proto.Field( + proto.BOOL, + number=3, + ) + output_resource_edges = proto.Field( + proto.BOOL, + number=4, + ) + output_group_edges = proto.Field( + proto.BOOL, + number=5, + ) + analyze_service_account_impersonation = proto.Field( + proto.BOOL, + number=6, + ) execution_timeout = proto.Field( - proto.MESSAGE, number=7, message=duration_pb2.Duration, + proto.MESSAGE, + number=7, + message=duration_pb2.Duration, ) analysis_query = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisQuery", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisQuery", + ) + options = proto.Field( + proto.MESSAGE, + number=2, + message=Options, ) - options = proto.Field(proto.MESSAGE, number=2, message=Options,) class AnalyzeIamPolicyResponse(proto.Message): @@ -266,20 +319,38 @@ class IamPolicyAnalysis(proto.Message): """ analysis_query = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisQuery", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisQuery", ) analysis_results = proto.RepeatedField( - proto.MESSAGE, number=2, message=assets.IamPolicyAnalysisResult, + proto.MESSAGE, + number=2, + message=assets.IamPolicyAnalysisResult, + ) + fully_explored = proto.Field( + proto.BOOL, + number=3, ) - fully_explored = proto.Field(proto.BOOL, number=3,) - main_analysis = proto.Field(proto.MESSAGE, number=1, message=IamPolicyAnalysis,) + main_analysis = proto.Field( + proto.MESSAGE, + number=1, + message=IamPolicyAnalysis, + ) service_account_impersonation_analysis = proto.RepeatedField( - proto.MESSAGE, number=2, message=IamPolicyAnalysis, + proto.MESSAGE, + number=2, + message=IamPolicyAnalysis, + ) + fully_explored = proto.Field( + proto.BOOL, + number=3, ) - fully_explored = proto.Field(proto.BOOL, number=3,) non_critical_errors = proto.RepeatedField( - proto.MESSAGE, number=4, message=assets.IamPolicyAnalysisResult.AnalysisState, + proto.MESSAGE, + number=4, + message=assets.IamPolicyAnalysisResult.AnalysisState, ) @@ -310,10 +381,16 @@ class GcsDestination(proto.Message): for more information. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) gcs_destination = proto.Field( - proto.MESSAGE, number=1, oneof="destination", message=GcsDestination, + proto.MESSAGE, + number=1, + oneof="destination", + message=GcsDestination, ) @@ -404,19 +481,45 @@ class Options(proto.Message): Default is false. """ - expand_groups = proto.Field(proto.BOOL, number=1,) - expand_roles = proto.Field(proto.BOOL, number=2,) - expand_resources = proto.Field(proto.BOOL, number=3,) - output_resource_edges = proto.Field(proto.BOOL, number=4,) - output_group_edges = proto.Field(proto.BOOL, number=5,) - analyze_service_account_impersonation = proto.Field(proto.BOOL, number=6,) + expand_groups = proto.Field( + proto.BOOL, + number=1, + ) + expand_roles = proto.Field( + proto.BOOL, + number=2, + ) + expand_resources = proto.Field( + proto.BOOL, + number=3, + ) + output_resource_edges = proto.Field( + proto.BOOL, + number=4, + ) + output_group_edges = proto.Field( + proto.BOOL, + number=5, + ) + analyze_service_account_impersonation = proto.Field( + proto.BOOL, + number=6, + ) analysis_query = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisQuery", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisQuery", + ) + options = proto.Field( + proto.MESSAGE, + number=2, + message=Options, ) - options = proto.Field(proto.MESSAGE, number=2, message=Options,) output_config = proto.Field( - proto.MESSAGE, number=3, message="IamPolicyAnalysisOutputConfig", + proto.MESSAGE, + number=3, + message="IamPolicyAnalysisOutputConfig", ) @@ -432,7 +535,9 @@ class ExportIamPolicyAnalysisResponse(proto.Message): """ output_config = proto.Field( - proto.MESSAGE, number=1, message="IamPolicyAnalysisOutputConfig", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisOutputConfig", ) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/assets.py b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/assets.py index e7ffb3dba06c..a2feac1ef9eb 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/assets.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p4beta1/types/assets.py @@ -20,7 +20,10 @@ __protobuf__ = proto.module( - package="google.cloud.asset.v1p4beta1", manifest={"IamPolicyAnalysisResult",}, + package="google.cloud.asset.v1p4beta1", + manifest={ + "IamPolicyAnalysisResult", + }, ) @@ -71,8 +74,15 @@ class AnalysisState(proto.Message): of failure. """ - code = proto.Field(proto.ENUM, number=1, enum=code_pb2.Code,) - cause = proto.Field(proto.STRING, number=2,) + code = proto.Field( + proto.ENUM, + number=1, + enum=code_pb2.Code, + ) + cause = proto.Field( + proto.STRING, + number=2, + ) class Resource(proto.Message): r"""A GCP resource that appears in an access control list. @@ -85,9 +95,14 @@ class Resource(proto.Message): The analysis state of this resource node. """ - full_resource_name = proto.Field(proto.STRING, number=1,) + full_resource_name = proto.Field( + proto.STRING, + number=1, + ) analysis_state = proto.Field( - proto.MESSAGE, number=2, message="IamPolicyAnalysisResult.AnalysisState", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisResult.AnalysisState", ) class Access(proto.Message): @@ -113,10 +128,20 @@ class Access(proto.Message): The analysis state of this access node. """ - role = proto.Field(proto.STRING, number=1, oneof="oneof_access",) - permission = proto.Field(proto.STRING, number=2, oneof="oneof_access",) + role = proto.Field( + proto.STRING, + number=1, + oneof="oneof_access", + ) + permission = proto.Field( + proto.STRING, + number=2, + oneof="oneof_access", + ) analysis_state = proto.Field( - proto.MESSAGE, number=3, message="IamPolicyAnalysisResult.AnalysisState", + proto.MESSAGE, + number=3, + message="IamPolicyAnalysisResult.AnalysisState", ) class Edge(proto.Message): @@ -129,8 +154,14 @@ class Edge(proto.Message): The target node of the edge. """ - source_node = proto.Field(proto.STRING, number=1,) - target_node = proto.Field(proto.STRING, number=2,) + source_node = proto.Field( + proto.STRING, + number=1, + ) + target_node = proto.Field( + proto.STRING, + number=2, + ) class Identity(proto.Message): r"""An identity that appears in an access control list. @@ -153,9 +184,14 @@ class Identity(proto.Message): The analysis state of this identity node. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) analysis_state = proto.Field( - proto.MESSAGE, number=2, message="IamPolicyAnalysisResult.AnalysisState", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisResult.AnalysisState", ) class AccessControlList(proto.Message): @@ -203,13 +239,19 @@ class AccessControlList(proto.Message): """ resources = proto.RepeatedField( - proto.MESSAGE, number=1, message="IamPolicyAnalysisResult.Resource", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisResult.Resource", ) accesses = proto.RepeatedField( - proto.MESSAGE, number=2, message="IamPolicyAnalysisResult.Access", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisResult.Access", ) resource_edges = proto.RepeatedField( - proto.MESSAGE, number=3, message="IamPolicyAnalysisResult.Edge", + proto.MESSAGE, + number=3, + message="IamPolicyAnalysisResult.Edge", ) class IdentityList(proto.Message): @@ -238,19 +280,39 @@ class IdentityList(proto.Message): """ identities = proto.RepeatedField( - proto.MESSAGE, number=1, message="IamPolicyAnalysisResult.Identity", + proto.MESSAGE, + number=1, + message="IamPolicyAnalysisResult.Identity", ) group_edges = proto.RepeatedField( - proto.MESSAGE, number=2, message="IamPolicyAnalysisResult.Edge", + proto.MESSAGE, + number=2, + message="IamPolicyAnalysisResult.Edge", ) - attached_resource_full_name = proto.Field(proto.STRING, number=1,) - iam_binding = proto.Field(proto.MESSAGE, number=2, message=policy_pb2.Binding,) + attached_resource_full_name = proto.Field( + proto.STRING, + number=1, + ) + iam_binding = proto.Field( + proto.MESSAGE, + number=2, + message=policy_pb2.Binding, + ) access_control_lists = proto.RepeatedField( - proto.MESSAGE, number=3, message=AccessControlList, + proto.MESSAGE, + number=3, + message=AccessControlList, + ) + identity_list = proto.Field( + proto.MESSAGE, + number=4, + message=IdentityList, + ) + fully_explored = proto.Field( + proto.BOOL, + number=5, ) - identity_list = proto.Field(proto.MESSAGE, number=4, message=IdentityList,) - fully_explored = proto.Field(proto.BOOL, number=5,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/async_client.py b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/async_client.py index feb60f77e8bf..0c8879e4260c 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/async_client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/async_client.py @@ -284,12 +284,20 @@ def sample_list_assets(): ) # 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.ListAssetsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -304,7 +312,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-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/client.py b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/client.py index fa01fbd771c6..983acd35d4d6 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/client.py @@ -54,7 +54,10 @@ class AssetServiceClientMeta(type): _transport_registry["grpc"] = AssetServiceGrpcTransport _transport_registry["grpc_asyncio"] = AssetServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AssetServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AssetServiceTransport]: """Returns an appropriate transport class. Args: @@ -159,10 +162,14 @@ def transport(self) -> AssetServiceTransport: return self._transport @staticmethod - def access_level_path(access_policy: str, access_level: str,) -> str: + def access_level_path( + access_policy: str, + access_level: str, + ) -> str: """Returns a fully-qualified access_level string.""" return "accessPolicies/{access_policy}/accessLevels/{access_level}".format( - access_policy=access_policy, access_level=access_level, + access_policy=access_policy, + access_level=access_level, ) @staticmethod @@ -175,9 +182,13 @@ def parse_access_level_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def access_policy_path(access_policy: str,) -> str: + def access_policy_path( + access_policy: str, + ) -> str: """Returns a fully-qualified access_policy string.""" - return "accessPolicies/{access_policy}".format(access_policy=access_policy,) + return "accessPolicies/{access_policy}".format( + access_policy=access_policy, + ) @staticmethod def parse_access_policy_path(path: str) -> Dict[str, str]: @@ -191,10 +202,14 @@ def asset_path() -> str: return "*".format() @staticmethod - def service_perimeter_path(access_policy: str, service_perimeter: str,) -> str: + def service_perimeter_path( + access_policy: str, + service_perimeter: str, + ) -> str: """Returns a fully-qualified service_perimeter string.""" return "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format( - access_policy=access_policy, service_perimeter=service_perimeter, + access_policy=access_policy, + service_perimeter=service_perimeter, ) @staticmethod @@ -207,7 +222,9 @@ def parse_service_perimeter_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, @@ -220,9 +237,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]: @@ -231,9 +252,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]: @@ -242,9 +267,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]: @@ -253,10 +282,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 @@ -498,12 +531,20 @@ def sample_list_assets(): ) # 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.ListAssetsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -525,7 +566,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/base.py b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/base.py index 125ee3f83173..3123ad4bfbdc 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/base.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-asset",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-asset", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -138,9 +140,9 @@ def _prep_wrapped_messages(self, 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/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/grpc.py b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/grpc.py index 3efedfdc8d07..85eb92a9f001 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/grpc.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/services/asset_service/transports/grpc.py @@ -224,8 +224,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/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/asset_service.py b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/asset_service.py index cefe263724e3..1f15df80764a 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/asset_service.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/asset_service.py @@ -21,7 +21,11 @@ __protobuf__ = proto.module( package="google.cloud.asset.v1p5beta1", - manifest={"ContentType", "ListAssetsRequest", "ListAssetsResponse",}, + manifest={ + "ContentType", + "ListAssetsRequest", + "ListAssetsResponse", + }, ) @@ -74,12 +78,32 @@ class ListAssetsRequest(proto.Message): of assets. """ - parent = proto.Field(proto.STRING, number=1,) - read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - asset_types = proto.RepeatedField(proto.STRING, number=3,) - content_type = proto.Field(proto.ENUM, number=4, enum="ContentType",) - page_size = proto.Field(proto.INT32, number=5,) - page_token = proto.Field(proto.STRING, number=6,) + parent = proto.Field( + proto.STRING, + number=1, + ) + read_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + asset_types = proto.RepeatedField( + proto.STRING, + number=3, + ) + content_type = proto.Field( + proto.ENUM, + number=4, + enum="ContentType", + ) + page_size = proto.Field( + proto.INT32, + number=5, + ) + page_token = proto.Field( + proto.STRING, + number=6, + ) class ListAssetsResponse(proto.Message): @@ -99,9 +123,20 @@ class ListAssetsResponse(proto.Message): def raw_page(self): return self - read_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - assets = proto.RepeatedField(proto.MESSAGE, number=2, message=gca_assets.Asset,) - next_page_token = proto.Field(proto.STRING, number=3,) + read_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + assets = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=gca_assets.Asset, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/assets.py b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/assets.py index 18203a95c882..5399b2c85282 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/assets.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1p5beta1/types/assets.py @@ -24,7 +24,11 @@ __protobuf__ = proto.module( - package="google.cloud.asset.v1p5beta1", manifest={"Asset", "Resource",}, + package="google.cloud.asset.v1p5beta1", + manifest={ + "Asset", + "Resource", + }, ) @@ -81,12 +85,28 @@ class Asset(proto.Message): "organizations/1234"] """ - name = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - resource = proto.Field(proto.MESSAGE, number=3, message="Resource",) - iam_policy = proto.Field(proto.MESSAGE, number=4, message=policy_pb2.Policy,) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + resource = proto.Field( + proto.MESSAGE, + number=3, + message="Resource", + ) + iam_policy = proto.Field( + proto.MESSAGE, + number=4, + message=policy_pb2.Policy, + ) org_policy = proto.RepeatedField( - proto.MESSAGE, number=6, message=orgpolicy_pb2.Policy, + proto.MESSAGE, + number=6, + message=orgpolicy_pb2.Policy, ) access_policy = proto.Field( proto.MESSAGE, @@ -106,7 +126,10 @@ class Asset(proto.Message): oneof="access_context_policy", message=service_perimeter_pb2.ServicePerimeter, ) - ancestors = proto.RepeatedField(proto.STRING, number=10,) + ancestors = proto.RepeatedField( + proto.STRING, + number=10, + ) class Resource(proto.Message): @@ -152,12 +175,31 @@ class Resource(proto.Message): be present. """ - version = proto.Field(proto.STRING, number=1,) - discovery_document_uri = proto.Field(proto.STRING, number=2,) - discovery_name = proto.Field(proto.STRING, number=3,) - resource_url = proto.Field(proto.STRING, number=4,) - parent = proto.Field(proto.STRING, number=5,) - data = proto.Field(proto.MESSAGE, number=6, message=struct_pb2.Struct,) + version = proto.Field( + proto.STRING, + number=1, + ) + discovery_document_uri = proto.Field( + proto.STRING, + number=2, + ) + discovery_name = proto.Field( + proto.STRING, + number=3, + ) + resource_url = proto.Field( + proto.STRING, + number=4, + ) + parent = proto.Field( + proto.STRING, + number=5, + ) + data = proto.Field( + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-asset/noxfile.py b/packages/google-cloud-asset/noxfile.py index 4cc0734e0d1a..58935cad1df4 100644 --- a/packages/google-cloud-asset/noxfile.py +++ b/packages/google-cloud-asset/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/packages/google-cloud-asset/samples/snippets/noxfile.py b/packages/google-cloud-asset/samples/snippets/noxfile.py index 4c808af73ea2..949e0fde9ae1 100644 --- a/packages/google-cloud-asset/samples/snippets/noxfile.py +++ b/packages/google-cloud-asset/samples/snippets/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py index 76997532961d..a9a6632accf0 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -91,7 +91,13 @@ def test__get_default_mtls_endpoint(): assert AssetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -131,7 +137,13 @@ def test_asset_service_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -486,7 +498,9 @@ def test_asset_service_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) @@ -624,10 +638,17 @@ def test_asset_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [asset_service.ExportAssetsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.ExportAssetsRequest, + dict, + ], +) def test_export_assets(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -653,7 +674,8 @@ def test_export_assets_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -669,7 +691,8 @@ async def test_export_assets_async( transport: str = "grpc_asyncio", request_type=asset_service.ExportAssetsRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -699,7 +722,9 @@ async def test_export_assets_async_from_dict(): def test_export_assets_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -719,12 +744,17 @@ def test_export_assets_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_export_assets_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -746,13 +776,23 @@ async def test_export_assets_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"] -@pytest.mark.parametrize("request_type", [asset_service.ListAssetsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.ListAssetsRequest, + dict, + ], +) def test_list_assets(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -781,7 +821,8 @@ def test_list_assets_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -797,7 +838,8 @@ async def test_list_assets_async( transport: str = "grpc_asyncio", request_type=asset_service.ListAssetsRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -808,7 +850,9 @@ async def test_list_assets_async( with mock.patch.object(type(client.transport.list_assets), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - asset_service.ListAssetsResponse(next_page_token="next_page_token_value",) + asset_service.ListAssetsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_assets(request) @@ -828,7 +872,9 @@ async def test_list_assets_async_from_dict(): def test_list_assets_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -848,12 +894,17 @@ def test_list_assets_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_assets_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -875,11 +926,16 @@ async def test_list_assets_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_assets_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_assets), "__call__") as call: @@ -887,7 +943,9 @@ def test_list_assets_flattened(): call.return_value = asset_service.ListAssetsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_assets(parent="parent_value",) + client.list_assets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -899,19 +957,24 @@ def test_list_assets_flattened(): def test_list_assets_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_assets( - asset_service.ListAssetsRequest(), parent="parent_value", + asset_service.ListAssetsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_assets_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_assets), "__call__") as call: @@ -923,7 +986,9 @@ async def test_list_assets_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_assets(parent="parent_value",) + response = await client.list_assets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -936,19 +1001,23 @@ async def test_list_assets_flattened_async(): @pytest.mark.asyncio async def test_list_assets_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_assets( - asset_service.ListAssetsRequest(), parent="parent_value", + asset_service.ListAssetsRequest(), + parent="parent_value", ) def test_list_assets_pager(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -956,14 +1025,29 @@ def test_list_assets_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) @@ -982,7 +1066,8 @@ def test_list_assets_pager(transport_name: str = "grpc"): def test_list_assets_pages(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -990,14 +1075,29 @@ def test_list_assets_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) pages = list(client.list_assets(request={}).pages) @@ -1007,7 +1107,9 @@ def test_list_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_assets_async_pager(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1016,17 +1118,34 @@ async def test_list_assets_async_pager(): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) - async_pager = await client.list_assets(request={},) + async_pager = await client.list_assets( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1038,7 +1157,9 @@ async def test_list_assets_async_pager(): @pytest.mark.asyncio async def test_list_assets_async_pages(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1047,14 +1168,29 @@ async def test_list_assets_async_pages(): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) pages = [] @@ -1065,11 +1201,16 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( - "request_type", [asset_service.BatchGetAssetsHistoryRequest, dict,] + "request_type", + [ + asset_service.BatchGetAssetsHistoryRequest, + dict, + ], ) def test_batch_get_assets_history(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1097,7 +1238,8 @@ def test_batch_get_assets_history_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1116,7 +1258,8 @@ async def test_batch_get_assets_history_async( request_type=asset_service.BatchGetAssetsHistoryRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1148,7 +1291,9 @@ async def test_batch_get_assets_history_async_from_dict(): def test_batch_get_assets_history_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1170,12 +1315,17 @@ def test_batch_get_assets_history_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_batch_get_assets_history_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1199,13 +1349,23 @@ async def test_batch_get_assets_history_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"] -@pytest.mark.parametrize("request_type", [asset_service.CreateFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.CreateFeedRequest, + dict, + ], +) def test_create_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1242,7 +1402,8 @@ def test_create_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1258,7 +1419,8 @@ async def test_create_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.CreateFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1299,7 +1461,9 @@ async def test_create_feed_async_from_dict(): def test_create_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1319,12 +1483,17 @@ def test_create_feed_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_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1344,11 +1513,16 @@ async def test_create_feed_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_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_feed), "__call__") as call: @@ -1356,7 +1530,9 @@ def test_create_feed_flattened(): call.return_value = asset_service.Feed() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_feed(parent="parent_value",) + client.create_feed( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1368,19 +1544,24 @@ def test_create_feed_flattened(): def test_create_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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.create_feed( - asset_service.CreateFeedRequest(), parent="parent_value", + asset_service.CreateFeedRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_create_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_feed), "__call__") as call: @@ -1390,7 +1571,9 @@ async def test_create_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_feed(parent="parent_value",) + response = await client.create_feed( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1403,20 +1586,30 @@ async def test_create_feed_flattened_async(): @pytest.mark.asyncio async def test_create_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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.create_feed( - asset_service.CreateFeedRequest(), parent="parent_value", + asset_service.CreateFeedRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [asset_service.GetFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.GetFeedRequest, + dict, + ], +) def test_get_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1453,7 +1646,8 @@ def test_get_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1469,7 +1663,8 @@ async def test_get_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.GetFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1510,7 +1705,9 @@ async def test_get_feed_async_from_dict(): def test_get_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1530,12 +1727,17 @@ def test_get_feed_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_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1555,11 +1757,16 @@ async def test_get_feed_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_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_feed), "__call__") as call: @@ -1567,7 +1774,9 @@ def test_get_feed_flattened(): call.return_value = asset_service.Feed() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_feed(name="name_value",) + client.get_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1579,19 +1788,24 @@ def test_get_feed_flattened(): def test_get_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_feed( - asset_service.GetFeedRequest(), name="name_value", + asset_service.GetFeedRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_feed), "__call__") as call: @@ -1601,7 +1815,9 @@ async def test_get_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_feed(name="name_value",) + response = await client.get_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1614,20 +1830,30 @@ async def test_get_feed_flattened_async(): @pytest.mark.asyncio async def test_get_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_feed( - asset_service.GetFeedRequest(), name="name_value", + asset_service.GetFeedRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [asset_service.ListFeedsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.ListFeedsRequest, + dict, + ], +) def test_list_feeds(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1653,7 +1879,8 @@ def test_list_feeds_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1669,7 +1896,8 @@ async def test_list_feeds_async( transport: str = "grpc_asyncio", request_type=asset_service.ListFeedsRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1699,7 +1927,9 @@ async def test_list_feeds_async_from_dict(): def test_list_feeds_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1719,12 +1949,17 @@ def test_list_feeds_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_feeds_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1746,11 +1981,16 @@ async def test_list_feeds_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_feeds_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_feeds), "__call__") as call: @@ -1758,7 +1998,9 @@ def test_list_feeds_flattened(): call.return_value = asset_service.ListFeedsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_feeds(parent="parent_value",) + client.list_feeds( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1770,19 +2012,24 @@ def test_list_feeds_flattened(): def test_list_feeds_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_feeds( - asset_service.ListFeedsRequest(), parent="parent_value", + asset_service.ListFeedsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_feeds_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_feeds), "__call__") as call: @@ -1794,7 +2041,9 @@ async def test_list_feeds_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_feeds(parent="parent_value",) + response = await client.list_feeds( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1807,20 +2056,30 @@ async def test_list_feeds_flattened_async(): @pytest.mark.asyncio async def test_list_feeds_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_feeds( - asset_service.ListFeedsRequest(), parent="parent_value", + asset_service.ListFeedsRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [asset_service.UpdateFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.UpdateFeedRequest, + dict, + ], +) def test_update_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1857,7 +2116,8 @@ def test_update_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1873,7 +2133,8 @@ async def test_update_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.UpdateFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1914,7 +2175,9 @@ async def test_update_feed_async_from_dict(): def test_update_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1934,12 +2197,17 @@ def test_update_feed_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "feed.name=feed.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "feed.name=feed.name/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1959,11 +2227,16 @@ async def test_update_feed_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "feed.name=feed.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "feed.name=feed.name/value", + ) in kw["metadata"] def test_update_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_feed), "__call__") as call: @@ -1971,7 +2244,9 @@ def test_update_feed_flattened(): call.return_value = asset_service.Feed() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_feed(feed=asset_service.Feed(name="name_value"),) + client.update_feed( + feed=asset_service.Feed(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1983,7 +2258,9 @@ def test_update_feed_flattened(): def test_update_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1996,7 +2273,9 @@ def test_update_feed_flattened_error(): @pytest.mark.asyncio async def test_update_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_feed), "__call__") as call: @@ -2006,7 +2285,9 @@ async def test_update_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_feed(feed=asset_service.Feed(name="name_value"),) + response = await client.update_feed( + feed=asset_service.Feed(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -2019,7 +2300,9 @@ async def test_update_feed_flattened_async(): @pytest.mark.asyncio async def test_update_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2030,10 +2313,17 @@ async def test_update_feed_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [asset_service.DeleteFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.DeleteFeedRequest, + dict, + ], +) def test_delete_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2059,7 +2349,8 @@ def test_delete_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2075,7 +2366,8 @@ async def test_delete_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.DeleteFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2103,7 +2395,9 @@ async def test_delete_feed_async_from_dict(): def test_delete_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -2123,12 +2417,17 @@ def test_delete_feed_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_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -2148,11 +2447,16 @@ async def test_delete_feed_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_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_feed), "__call__") as call: @@ -2160,7 +2464,9 @@ def test_delete_feed_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_feed(name="name_value",) + client.delete_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2172,19 +2478,24 @@ def test_delete_feed_flattened(): def test_delete_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_feed( - asset_service.DeleteFeedRequest(), name="name_value", + asset_service.DeleteFeedRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_feed), "__call__") as call: @@ -2194,7 +2505,9 @@ async def test_delete_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_feed(name="name_value",) + response = await client.delete_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2207,22 +2520,30 @@ async def test_delete_feed_flattened_async(): @pytest.mark.asyncio async def test_delete_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_feed( - asset_service.DeleteFeedRequest(), name="name_value", + asset_service.DeleteFeedRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [asset_service.SearchAllResourcesRequest, dict,] + "request_type", + [ + asset_service.SearchAllResourcesRequest, + dict, + ], ) def test_search_all_resources(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2253,7 +2574,8 @@ def test_search_all_resources_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2272,7 +2594,8 @@ async def test_search_all_resources_async( request_type=asset_service.SearchAllResourcesRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2307,7 +2630,9 @@ async def test_search_all_resources_async_from_dict(): def test_search_all_resources_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -2329,12 +2654,17 @@ def test_search_all_resources_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_search_all_resources_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -2358,11 +2688,16 @@ async def test_search_all_resources_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] def test_search_all_resources_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2373,7 +2708,9 @@ def test_search_all_resources_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.search_all_resources( - scope="scope_value", query="query_value", asset_types=["asset_types_value"], + scope="scope_value", + query="query_value", + asset_types=["asset_types_value"], ) # Establish that the underlying call was made with the expected @@ -2392,7 +2729,9 @@ def test_search_all_resources_flattened(): def test_search_all_resources_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2407,7 +2746,9 @@ def test_search_all_resources_flattened_error(): @pytest.mark.asyncio async def test_search_all_resources_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2422,7 +2763,9 @@ async def test_search_all_resources_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.search_all_resources( - scope="scope_value", query="query_value", asset_types=["asset_types_value"], + scope="scope_value", + query="query_value", + asset_types=["asset_types_value"], ) # Establish that the underlying call was made with the expected @@ -2442,7 +2785,9 @@ async def test_search_all_resources_flattened_async(): @pytest.mark.asyncio async def test_search_all_resources_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2457,7 +2802,8 @@ async def test_search_all_resources_flattened_error_async(): def test_search_all_resources_pager(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -2475,13 +2821,20 @@ def test_search_all_resources_pager(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(),], next_page_token="ghi", + results=[ + assets.ResourceSearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(), assets.ResourceSearchResult(),], + results=[ + assets.ResourceSearchResult(), + assets.ResourceSearchResult(), + ], ), RuntimeError, ) @@ -2501,7 +2854,8 @@ def test_search_all_resources_pager(transport_name: str = "grpc"): def test_search_all_resources_pages(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -2519,13 +2873,20 @@ def test_search_all_resources_pages(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(),], next_page_token="ghi", + results=[ + assets.ResourceSearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(), assets.ResourceSearchResult(),], + results=[ + assets.ResourceSearchResult(), + assets.ResourceSearchResult(), + ], ), RuntimeError, ) @@ -2536,7 +2897,9 @@ def test_search_all_resources_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_all_resources_async_pager(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2555,17 +2918,26 @@ async def test_search_all_resources_async_pager(): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(),], next_page_token="ghi", + results=[ + assets.ResourceSearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(), assets.ResourceSearchResult(),], + results=[ + assets.ResourceSearchResult(), + assets.ResourceSearchResult(), + ], ), RuntimeError, ) - async_pager = await client.search_all_resources(request={},) + async_pager = await client.search_all_resources( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2577,7 +2949,9 @@ async def test_search_all_resources_async_pager(): @pytest.mark.asyncio async def test_search_all_resources_async_pages(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2596,13 +2970,20 @@ async def test_search_all_resources_async_pages(): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(),], next_page_token="ghi", + results=[ + assets.ResourceSearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( - results=[assets.ResourceSearchResult(), assets.ResourceSearchResult(),], + results=[ + assets.ResourceSearchResult(), + assets.ResourceSearchResult(), + ], ), RuntimeError, ) @@ -2614,11 +2995,16 @@ async def test_search_all_resources_async_pages(): @pytest.mark.parametrize( - "request_type", [asset_service.SearchAllIamPoliciesRequest, dict,] + "request_type", + [ + asset_service.SearchAllIamPoliciesRequest, + dict, + ], ) def test_search_all_iam_policies(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2649,7 +3035,8 @@ def test_search_all_iam_policies_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2668,7 +3055,8 @@ async def test_search_all_iam_policies_async( request_type=asset_service.SearchAllIamPoliciesRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2703,7 +3091,9 @@ async def test_search_all_iam_policies_async_from_dict(): def test_search_all_iam_policies_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -2725,12 +3115,17 @@ def test_search_all_iam_policies_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_search_all_iam_policies_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -2754,11 +3149,16 @@ async def test_search_all_iam_policies_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] def test_search_all_iam_policies_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2769,7 +3169,8 @@ def test_search_all_iam_policies_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.search_all_iam_policies( - scope="scope_value", query="query_value", + scope="scope_value", + query="query_value", ) # Establish that the underlying call was made with the expected @@ -2785,7 +3186,9 @@ def test_search_all_iam_policies_flattened(): def test_search_all_iam_policies_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2799,7 +3202,9 @@ def test_search_all_iam_policies_flattened_error(): @pytest.mark.asyncio async def test_search_all_iam_policies_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2814,7 +3219,8 @@ async def test_search_all_iam_policies_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.search_all_iam_policies( - scope="scope_value", query="query_value", + scope="scope_value", + query="query_value", ) # Establish that the underlying call was made with the expected @@ -2831,7 +3237,9 @@ async def test_search_all_iam_policies_flattened_async(): @pytest.mark.asyncio async def test_search_all_iam_policies_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2845,7 +3253,8 @@ async def test_search_all_iam_policies_flattened_error_async(): def test_search_all_iam_policies_pager(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -2863,10 +3272,14 @@ def test_search_all_iam_policies_pager(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -2892,7 +3305,8 @@ def test_search_all_iam_policies_pager(transport_name: str = "grpc"): def test_search_all_iam_policies_pages(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -2910,10 +3324,14 @@ def test_search_all_iam_policies_pages(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -2930,7 +3348,9 @@ def test_search_all_iam_policies_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_all_iam_policies_async_pager(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2949,10 +3369,14 @@ async def test_search_all_iam_policies_async_pager(): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -2962,7 +3386,9 @@ async def test_search_all_iam_policies_async_pager(): ), RuntimeError, ) - async_pager = await client.search_all_iam_policies(request={},) + async_pager = await client.search_all_iam_policies( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2974,7 +3400,9 @@ async def test_search_all_iam_policies_async_pager(): @pytest.mark.asyncio async def test_search_all_iam_policies_async_pages(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2993,10 +3421,14 @@ async def test_search_all_iam_policies_async_pages(): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -3013,10 +3445,17 @@ async def test_search_all_iam_policies_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [asset_service.AnalyzeIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeIamPolicyRequest, + dict, + ], +) def test_analyze_iam_policy(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3028,7 +3467,9 @@ def test_analyze_iam_policy(request_type, transport: str = "grpc"): type(client.transport.analyze_iam_policy), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = asset_service.AnalyzeIamPolicyResponse(fully_explored=True,) + call.return_value = asset_service.AnalyzeIamPolicyResponse( + fully_explored=True, + ) response = client.analyze_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -3045,7 +3486,8 @@ def test_analyze_iam_policy_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3063,7 +3505,8 @@ async def test_analyze_iam_policy_async( transport: str = "grpc_asyncio", request_type=asset_service.AnalyzeIamPolicyRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3076,7 +3519,9 @@ async def test_analyze_iam_policy_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - asset_service.AnalyzeIamPolicyResponse(fully_explored=True,) + asset_service.AnalyzeIamPolicyResponse( + fully_explored=True, + ) ) response = await client.analyze_iam_policy(request) @@ -3096,7 +3541,9 @@ async def test_analyze_iam_policy_async_from_dict(): def test_analyze_iam_policy_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -3126,7 +3573,9 @@ def test_analyze_iam_policy_field_headers(): @pytest.mark.asyncio async def test_analyze_iam_policy_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -3157,11 +3606,16 @@ async def test_analyze_iam_policy_field_headers_async(): @pytest.mark.parametrize( - "request_type", [asset_service.AnalyzeIamPolicyLongrunningRequest, dict,] + "request_type", + [ + asset_service.AnalyzeIamPolicyLongrunningRequest, + dict, + ], ) def test_analyze_iam_policy_longrunning(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3189,7 +3643,8 @@ def test_analyze_iam_policy_longrunning_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3208,7 +3663,8 @@ async def test_analyze_iam_policy_longrunning_async( request_type=asset_service.AnalyzeIamPolicyLongrunningRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3240,7 +3696,9 @@ async def test_analyze_iam_policy_longrunning_async_from_dict(): def test_analyze_iam_policy_longrunning_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -3270,7 +3728,9 @@ def test_analyze_iam_policy_longrunning_field_headers(): @pytest.mark.asyncio async def test_analyze_iam_policy_longrunning_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -3300,10 +3760,17 @@ async def test_analyze_iam_policy_longrunning_field_headers_async(): ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [asset_service.AnalyzeMoveRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeMoveRequest, + dict, + ], +) def test_analyze_move(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3329,7 +3796,8 @@ def test_analyze_move_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3345,7 +3813,8 @@ async def test_analyze_move_async( transport: str = "grpc_asyncio", request_type=asset_service.AnalyzeMoveRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3375,7 +3844,9 @@ async def test_analyze_move_async_from_dict(): def test_analyze_move_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -3395,12 +3866,17 @@ def test_analyze_move_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_analyze_move_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -3422,7 +3898,10 @@ async def test_analyze_move_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -3432,7 +3911,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - 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. @@ -3452,7 +3932,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AssetServiceClient(client_options=options, transport=transport,) + client = AssetServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3468,7 +3951,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3513,8 +3997,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AssetServiceGrpcTransport,) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AssetServiceGrpcTransport, + ) def test_asset_service_base_transport_error(): @@ -3576,7 +4065,8 @@ def test_asset_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AssetServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3731,7 +4221,8 @@ def test_asset_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3743,7 +4234,8 @@ def test_asset_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3844,12 +4336,16 @@ def test_asset_service_transport_channel_mtls_with_adc(transport_class): def test_asset_service_grpc_lro_client(): client = AssetServiceClient( - 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 @@ -3857,12 +4353,16 @@ def test_asset_service_grpc_lro_client(): def test_asset_service_grpc_lro_async_client(): client = AssetServiceAsyncClient( - 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 @@ -3872,7 +4372,8 @@ def test_access_level_path(): access_policy = "squid" access_level = "clam" expected = "accessPolicies/{access_policy}/accessLevels/{access_level}".format( - access_policy=access_policy, access_level=access_level, + access_policy=access_policy, + access_level=access_level, ) actual = AssetServiceClient.access_level_path(access_policy, access_level) assert expected == actual @@ -3892,7 +4393,9 @@ def test_parse_access_level_path(): def test_access_policy_path(): access_policy = "oyster" - expected = "accessPolicies/{access_policy}".format(access_policy=access_policy,) + expected = "accessPolicies/{access_policy}".format( + access_policy=access_policy, + ) actual = AssetServiceClient.access_policy_path(access_policy) assert expected == actual @@ -3917,7 +4420,10 @@ def test_asset_path(): def test_feed_path(): project = "cuttlefish" feed = "mussel" - expected = "projects/{project}/feeds/{feed}".format(project=project, feed=feed,) + expected = "projects/{project}/feeds/{feed}".format( + project=project, + feed=feed, + ) actual = AssetServiceClient.feed_path(project, feed) assert expected == actual @@ -3938,8 +4444,12 @@ def test_inventory_path(): project = "scallop" location = "abalone" instance = "squid" - expected = "projects/{project}/locations/{location}/instances/{instance}/inventory".format( - project=project, location=location, instance=instance, + expected = ( + "projects/{project}/locations/{location}/instances/{instance}/inventory".format( + project=project, + location=location, + instance=instance, + ) ) actual = AssetServiceClient.inventory_path(project, location, instance) assert expected == actual @@ -3961,8 +4471,11 @@ def test_parse_inventory_path(): def test_service_perimeter_path(): access_policy = "oyster" service_perimeter = "nudibranch" - expected = "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format( - access_policy=access_policy, service_perimeter=service_perimeter, + expected = ( + "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format( + access_policy=access_policy, + service_perimeter=service_perimeter, + ) ) actual = AssetServiceClient.service_perimeter_path(access_policy, service_perimeter) assert expected == actual @@ -4002,7 +4515,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AssetServiceClient.common_folder_path(folder) assert expected == actual @@ -4020,7 +4535,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AssetServiceClient.common_organization_path(organization) assert expected == actual @@ -4038,7 +4555,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AssetServiceClient.common_project_path(project) assert expected == actual @@ -4058,7 +4577,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AssetServiceClient.common_location_path(project, location) assert expected == actual @@ -4083,7 +4603,8 @@ def test_client_with_default_client_info(): transports.AssetServiceTransport, "_prep_wrapped_messages" ) as prep: client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4092,7 +4613,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AssetServiceClient.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) @@ -4100,7 +4622,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AssetServiceAsyncClient( - 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/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py index c7e5c3487aa4..eaf7718fd968 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py @@ -82,7 +82,13 @@ def test__get_default_mtls_endpoint(): assert AssetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -122,7 +128,13 @@ def test_asset_service_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -477,7 +489,9 @@ def test_asset_service_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) @@ -616,11 +630,16 @@ def test_asset_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [asset_service.SearchAllResourcesRequest, dict,] + "request_type", + [ + asset_service.SearchAllResourcesRequest, + dict, + ], ) def test_search_all_resources(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -651,7 +670,8 @@ def test_search_all_resources_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -670,7 +690,8 @@ async def test_search_all_resources_async( request_type=asset_service.SearchAllResourcesRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -705,7 +726,9 @@ async def test_search_all_resources_async_from_dict(): def test_search_all_resources_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -727,12 +750,17 @@ def test_search_all_resources_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_search_all_resources_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -756,11 +784,16 @@ async def test_search_all_resources_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] def test_search_all_resources_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -771,7 +804,9 @@ def test_search_all_resources_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.search_all_resources( - scope="scope_value", query="query_value", asset_types=["asset_types_value"], + scope="scope_value", + query="query_value", + asset_types=["asset_types_value"], ) # Establish that the underlying call was made with the expected @@ -790,7 +825,9 @@ def test_search_all_resources_flattened(): def test_search_all_resources_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -805,7 +842,9 @@ def test_search_all_resources_flattened_error(): @pytest.mark.asyncio async def test_search_all_resources_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -820,7 +859,9 @@ async def test_search_all_resources_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.search_all_resources( - scope="scope_value", query="query_value", asset_types=["asset_types_value"], + scope="scope_value", + query="query_value", + asset_types=["asset_types_value"], ) # Establish that the underlying call was made with the expected @@ -840,7 +881,9 @@ async def test_search_all_resources_flattened_async(): @pytest.mark.asyncio async def test_search_all_resources_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -855,7 +898,8 @@ async def test_search_all_resources_flattened_error_async(): def test_search_all_resources_pager(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -873,10 +917,14 @@ def test_search_all_resources_pager(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.StandardResourceMetadata(),], next_page_token="ghi", + results=[ + assets.StandardResourceMetadata(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( results=[ @@ -902,7 +950,8 @@ def test_search_all_resources_pager(transport_name: str = "grpc"): def test_search_all_resources_pages(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -920,10 +969,14 @@ def test_search_all_resources_pages(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.StandardResourceMetadata(),], next_page_token="ghi", + results=[ + assets.StandardResourceMetadata(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( results=[ @@ -940,7 +993,9 @@ def test_search_all_resources_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_all_resources_async_pager(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -959,10 +1014,14 @@ async def test_search_all_resources_async_pager(): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.StandardResourceMetadata(),], next_page_token="ghi", + results=[ + assets.StandardResourceMetadata(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( results=[ @@ -972,7 +1031,9 @@ async def test_search_all_resources_async_pager(): ), RuntimeError, ) - async_pager = await client.search_all_resources(request={},) + async_pager = await client.search_all_resources( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -984,7 +1045,9 @@ async def test_search_all_resources_async_pager(): @pytest.mark.asyncio async def test_search_all_resources_async_pages(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1003,10 +1066,14 @@ async def test_search_all_resources_async_pages(): next_page_token="abc", ), asset_service.SearchAllResourcesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllResourcesResponse( - results=[assets.StandardResourceMetadata(),], next_page_token="ghi", + results=[ + assets.StandardResourceMetadata(), + ], + next_page_token="ghi", ), asset_service.SearchAllResourcesResponse( results=[ @@ -1024,11 +1091,16 @@ async def test_search_all_resources_async_pages(): @pytest.mark.parametrize( - "request_type", [asset_service.SearchAllIamPoliciesRequest, dict,] + "request_type", + [ + asset_service.SearchAllIamPoliciesRequest, + dict, + ], ) def test_search_all_iam_policies(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1059,7 +1131,8 @@ def test_search_all_iam_policies_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1078,7 +1151,8 @@ async def test_search_all_iam_policies_async( request_type=asset_service.SearchAllIamPoliciesRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1113,7 +1187,9 @@ async def test_search_all_iam_policies_async_from_dict(): def test_search_all_iam_policies_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1135,12 +1211,17 @@ def test_search_all_iam_policies_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_search_all_iam_policies_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1164,11 +1245,16 @@ async def test_search_all_iam_policies_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "scope=scope/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "scope=scope/value", + ) in kw["metadata"] def test_search_all_iam_policies_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1179,7 +1265,8 @@ def test_search_all_iam_policies_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.search_all_iam_policies( - scope="scope_value", query="query_value", + scope="scope_value", + query="query_value", ) # Establish that the underlying call was made with the expected @@ -1195,7 +1282,9 @@ def test_search_all_iam_policies_flattened(): def test_search_all_iam_policies_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1209,7 +1298,9 @@ def test_search_all_iam_policies_flattened_error(): @pytest.mark.asyncio async def test_search_all_iam_policies_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1224,7 +1315,8 @@ async def test_search_all_iam_policies_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.search_all_iam_policies( - scope="scope_value", query="query_value", + scope="scope_value", + query="query_value", ) # Establish that the underlying call was made with the expected @@ -1241,7 +1333,9 @@ async def test_search_all_iam_policies_flattened_async(): @pytest.mark.asyncio async def test_search_all_iam_policies_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1255,7 +1349,8 @@ async def test_search_all_iam_policies_flattened_error_async(): def test_search_all_iam_policies_pager(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -1273,10 +1368,14 @@ def test_search_all_iam_policies_pager(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -1302,7 +1401,8 @@ def test_search_all_iam_policies_pager(transport_name: str = "grpc"): def test_search_all_iam_policies_pages(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -1320,10 +1420,14 @@ def test_search_all_iam_policies_pages(transport_name: str = "grpc"): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -1340,7 +1444,9 @@ def test_search_all_iam_policies_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_all_iam_policies_async_pager(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1359,10 +1465,14 @@ async def test_search_all_iam_policies_async_pager(): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -1372,7 +1482,9 @@ async def test_search_all_iam_policies_async_pager(): ), RuntimeError, ) - async_pager = await client.search_all_iam_policies(request={},) + async_pager = await client.search_all_iam_policies( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1384,7 +1496,9 @@ async def test_search_all_iam_policies_async_pager(): @pytest.mark.asyncio async def test_search_all_iam_policies_async_pages(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1403,10 +1517,14 @@ async def test_search_all_iam_policies_async_pages(): next_page_token="abc", ), asset_service.SearchAllIamPoliciesResponse( - results=[], next_page_token="def", + results=[], + next_page_token="def", ), asset_service.SearchAllIamPoliciesResponse( - results=[assets.IamPolicySearchResult(),], next_page_token="ghi", + results=[ + assets.IamPolicySearchResult(), + ], + next_page_token="ghi", ), asset_service.SearchAllIamPoliciesResponse( results=[ @@ -1430,7 +1548,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - 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. @@ -1450,7 +1569,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AssetServiceClient(client_options=options, transport=transport,) + client = AssetServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1466,7 +1588,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1511,8 +1634,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AssetServiceGrpcTransport,) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AssetServiceGrpcTransport, + ) def test_asset_service_base_transport_error(): @@ -1558,7 +1686,8 @@ def test_asset_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AssetServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1713,7 +1842,8 @@ def test_asset_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1725,7 +1855,8 @@ def test_asset_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1846,7 +1977,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AssetServiceClient.common_folder_path(folder) assert expected == actual @@ -1864,7 +1997,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AssetServiceClient.common_organization_path(organization) assert expected == actual @@ -1882,7 +2017,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AssetServiceClient.common_project_path(project) assert expected == actual @@ -1902,7 +2039,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AssetServiceClient.common_location_path(project, location) assert expected == actual @@ -1927,7 +2065,8 @@ def test_client_with_default_client_info(): transports.AssetServiceTransport, "_prep_wrapped_messages" ) as prep: client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1936,7 +2075,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AssetServiceClient.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) @@ -1944,7 +2084,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AssetServiceAsyncClient( - 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/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py index 9d92e6a55566..757059958c6b 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py @@ -81,7 +81,13 @@ def test__get_default_mtls_endpoint(): assert AssetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -121,7 +127,13 @@ def test_asset_service_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -476,7 +488,9 @@ def test_asset_service_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) @@ -614,10 +628,17 @@ def test_asset_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [asset_service.CreateFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.CreateFeedRequest, + dict, + ], +) def test_create_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -652,7 +673,8 @@ def test_create_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -668,7 +690,8 @@ async def test_create_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.CreateFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -707,7 +730,9 @@ async def test_create_feed_async_from_dict(): def test_create_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -727,12 +752,17 @@ def test_create_feed_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_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -752,11 +782,16 @@ async def test_create_feed_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_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_feed), "__call__") as call: @@ -764,7 +799,9 @@ def test_create_feed_flattened(): call.return_value = asset_service.Feed() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_feed(parent="parent_value",) + client.create_feed( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -776,19 +813,24 @@ def test_create_feed_flattened(): def test_create_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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.create_feed( - asset_service.CreateFeedRequest(), parent="parent_value", + asset_service.CreateFeedRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_create_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_feed), "__call__") as call: @@ -798,7 +840,9 @@ async def test_create_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_feed(parent="parent_value",) + response = await client.create_feed( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -811,20 +855,30 @@ async def test_create_feed_flattened_async(): @pytest.mark.asyncio async def test_create_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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.create_feed( - asset_service.CreateFeedRequest(), parent="parent_value", + asset_service.CreateFeedRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [asset_service.GetFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.GetFeedRequest, + dict, + ], +) def test_get_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -859,7 +913,8 @@ def test_get_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -875,7 +930,8 @@ async def test_get_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.GetFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -914,7 +970,9 @@ async def test_get_feed_async_from_dict(): def test_get_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -934,12 +992,17 @@ def test_get_feed_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_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -959,11 +1022,16 @@ async def test_get_feed_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_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_feed), "__call__") as call: @@ -971,7 +1039,9 @@ def test_get_feed_flattened(): call.return_value = asset_service.Feed() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_feed(name="name_value",) + client.get_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -983,19 +1053,24 @@ def test_get_feed_flattened(): def test_get_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_feed( - asset_service.GetFeedRequest(), name="name_value", + asset_service.GetFeedRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_feed), "__call__") as call: @@ -1005,7 +1080,9 @@ async def test_get_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_feed(name="name_value",) + response = await client.get_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1018,20 +1095,30 @@ async def test_get_feed_flattened_async(): @pytest.mark.asyncio async def test_get_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_feed( - asset_service.GetFeedRequest(), name="name_value", + asset_service.GetFeedRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [asset_service.ListFeedsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.ListFeedsRequest, + dict, + ], +) def test_list_feeds(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1057,7 +1144,8 @@ def test_list_feeds_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1073,7 +1161,8 @@ async def test_list_feeds_async( transport: str = "grpc_asyncio", request_type=asset_service.ListFeedsRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1103,7 +1192,9 @@ async def test_list_feeds_async_from_dict(): def test_list_feeds_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1123,12 +1214,17 @@ def test_list_feeds_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_feeds_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1150,11 +1246,16 @@ async def test_list_feeds_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_feeds_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_feeds), "__call__") as call: @@ -1162,7 +1263,9 @@ def test_list_feeds_flattened(): call.return_value = asset_service.ListFeedsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_feeds(parent="parent_value",) + client.list_feeds( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1174,19 +1277,24 @@ def test_list_feeds_flattened(): def test_list_feeds_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_feeds( - asset_service.ListFeedsRequest(), parent="parent_value", + asset_service.ListFeedsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_feeds_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_feeds), "__call__") as call: @@ -1198,7 +1306,9 @@ async def test_list_feeds_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_feeds(parent="parent_value",) + response = await client.list_feeds( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1211,20 +1321,30 @@ async def test_list_feeds_flattened_async(): @pytest.mark.asyncio async def test_list_feeds_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_feeds( - asset_service.ListFeedsRequest(), parent="parent_value", + asset_service.ListFeedsRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [asset_service.UpdateFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.UpdateFeedRequest, + dict, + ], +) def test_update_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1259,7 +1379,8 @@ def test_update_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1275,7 +1396,8 @@ async def test_update_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.UpdateFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1314,7 +1436,9 @@ async def test_update_feed_async_from_dict(): def test_update_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1334,12 +1458,17 @@ def test_update_feed_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "feed.name=feed.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "feed.name=feed.name/value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1359,11 +1488,16 @@ async def test_update_feed_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "feed.name=feed.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "feed.name=feed.name/value", + ) in kw["metadata"] def test_update_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_feed), "__call__") as call: @@ -1371,7 +1505,9 @@ def test_update_feed_flattened(): call.return_value = asset_service.Feed() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_feed(feed=asset_service.Feed(name="name_value"),) + client.update_feed( + feed=asset_service.Feed(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1383,7 +1519,9 @@ def test_update_feed_flattened(): def test_update_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1396,7 +1534,9 @@ def test_update_feed_flattened_error(): @pytest.mark.asyncio async def test_update_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_feed), "__call__") as call: @@ -1406,7 +1546,9 @@ async def test_update_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_feed(feed=asset_service.Feed(name="name_value"),) + response = await client.update_feed( + feed=asset_service.Feed(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1419,7 +1561,9 @@ async def test_update_feed_flattened_async(): @pytest.mark.asyncio async def test_update_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1430,10 +1574,17 @@ async def test_update_feed_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [asset_service.DeleteFeedRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.DeleteFeedRequest, + dict, + ], +) def test_delete_feed(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1459,7 +1610,8 @@ def test_delete_feed_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1475,7 +1627,8 @@ async def test_delete_feed_async( transport: str = "grpc_asyncio", request_type=asset_service.DeleteFeedRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1503,7 +1656,9 @@ async def test_delete_feed_async_from_dict(): def test_delete_feed_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -1523,12 +1678,17 @@ def test_delete_feed_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_feed_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -1548,11 +1708,16 @@ async def test_delete_feed_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_feed_flattened(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_feed), "__call__") as call: @@ -1560,7 +1725,9 @@ def test_delete_feed_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_feed(name="name_value",) + client.delete_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1572,19 +1739,24 @@ def test_delete_feed_flattened(): def test_delete_feed_flattened_error(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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_feed( - asset_service.DeleteFeedRequest(), name="name_value", + asset_service.DeleteFeedRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_feed_flattened_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_feed), "__call__") as call: @@ -1594,7 +1766,9 @@ async def test_delete_feed_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_feed(name="name_value",) + response = await client.delete_feed( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1607,13 +1781,16 @@ async def test_delete_feed_flattened_async(): @pytest.mark.asyncio async def test_delete_feed_flattened_error_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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_feed( - asset_service.DeleteFeedRequest(), name="name_value", + asset_service.DeleteFeedRequest(), + name="name_value", ) @@ -1624,7 +1801,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - 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 +1822,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AssetServiceClient(client_options=options, transport=transport,) + client = AssetServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1660,7 +1841,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1705,8 +1887,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AssetServiceGrpcTransport,) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AssetServiceGrpcTransport, + ) def test_asset_service_base_transport_error(): @@ -1755,7 +1942,8 @@ def test_asset_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AssetServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1910,7 +2098,8 @@ def test_asset_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1922,7 +2111,8 @@ def test_asset_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2024,7 +2214,10 @@ def test_asset_service_transport_channel_mtls_with_adc(transport_class): def test_feed_path(): project = "squid" feed = "clam" - expected = "projects/{project}/feeds/{feed}".format(project=project, feed=feed,) + expected = "projects/{project}/feeds/{feed}".format( + project=project, + feed=feed, + ) actual = AssetServiceClient.feed_path(project, feed) assert expected == actual @@ -2063,7 +2256,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AssetServiceClient.common_folder_path(folder) assert expected == actual @@ -2081,7 +2276,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AssetServiceClient.common_organization_path(organization) assert expected == actual @@ -2099,7 +2296,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AssetServiceClient.common_project_path(project) assert expected == actual @@ -2119,7 +2318,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AssetServiceClient.common_location_path(project, location) assert expected == actual @@ -2144,7 +2344,8 @@ def test_client_with_default_client_info(): transports.AssetServiceTransport, "_prep_wrapped_messages" ) as prep: client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2153,7 +2354,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AssetServiceClient.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) @@ -2161,7 +2363,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AssetServiceAsyncClient( - 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/packages/google-cloud-asset/tests/unit/gapic/asset_v1p4beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p4beta1/test_asset_service.py index 9ba521be9337..26da5c9fdd47 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p4beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p4beta1/test_asset_service.py @@ -87,7 +87,13 @@ def test__get_default_mtls_endpoint(): assert AssetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -127,7 +133,13 @@ def test_asset_service_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -482,7 +494,9 @@ def test_asset_service_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) @@ -620,10 +634,17 @@ def test_asset_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [asset_service.AnalyzeIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeIamPolicyRequest, + dict, + ], +) def test_analyze_iam_policy(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -635,7 +656,9 @@ def test_analyze_iam_policy(request_type, transport: str = "grpc"): type(client.transport.analyze_iam_policy), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = asset_service.AnalyzeIamPolicyResponse(fully_explored=True,) + call.return_value = asset_service.AnalyzeIamPolicyResponse( + fully_explored=True, + ) response = client.analyze_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -652,7 +675,8 @@ def test_analyze_iam_policy_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -670,7 +694,8 @@ async def test_analyze_iam_policy_async( transport: str = "grpc_asyncio", request_type=asset_service.AnalyzeIamPolicyRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -683,7 +708,9 @@ async def test_analyze_iam_policy_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - asset_service.AnalyzeIamPolicyResponse(fully_explored=True,) + asset_service.AnalyzeIamPolicyResponse( + fully_explored=True, + ) ) response = await client.analyze_iam_policy(request) @@ -703,7 +730,9 @@ async def test_analyze_iam_policy_async_from_dict(): def test_analyze_iam_policy_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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,7 +762,9 @@ def test_analyze_iam_policy_field_headers(): @pytest.mark.asyncio async def test_analyze_iam_policy_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -764,11 +795,16 @@ async def test_analyze_iam_policy_field_headers_async(): @pytest.mark.parametrize( - "request_type", [asset_service.ExportIamPolicyAnalysisRequest, dict,] + "request_type", + [ + asset_service.ExportIamPolicyAnalysisRequest, + dict, + ], ) def test_export_iam_policy_analysis(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -796,7 +832,8 @@ def test_export_iam_policy_analysis_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -815,7 +852,8 @@ async def test_export_iam_policy_analysis_async( request_type=asset_service.ExportIamPolicyAnalysisRequest, ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -847,7 +885,9 @@ async def test_export_iam_policy_analysis_async_from_dict(): def test_export_iam_policy_analysis_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -877,7 +917,9 @@ def test_export_iam_policy_analysis_field_headers(): @pytest.mark.asyncio async def test_export_iam_policy_analysis_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -914,7 +956,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - 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. @@ -934,7 +977,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AssetServiceClient(client_options=options, transport=transport,) + client = AssetServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -950,7 +996,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -995,8 +1042,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AssetServiceGrpcTransport,) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AssetServiceGrpcTransport, + ) def test_asset_service_base_transport_error(): @@ -1047,7 +1099,8 @@ def test_asset_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AssetServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1202,7 +1255,8 @@ def test_asset_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1214,7 +1268,8 @@ def test_asset_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1315,12 +1370,16 @@ def test_asset_service_transport_channel_mtls_with_adc(transport_class): def test_asset_service_grpc_lro_client(): client = AssetServiceClient( - 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 @@ -1328,12 +1387,16 @@ def test_asset_service_grpc_lro_client(): def test_asset_service_grpc_lro_async_client(): client = AssetServiceAsyncClient( - 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 @@ -1361,7 +1424,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AssetServiceClient.common_folder_path(folder) assert expected == actual @@ -1379,7 +1444,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AssetServiceClient.common_organization_path(organization) assert expected == actual @@ -1397,7 +1464,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AssetServiceClient.common_project_path(project) assert expected == actual @@ -1417,7 +1486,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AssetServiceClient.common_location_path(project, location) assert expected == actual @@ -1442,7 +1512,8 @@ def test_client_with_default_client_info(): transports.AssetServiceTransport, "_prep_wrapped_messages" ) as prep: client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1451,7 +1522,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AssetServiceClient.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) @@ -1459,7 +1531,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AssetServiceAsyncClient( - 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/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py index ef94c5ce98d4..a5913029fefa 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py @@ -83,7 +83,13 @@ def test__get_default_mtls_endpoint(): assert AssetServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -123,7 +129,13 @@ def test_asset_service_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AssetServiceClient, AssetServiceAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + AssetServiceClient, + AssetServiceAsyncClient, + ], +) def test_asset_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -478,7 +490,9 @@ def test_asset_service_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) @@ -616,10 +630,17 @@ def test_asset_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [asset_service.ListAssetsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + asset_service.ListAssetsRequest, + dict, + ], +) def test_list_assets(request_type, transport: str = "grpc"): client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -648,7 +669,8 @@ def test_list_assets_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 = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -664,7 +686,8 @@ async def test_list_assets_async( transport: str = "grpc_asyncio", request_type=asset_service.ListAssetsRequest ): client = AssetServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -675,7 +698,9 @@ async def test_list_assets_async( with mock.patch.object(type(client.transport.list_assets), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - asset_service.ListAssetsResponse(next_page_token="next_page_token_value",) + asset_service.ListAssetsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_assets(request) @@ -695,7 +720,9 @@ async def test_list_assets_async_from_dict(): def test_list_assets_field_headers(): - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceClient( + 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. @@ -715,12 +742,17 @@ def test_list_assets_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_assets_field_headers_async(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AssetServiceAsyncClient( + 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. @@ -742,12 +774,16 @@ async def test_list_assets_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_assets_pager(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -755,14 +791,29 @@ def test_list_assets_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) @@ -781,7 +832,8 @@ def test_list_assets_pager(transport_name: str = "grpc"): def test_list_assets_pages(transport_name: str = "grpc"): client = AssetServiceClient( - 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. @@ -789,14 +841,29 @@ def test_list_assets_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) pages = list(client.list_assets(request={}).pages) @@ -806,7 +873,9 @@ def test_list_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_assets_async_pager(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -815,17 +884,34 @@ async def test_list_assets_async_pager(): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) - async_pager = await client.list_assets(request={},) + async_pager = await client.list_assets( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -837,7 +923,9 @@ async def test_list_assets_async_pager(): @pytest.mark.asyncio async def test_list_assets_async_pages(): - client = AssetServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -846,14 +934,29 @@ async def test_list_assets_async_pages(): # Set the response to a series of pages. call.side_effect = ( asset_service.ListAssetsResponse( - assets=[assets.Asset(), assets.Asset(), assets.Asset(),], + assets=[ + assets.Asset(), + assets.Asset(), + assets.Asset(), + ], next_page_token="abc", ), - asset_service.ListAssetsResponse(assets=[], next_page_token="def",), asset_service.ListAssetsResponse( - assets=[assets.Asset(),], next_page_token="ghi", + assets=[], + next_page_token="def", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + ], + next_page_token="ghi", + ), + asset_service.ListAssetsResponse( + assets=[ + assets.Asset(), + assets.Asset(), + ], ), - asset_service.ListAssetsResponse(assets=[assets.Asset(), assets.Asset(),],), RuntimeError, ) pages = [] @@ -870,7 +973,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - 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. @@ -890,7 +994,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AssetServiceClient(client_options=options, transport=transport,) + client = AssetServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -906,7 +1013,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AssetServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -951,8 +1059,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AssetServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AssetServiceGrpcTransport,) + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AssetServiceGrpcTransport, + ) def test_asset_service_base_transport_error(): @@ -995,7 +1108,8 @@ def test_asset_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AssetServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1150,7 +1264,8 @@ def test_asset_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1162,7 +1277,8 @@ def test_asset_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AssetServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1265,7 +1381,8 @@ def test_access_level_path(): access_policy = "squid" access_level = "clam" expected = "accessPolicies/{access_policy}/accessLevels/{access_level}".format( - access_policy=access_policy, access_level=access_level, + access_policy=access_policy, + access_level=access_level, ) actual = AssetServiceClient.access_level_path(access_policy, access_level) assert expected == actual @@ -1285,7 +1402,9 @@ def test_parse_access_level_path(): def test_access_policy_path(): access_policy = "oyster" - expected = "accessPolicies/{access_policy}".format(access_policy=access_policy,) + expected = "accessPolicies/{access_policy}".format( + access_policy=access_policy, + ) actual = AssetServiceClient.access_policy_path(access_policy) assert expected == actual @@ -1310,8 +1429,11 @@ def test_asset_path(): def test_service_perimeter_path(): access_policy = "cuttlefish" service_perimeter = "mussel" - expected = "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format( - access_policy=access_policy, service_perimeter=service_perimeter, + expected = ( + "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format( + access_policy=access_policy, + service_perimeter=service_perimeter, + ) ) actual = AssetServiceClient.service_perimeter_path(access_policy, service_perimeter) assert expected == actual @@ -1351,7 +1473,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AssetServiceClient.common_folder_path(folder) assert expected == actual @@ -1369,7 +1493,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AssetServiceClient.common_organization_path(organization) assert expected == actual @@ -1387,7 +1513,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AssetServiceClient.common_project_path(project) assert expected == actual @@ -1407,7 +1535,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AssetServiceClient.common_location_path(project, location) assert expected == actual @@ -1432,7 +1561,8 @@ def test_client_with_default_client_info(): transports.AssetServiceTransport, "_prep_wrapped_messages" ) as prep: client = AssetServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1441,7 +1571,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AssetServiceClient.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) @@ -1449,7 +1580,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AssetServiceAsyncClient( - 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"