From d85d3419857af6e21f8526d31b83bf0873c82a68 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 00:06:13 +0000 Subject: [PATCH 01/17] chore(python): use black==22.3.0 (#134) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 5 +- .../services/catalog_service/async_client.py | 45 +- .../services/catalog_service/client.py | 96 +++- .../catalog_service/transports/base.py | 6 +- .../catalog_service/transports/grpc.py | 3 +- .../async_client.py | 30 +- .../prediction_api_key_registry/client.py | 68 ++- .../prediction_api_key_registry/pagers.py | 12 +- .../transports/base.py | 6 +- .../transports/grpc.py | 3 +- .../prediction_service/async_client.py | 12 +- .../services/prediction_service/client.py | 57 ++- .../prediction_service/transports/base.py | 6 +- .../prediction_service/transports/grpc.py | 3 +- .../user_event_service/async_client.py | 40 +- .../services/user_event_service/client.py | 86 +++- .../user_event_service/transports/base.py | 6 +- .../user_event_service/transports/grpc.py | 3 +- .../types/catalog.py | 131 ++++-- .../types/catalog_service.py | 65 ++- .../types/common.py | 25 +- .../types/import_.py | 144 ++++-- .../prediction_apikey_registry_service.py | 43 +- .../types/prediction_service.py | 88 +++- .../types/recommendationengine_resources.py | 3 +- .../types/user_event.py | 183 ++++++-- .../types/user_event_service.py | 95 +++- noxfile.py | 9 +- .../test_catalog_service.py | 425 +++++++++++++----- .../test_prediction_api_key_registry.py | 157 +++++-- .../test_prediction_service.py | 154 +++++-- .../test_user_event_service.py | 361 +++++++++++---- 33 files changed, 1827 insertions(+), 545 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7c..87dd0061 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/docs/conf.py b/docs/conf.py index 626ef613..77cfe26e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py index a7f67de8..59d873df 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py @@ -320,7 +320,12 @@ def sample_create_catalog_item(): ) # 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 @@ -420,7 +425,12 @@ def sample_get_catalog_item(): ) # 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 @@ -534,12 +544,20 @@ def sample_list_catalog_items(): ) # 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.ListCatalogItemsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -669,7 +687,12 @@ def sample_update_catalog_item(): ) # 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 @@ -761,7 +784,10 @@ def sample_delete_catalog_item(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def import_catalog_items( @@ -909,7 +935,12 @@ def sample_import_catalog_items(): ) # 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( diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py index 3980674e..3a34132e 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py @@ -61,7 +61,10 @@ class CatalogServiceClientMeta(type): _transport_registry["grpc"] = CatalogServiceGrpcTransport _transport_registry["grpc_asyncio"] = CatalogServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[CatalogServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[CatalogServiceTransport]: """Returns an appropriate transport class. Args: @@ -168,10 +171,16 @@ def transport(self) -> CatalogServiceTransport: return self._transport @staticmethod - def catalog_path(project: str, location: str, catalog: str,) -> str: + def catalog_path( + project: str, + location: str, + catalog: str, + ) -> str: """Returns a fully-qualified catalog string.""" return "projects/{project}/locations/{location}/catalogs/{catalog}".format( - project=project, location=location, catalog=catalog, + project=project, + location=location, + catalog=catalog, ) @staticmethod @@ -184,7 +193,9 @@ def parse_catalog_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, @@ -197,9 +208,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]: @@ -208,9 +223,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]: @@ -219,9 +238,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]: @@ -230,10 +253,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 @@ -506,7 +533,12 @@ def sample_create_catalog_item(): ) # 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 @@ -596,7 +628,12 @@ def sample_get_catalog_item(): ) # 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 @@ -700,12 +737,20 @@ def sample_list_catalog_items(): ) # 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.ListCatalogItemsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -825,7 +870,12 @@ def sample_update_catalog_item(): ) # 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 @@ -907,7 +957,10 @@ def sample_delete_catalog_item(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def import_catalog_items( @@ -1045,7 +1098,12 @@ def sample_import_catalog_items(): ) # 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( diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py index 65f1bd79..6cb7f104 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py @@ -220,9 +220,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/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py index e356ef61..293d8ae1 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py @@ -231,8 +231,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py index b4aeee73..1b6fca61 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py @@ -333,7 +333,12 @@ def sample_create_prediction_api_key_registration(): ) # 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 @@ -410,8 +415,10 @@ def sample_list_prediction_api_key_registrations(): "the individual field arguments should be set." ) - request = prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( - request + request = ( + prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( + request + ) ) # If we have keyword arguments corresponding to fields on the @@ -444,12 +451,20 @@ def sample_list_prediction_api_key_registrations(): ) # 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.ListPredictionApiKeyRegistrationsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -548,7 +563,10 @@ def sample_delete_prediction_api_key_registration(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py index 8b457520..e243aada 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py @@ -60,7 +60,8 @@ class PredictionApiKeyRegistryClientMeta(type): _transport_registry["grpc_asyncio"] = PredictionApiKeyRegistryGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[PredictionApiKeyRegistryTransport]: """Returns an appropriate transport class. @@ -173,7 +174,10 @@ def transport(self) -> PredictionApiKeyRegistryTransport: @staticmethod def event_store_path( - project: str, location: str, catalog: str, event_store: str, + project: str, + location: str, + catalog: str, + event_store: str, ) -> str: """Returns a fully-qualified event_store string.""" return "projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}".format( @@ -219,7 +223,9 @@ def parse_prediction_api_key_registration_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, @@ -232,9 +238,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]: @@ -243,9 +253,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]: @@ -254,9 +268,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]: @@ -265,10 +283,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 @@ -547,7 +569,12 @@ def sample_create_prediction_api_key_registration(): ) # 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 @@ -653,12 +680,20 @@ def sample_list_prediction_api_key_registrations(): ) # 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.ListPredictionApiKeyRegistrationsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -752,7 +787,10 @@ def sample_delete_prediction_api_key_registration(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/pagers.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/pagers.py index c658450f..5de5ab50 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/pagers.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/pagers.py @@ -71,8 +71,10 @@ def __init__( sent along with the request as metadata. """ self._method = method - self._request = prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( - request + self._request = ( + prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( + request + ) ) self._response = response self._metadata = metadata @@ -146,8 +148,10 @@ def __init__( sent along with the request as metadata. """ self._method = method - self._request = prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( - request + self._request = ( + prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( + request + ) ) self._response = response self._metadata = metadata diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py index 24b6a10f..86b479e2 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py @@ -173,9 +173,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/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py index 8ae1d305..cbbb93b5 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py @@ -232,8 +232,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py index 07a39569..f8aaf971 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py @@ -360,12 +360,20 @@ def sample_predict(): ) # 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.PredictAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py index bb41a348..c5cd4de8 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py @@ -57,7 +57,8 @@ class PredictionServiceClientMeta(type): _transport_registry["grpc_asyncio"] = PredictionServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[PredictionServiceTransport]: """Returns an appropriate transport class. @@ -164,7 +165,11 @@ def transport(self) -> PredictionServiceTransport: @staticmethod def placement_path( - project: str, location: str, catalog: str, event_store: str, placement: str, + project: str, + location: str, + catalog: str, + event_store: str, + placement: str, ) -> str: """Returns a fully-qualified placement string.""" return "projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}/placements/{placement}".format( @@ -185,7 +190,9 @@ def parse_placement_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, @@ -198,9 +205,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]: @@ -209,9 +220,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]: @@ -220,9 +235,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]: @@ -231,10 +250,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 @@ -555,12 +578,20 @@ def sample_predict(): ) # 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.PredictPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py index 6eb54c95..706a47e5 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py @@ -140,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/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py index e4db259c..4f5a23c1 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_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/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py index 55dbfa7f..5b0aff44 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py @@ -322,7 +322,12 @@ def sample_write_user_event(): ) # 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 @@ -512,7 +517,12 @@ def sample_collect_user_event(): ) # 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 @@ -662,12 +672,20 @@ def sample_list_user_events(): ) # 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.ListUserEventsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -822,7 +840,12 @@ def sample_purge_user_events(): ) # 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( @@ -981,7 +1004,12 @@ def sample_import_user_events(): ) # 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( diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py index 4cb8a18f..f8938356 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py @@ -63,7 +63,10 @@ class UserEventServiceClientMeta(type): _transport_registry["grpc"] = UserEventServiceGrpcTransport _transport_registry["grpc_asyncio"] = UserEventServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[UserEventServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[UserEventServiceTransport]: """Returns an appropriate transport class. Args: @@ -171,7 +174,10 @@ def transport(self) -> UserEventServiceTransport: @staticmethod def event_store_path( - project: str, location: str, catalog: str, event_store: str, + project: str, + location: str, + catalog: str, + event_store: str, ) -> str: """Returns a fully-qualified event_store string.""" return "projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}".format( @@ -191,7 +197,9 @@ def parse_event_store_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, @@ -204,9 +212,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]: @@ -215,9 +227,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]: @@ -226,9 +242,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]: @@ -237,10 +257,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 @@ -514,7 +538,12 @@ def sample_write_user_event(): ) # 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 @@ -694,7 +723,12 @@ def sample_collect_user_event(): ) # 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 @@ -834,12 +868,20 @@ def sample_list_user_events(): ) # 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.ListUserEventsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -984,7 +1026,12 @@ def sample_purge_user_events(): ) # 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( @@ -1133,7 +1180,12 @@ def sample_import_user_events(): ) # 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( diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py index ccfb7cac..2a852ce2 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py @@ -205,9 +205,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/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py index a55c231c..171b60fe 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py @@ -231,8 +231,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/recommendationengine_v1beta1/types/catalog.py b/google/cloud/recommendationengine_v1beta1/types/catalog.py index c4fa5f31..289eaf9f 100644 --- a/google/cloud/recommendationengine_v1beta1/types/catalog.py +++ b/google/cloud/recommendationengine_v1beta1/types/catalog.py @@ -20,7 +20,11 @@ __protobuf__ = proto.module( package="google.cloud.recommendationengine.v1beta1", - manifest={"CatalogItem", "ProductCatalogItem", "Image",}, + manifest={ + "CatalogItem", + "ProductCatalogItem", + "Image", + }, ) @@ -107,18 +111,45 @@ class CategoryHierarchy(proto.Message): specificity (from least to most specific). """ - categories = proto.RepeatedField(proto.STRING, number=1,) + categories = proto.RepeatedField( + proto.STRING, + number=1, + ) - id = proto.Field(proto.STRING, number=1,) + id = proto.Field( + proto.STRING, + number=1, + ) category_hierarchies = proto.RepeatedField( - proto.MESSAGE, number=2, message=CategoryHierarchy, - ) - title = proto.Field(proto.STRING, number=3,) - description = proto.Field(proto.STRING, number=4,) - item_attributes = proto.Field(proto.MESSAGE, number=5, message=common.FeatureMap,) - language_code = proto.Field(proto.STRING, number=6,) - tags = proto.RepeatedField(proto.STRING, number=8,) - item_group_id = proto.Field(proto.STRING, number=9,) + proto.MESSAGE, + number=2, + message=CategoryHierarchy, + ) + title = proto.Field( + proto.STRING, + number=3, + ) + description = proto.Field( + proto.STRING, + number=4, + ) + item_attributes = proto.Field( + proto.MESSAGE, + number=5, + message=common.FeatureMap, + ) + language_code = proto.Field( + proto.STRING, + number=6, + ) + tags = proto.RepeatedField( + proto.STRING, + number=8, + ) + item_group_id = proto.Field( + proto.STRING, + number=9, + ) product_metadata = proto.Field( proto.MESSAGE, number=10, @@ -199,8 +230,14 @@ class ExactPrice(proto.Message): 'displayPrice'. """ - display_price = proto.Field(proto.FLOAT, number=1,) - original_price = proto.Field(proto.FLOAT, number=2,) + display_price = proto.Field( + proto.FLOAT, + number=1, + ) + original_price = proto.Field( + proto.FLOAT, + number=2, + ) class PriceRange(proto.Message): r"""Product price range when there are a range of prices for @@ -213,21 +250,54 @@ class PriceRange(proto.Message): Required. The maximum product price. """ - min_ = proto.Field(proto.FLOAT, number=1,) - max_ = proto.Field(proto.FLOAT, number=2,) + min_ = proto.Field( + proto.FLOAT, + number=1, + ) + max_ = proto.Field( + proto.FLOAT, + number=2, + ) exact_price = proto.Field( - proto.MESSAGE, number=1, oneof="price", message=ExactPrice, + proto.MESSAGE, + number=1, + oneof="price", + message=ExactPrice, ) price_range = proto.Field( - proto.MESSAGE, number=2, oneof="price", message=PriceRange, + proto.MESSAGE, + number=2, + oneof="price", + message=PriceRange, + ) + costs = proto.MapField( + proto.STRING, + proto.FLOAT, + number=3, + ) + currency_code = proto.Field( + proto.STRING, + number=4, + ) + stock_state = proto.Field( + proto.ENUM, + number=5, + enum=StockState, + ) + available_quantity = proto.Field( + proto.INT64, + number=6, + ) + canonical_product_uri = proto.Field( + proto.STRING, + number=7, + ) + images = proto.RepeatedField( + proto.MESSAGE, + number=8, + message="Image", ) - costs = proto.MapField(proto.STRING, proto.FLOAT, number=3,) - currency_code = proto.Field(proto.STRING, number=4,) - stock_state = proto.Field(proto.ENUM, number=5, enum=StockState,) - available_quantity = proto.Field(proto.INT64, number=6,) - canonical_product_uri = proto.Field(proto.STRING, number=7,) - images = proto.RepeatedField(proto.MESSAGE, number=8, message="Image",) class Image(proto.Message): @@ -245,9 +315,18 @@ class Image(proto.Message): pixels. """ - uri = proto.Field(proto.STRING, number=1,) - height = proto.Field(proto.INT32, number=2,) - width = proto.Field(proto.INT32, number=3,) + uri = proto.Field( + proto.STRING, + number=1, + ) + height = proto.Field( + proto.INT32, + number=2, + ) + width = proto.Field( + proto.INT32, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/recommendationengine_v1beta1/types/catalog_service.py b/google/cloud/recommendationengine_v1beta1/types/catalog_service.py index 96b734d4..76ed466a 100644 --- a/google/cloud/recommendationengine_v1beta1/types/catalog_service.py +++ b/google/cloud/recommendationengine_v1beta1/types/catalog_service.py @@ -43,8 +43,15 @@ class CreateCatalogItemRequest(proto.Message): Required. The catalog item to create. """ - parent = proto.Field(proto.STRING, number=1,) - catalog_item = proto.Field(proto.MESSAGE, number=2, message=catalog.CatalogItem,) + parent = proto.Field( + proto.STRING, + number=1, + ) + catalog_item = proto.Field( + proto.MESSAGE, + number=2, + message=catalog.CatalogItem, + ) class GetCatalogItemRequest(proto.Message): @@ -56,7 +63,10 @@ class GetCatalogItemRequest(proto.Message): ``projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListCatalogItemsRequest(proto.Message): @@ -78,10 +88,22 @@ class ListCatalogItemsRequest(proto.Message): results. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) class ListCatalogItemsResponse(proto.Message): @@ -101,9 +123,14 @@ def raw_page(self): return self catalog_items = proto.RepeatedField( - proto.MESSAGE, number=1, message=catalog.CatalogItem, + proto.MESSAGE, + number=1, + message=catalog.CatalogItem, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class UpdateCatalogItemRequest(proto.Message): @@ -122,10 +149,19 @@ class UpdateCatalogItemRequest(proto.Message): default update all fields. """ - name = proto.Field(proto.STRING, number=1,) - catalog_item = proto.Field(proto.MESSAGE, number=2, message=catalog.CatalogItem,) + name = proto.Field( + proto.STRING, + number=1, + ) + catalog_item = proto.Field( + proto.MESSAGE, + number=2, + message=catalog.CatalogItem, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -138,7 +174,10 @@ class DeleteCatalogItemRequest(proto.Message): ``projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/recommendationengine_v1beta1/types/common.py b/google/cloud/recommendationengine_v1beta1/types/common.py index 1f43577c..cb040da9 100644 --- a/google/cloud/recommendationengine_v1beta1/types/common.py +++ b/google/cloud/recommendationengine_v1beta1/types/common.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.recommendationengine.v1beta1", manifest={"FeatureMap",}, + package="google.cloud.recommendationengine.v1beta1", + manifest={ + "FeatureMap", + }, ) @@ -55,7 +58,10 @@ class StringList(proto.Message): 128 bytes. """ - value = proto.RepeatedField(proto.STRING, number=1,) + value = proto.RepeatedField( + proto.STRING, + number=1, + ) class FloatList(proto.Message): r"""A list of float features. @@ -65,13 +71,22 @@ class FloatList(proto.Message): Float feature value. """ - value = proto.RepeatedField(proto.FLOAT, number=1,) + value = proto.RepeatedField( + proto.FLOAT, + number=1, + ) categorical_features = proto.MapField( - proto.STRING, proto.MESSAGE, number=1, message=StringList, + proto.STRING, + proto.MESSAGE, + number=1, + message=StringList, ) numerical_features = proto.MapField( - proto.STRING, proto.MESSAGE, number=2, message=FloatList, + proto.STRING, + proto.MESSAGE, + number=2, + message=FloatList, ) diff --git a/google/cloud/recommendationengine_v1beta1/types/import_.py b/google/cloud/recommendationengine_v1beta1/types/import_.py index e0d798d9..c238c75c 100644 --- a/google/cloud/recommendationengine_v1beta1/types/import_.py +++ b/google/cloud/recommendationengine_v1beta1/types/import_.py @@ -56,7 +56,10 @@ class GcsSource(proto.Message): the expected file format and setup instructions. """ - input_uris = proto.RepeatedField(proto.STRING, number=1,) + input_uris = proto.RepeatedField( + proto.STRING, + number=1, + ) class CatalogInlineSource(proto.Message): @@ -70,7 +73,9 @@ class CatalogInlineSource(proto.Message): """ catalog_items = proto.RepeatedField( - proto.MESSAGE, number=1, message=catalog.CatalogItem, + proto.MESSAGE, + number=1, + message=catalog.CatalogItem, ) @@ -85,7 +90,9 @@ class UserEventInlineSource(proto.Message): """ user_events = proto.RepeatedField( - proto.MESSAGE, number=1, message=user_event.UserEvent, + proto.MESSAGE, + number=1, + message=user_event.UserEvent, ) @@ -104,7 +111,11 @@ class ImportErrorsConfig(proto.Message): This field is a member of `oneof`_ ``destination``. """ - gcs_prefix = proto.Field(proto.STRING, number=1, oneof="destination",) + gcs_prefix = proto.Field( + proto.STRING, + number=1, + oneof="destination", + ) class ImportCatalogItemsRequest(proto.Message): @@ -130,10 +141,24 @@ class ImportCatalogItemsRequest(proto.Message): incurred during the Import. """ - parent = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) - input_config = proto.Field(proto.MESSAGE, number=3, message="InputConfig",) - errors_config = proto.Field(proto.MESSAGE, number=4, message="ImportErrorsConfig",) + parent = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) + input_config = proto.Field( + proto.MESSAGE, + number=3, + message="InputConfig", + ) + errors_config = proto.Field( + proto.MESSAGE, + number=4, + message="ImportErrorsConfig", + ) class ImportUserEventsRequest(proto.Message): @@ -159,10 +184,24 @@ class ImportUserEventsRequest(proto.Message): incurred during the Import. """ - parent = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) - input_config = proto.Field(proto.MESSAGE, number=3, message="InputConfig",) - errors_config = proto.Field(proto.MESSAGE, number=4, message="ImportErrorsConfig",) + parent = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) + input_config = proto.Field( + proto.MESSAGE, + number=3, + message="InputConfig", + ) + errors_config = proto.Field( + proto.MESSAGE, + number=4, + message="ImportErrorsConfig", + ) class InputConfig(proto.Message): @@ -194,13 +233,22 @@ class InputConfig(proto.Message): """ catalog_inline_source = proto.Field( - proto.MESSAGE, number=1, oneof="source", message="CatalogInlineSource", + proto.MESSAGE, + number=1, + oneof="source", + message="CatalogInlineSource", ) gcs_source = proto.Field( - proto.MESSAGE, number=2, oneof="source", message="GcsSource", + proto.MESSAGE, + number=2, + oneof="source", + message="GcsSource", ) user_event_inline_source = proto.Field( - proto.MESSAGE, number=3, oneof="source", message="UserEventInlineSource", + proto.MESSAGE, + number=3, + oneof="source", + message="UserEventInlineSource", ) @@ -229,12 +277,32 @@ class ImportMetadata(proto.Message): is done, this is also the finish time. """ - operation_name = proto.Field(proto.STRING, number=5,) - request_id = proto.Field(proto.STRING, number=3,) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - success_count = proto.Field(proto.INT64, number=1,) - failure_count = proto.Field(proto.INT64, number=2,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + operation_name = proto.Field( + proto.STRING, + number=5, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + success_count = proto.Field( + proto.INT64, + number=1, + ) + failure_count = proto.Field( + proto.INT64, + number=2, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) class ImportCatalogItemsResponse(proto.Message): @@ -253,9 +321,15 @@ class ImportCatalogItemsResponse(proto.Message): """ error_samples = proto.RepeatedField( - proto.MESSAGE, number=1, message=status_pb2.Status, + proto.MESSAGE, + number=1, + message=status_pb2.Status, + ) + errors_config = proto.Field( + proto.MESSAGE, + number=2, + message="ImportErrorsConfig", ) - errors_config = proto.Field(proto.MESSAGE, number=2, message="ImportErrorsConfig",) class ImportUserEventsResponse(proto.Message): @@ -277,11 +351,19 @@ class ImportUserEventsResponse(proto.Message): """ error_samples = proto.RepeatedField( - proto.MESSAGE, number=1, message=status_pb2.Status, + proto.MESSAGE, + number=1, + message=status_pb2.Status, + ) + errors_config = proto.Field( + proto.MESSAGE, + number=2, + message="ImportErrorsConfig", ) - errors_config = proto.Field(proto.MESSAGE, number=2, message="ImportErrorsConfig",) import_summary = proto.Field( - proto.MESSAGE, number=3, message="UserEventImportSummary", + proto.MESSAGE, + number=3, + message="UserEventImportSummary", ) @@ -299,8 +381,14 @@ class UserEventImportSummary(proto.Message): catalog. """ - joined_events_count = proto.Field(proto.INT64, number=1,) - unjoined_events_count = proto.Field(proto.INT64, number=2,) + joined_events_count = proto.Field( + proto.INT64, + number=1, + ) + unjoined_events_count = proto.Field( + proto.INT64, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/recommendationengine_v1beta1/types/prediction_apikey_registry_service.py b/google/cloud/recommendationengine_v1beta1/types/prediction_apikey_registry_service.py index 003edc71..037e784a 100644 --- a/google/cloud/recommendationengine_v1beta1/types/prediction_apikey_registry_service.py +++ b/google/cloud/recommendationengine_v1beta1/types/prediction_apikey_registry_service.py @@ -36,7 +36,10 @@ class PredictionApiKeyRegistration(proto.Message): The API key. """ - api_key = proto.Field(proto.STRING, number=1,) + api_key = proto.Field( + proto.STRING, + number=1, + ) class CreatePredictionApiKeyRegistrationRequest(proto.Message): @@ -52,9 +55,14 @@ class CreatePredictionApiKeyRegistrationRequest(proto.Message): registration. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) prediction_api_key_registration = proto.Field( - proto.MESSAGE, number=2, message="PredictionApiKeyRegistration", + proto.MESSAGE, + number=2, + message="PredictionApiKeyRegistration", ) @@ -74,9 +82,18 @@ class ListPredictionApiKeyRegistrationsRequest(proto.Message): ``ListPredictionApiKeyRegistration.nextPageToken``. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListPredictionApiKeyRegistrationsResponse(proto.Message): @@ -96,9 +113,14 @@ def raw_page(self): return self prediction_api_key_registrations = proto.RepeatedField( - proto.MESSAGE, number=1, message="PredictionApiKeyRegistration", + proto.MESSAGE, + number=1, + message="PredictionApiKeyRegistration", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeletePredictionApiKeyRegistrationRequest(proto.Message): @@ -111,7 +133,10 @@ class DeletePredictionApiKeyRegistrationRequest(proto.Message): ``projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/recommendationengine_v1beta1/types/prediction_service.py b/google/cloud/recommendationengine_v1beta1/types/prediction_service.py index ae51ef75..4633555d 100644 --- a/google/cloud/recommendationengine_v1beta1/types/prediction_service.py +++ b/google/cloud/recommendationengine_v1beta1/types/prediction_service.py @@ -21,7 +21,10 @@ __protobuf__ = proto.module( package="google.cloud.recommendationengine.v1beta1", - manifest={"PredictRequest", "PredictResponse",}, + manifest={ + "PredictRequest", + "PredictResponse", + }, ) @@ -138,16 +141,42 @@ class PredictRequest(proto.Message): examples of labels. """ - name = proto.Field(proto.STRING, number=1,) - user_event = proto.Field(proto.MESSAGE, number=2, message=gcr_user_event.UserEvent,) - page_size = proto.Field(proto.INT32, number=7,) - page_token = proto.Field(proto.STRING, number=8,) - filter = proto.Field(proto.STRING, number=3,) - dry_run = proto.Field(proto.BOOL, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + user_event = proto.Field( + proto.MESSAGE, + number=2, + message=gcr_user_event.UserEvent, + ) + page_size = proto.Field( + proto.INT32, + number=7, + ) + page_token = proto.Field( + proto.STRING, + number=8, + ) + filter = proto.Field( + proto.STRING, + number=3, + ) + dry_run = proto.Field( + proto.BOOL, + number=4, + ) params = proto.MapField( - proto.STRING, proto.MESSAGE, number=6, message=struct_pb2.Value, + proto.STRING, + proto.MESSAGE, + number=6, + message=struct_pb2.Value, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=9, ) - labels = proto.MapField(proto.STRING, proto.STRING, number=9,) class PredictResponse(proto.Message): @@ -197,23 +226,48 @@ class PredictionResult(proto.Message): ``PredictRequest.params``. """ - id = proto.Field(proto.STRING, number=1,) + id = proto.Field( + proto.STRING, + number=1, + ) item_metadata = proto.MapField( - proto.STRING, proto.MESSAGE, number=2, message=struct_pb2.Value, + proto.STRING, + proto.MESSAGE, + number=2, + message=struct_pb2.Value, ) @property def raw_page(self): return self - results = proto.RepeatedField(proto.MESSAGE, number=1, message=PredictionResult,) - recommendation_token = proto.Field(proto.STRING, number=2,) - items_missing_in_catalog = proto.RepeatedField(proto.STRING, number=3,) - dry_run = proto.Field(proto.BOOL, number=4,) + results = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=PredictionResult, + ) + recommendation_token = proto.Field( + proto.STRING, + number=2, + ) + items_missing_in_catalog = proto.RepeatedField( + proto.STRING, + number=3, + ) + dry_run = proto.Field( + proto.BOOL, + number=4, + ) metadata = proto.MapField( - proto.STRING, proto.MESSAGE, number=5, message=struct_pb2.Value, + proto.STRING, + proto.MESSAGE, + number=5, + message=struct_pb2.Value, + ) + next_page_token = proto.Field( + proto.STRING, + number=6, ) - next_page_token = proto.Field(proto.STRING, number=6,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/recommendationengine_v1beta1/types/recommendationengine_resources.py b/google/cloud/recommendationengine_v1beta1/types/recommendationengine_resources.py index 167f688d..54e4ad48 100644 --- a/google/cloud/recommendationengine_v1beta1/types/recommendationengine_resources.py +++ b/google/cloud/recommendationengine_v1beta1/types/recommendationengine_resources.py @@ -16,7 +16,8 @@ __protobuf__ = proto.module( - package="google.cloud.recommendationengine.v1beta1", manifest={}, + package="google.cloud.recommendationengine.v1beta1", + manifest={}, ) diff --git a/google/cloud/recommendationengine_v1beta1/types/user_event.py b/google/cloud/recommendationengine_v1beta1/types/user_event.py index be5331ad..64d1e271 100644 --- a/google/cloud/recommendationengine_v1beta1/types/user_event.py +++ b/google/cloud/recommendationengine_v1beta1/types/user_event.py @@ -107,14 +107,35 @@ class EventSource(proto.Enum): ECOMMERCE = 2 BATCH_UPLOAD = 3 - event_type = proto.Field(proto.STRING, number=1,) - user_info = proto.Field(proto.MESSAGE, number=2, message="UserInfo",) - event_detail = proto.Field(proto.MESSAGE, number=3, message="EventDetail",) + event_type = proto.Field( + proto.STRING, + number=1, + ) + user_info = proto.Field( + proto.MESSAGE, + number=2, + message="UserInfo", + ) + event_detail = proto.Field( + proto.MESSAGE, + number=3, + message="EventDetail", + ) product_event_detail = proto.Field( - proto.MESSAGE, number=4, message="ProductEventDetail", + proto.MESSAGE, + number=4, + message="ProductEventDetail", + ) + event_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + event_source = proto.Field( + proto.ENUM, + number=6, + enum=EventSource, ) - event_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - event_source = proto.Field(proto.ENUM, number=6, enum=EventSource,) class UserInfo(proto.Message): @@ -158,11 +179,26 @@ class UserInfo(proto.Message): processing and pushing the user events). """ - visitor_id = proto.Field(proto.STRING, number=1,) - user_id = proto.Field(proto.STRING, number=2,) - ip_address = proto.Field(proto.STRING, number=3,) - user_agent = proto.Field(proto.STRING, number=4,) - direct_user_request = proto.Field(proto.BOOL, number=5,) + visitor_id = proto.Field( + proto.STRING, + number=1, + ) + user_id = proto.Field( + proto.STRING, + number=2, + ) + ip_address = proto.Field( + proto.STRING, + number=3, + ) + user_agent = proto.Field( + proto.STRING, + number=4, + ) + direct_user_request = proto.Field( + proto.BOOL, + number=5, + ) class EventDetail(proto.Message): @@ -222,12 +258,31 @@ class EventDetail(proto.Message): directly, or coming through Google search, and etc. """ - uri = proto.Field(proto.STRING, number=1,) - referrer_uri = proto.Field(proto.STRING, number=6,) - page_view_id = proto.Field(proto.STRING, number=2,) - experiment_ids = proto.RepeatedField(proto.STRING, number=3,) - recommendation_token = proto.Field(proto.STRING, number=4,) - event_attributes = proto.Field(proto.MESSAGE, number=5, message=common.FeatureMap,) + uri = proto.Field( + proto.STRING, + number=1, + ) + referrer_uri = proto.Field( + proto.STRING, + number=6, + ) + page_view_id = proto.Field( + proto.STRING, + number=2, + ) + experiment_ids = proto.RepeatedField( + proto.STRING, + number=3, + ) + recommendation_token = proto.Field( + proto.STRING, + number=4, + ) + event_attributes = proto.Field( + proto.MESSAGE, + number=5, + message=common.FeatureMap, + ) class ProductEventDetail(proto.Message): @@ -292,17 +347,32 @@ class ProductEventDetail(proto.Message): should not set this field. """ - search_query = proto.Field(proto.STRING, number=1,) + search_query = proto.Field( + proto.STRING, + number=1, + ) page_categories = proto.RepeatedField( - proto.MESSAGE, number=2, message=catalog.CatalogItem.CategoryHierarchy, + proto.MESSAGE, + number=2, + message=catalog.CatalogItem.CategoryHierarchy, ) product_details = proto.RepeatedField( - proto.MESSAGE, number=3, message="ProductDetail", + proto.MESSAGE, + number=3, + message="ProductDetail", + ) + list_id = proto.Field( + proto.STRING, + number=4, + ) + cart_id = proto.Field( + proto.STRING, + number=5, ) - list_id = proto.Field(proto.STRING, number=4,) - cart_id = proto.Field(proto.STRING, number=5,) purchase_transaction = proto.Field( - proto.MESSAGE, number=6, message="PurchaseTransaction", + proto.MESSAGE, + number=6, + message="PurchaseTransaction", ) @@ -339,11 +409,28 @@ class PurchaseTransaction(proto.Message): This field is not required if the event type is ``refund``. """ - id = proto.Field(proto.STRING, number=1,) - revenue = proto.Field(proto.FLOAT, number=2,) - taxes = proto.MapField(proto.STRING, proto.FLOAT, number=3,) - costs = proto.MapField(proto.STRING, proto.FLOAT, number=4,) - currency_code = proto.Field(proto.STRING, number=6,) + id = proto.Field( + proto.STRING, + number=1, + ) + revenue = proto.Field( + proto.FLOAT, + number=2, + ) + taxes = proto.MapField( + proto.STRING, + proto.FLOAT, + number=3, + ) + costs = proto.MapField( + proto.STRING, + proto.FLOAT, + number=4, + ) + currency_code = proto.Field( + proto.STRING, + number=6, + ) class ProductDetail(proto.Message): @@ -392,16 +479,40 @@ class ProductDetail(proto.Message): product in the user event. """ - id = proto.Field(proto.STRING, number=1,) - currency_code = proto.Field(proto.STRING, number=2,) - original_price = proto.Field(proto.FLOAT, number=3,) - display_price = proto.Field(proto.FLOAT, number=4,) + id = proto.Field( + proto.STRING, + number=1, + ) + currency_code = proto.Field( + proto.STRING, + number=2, + ) + original_price = proto.Field( + proto.FLOAT, + number=3, + ) + display_price = proto.Field( + proto.FLOAT, + number=4, + ) stock_state = proto.Field( - proto.ENUM, number=5, enum=catalog.ProductCatalogItem.StockState, + proto.ENUM, + number=5, + enum=catalog.ProductCatalogItem.StockState, + ) + quantity = proto.Field( + proto.INT32, + number=6, + ) + available_quantity = proto.Field( + proto.INT32, + number=7, + ) + item_attributes = proto.Field( + proto.MESSAGE, + number=8, + message=common.FeatureMap, ) - quantity = proto.Field(proto.INT32, number=6,) - available_quantity = proto.Field(proto.INT32, number=7,) - item_attributes = proto.Field(proto.MESSAGE, number=8, message=common.FeatureMap,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/recommendationengine_v1beta1/types/user_event_service.py b/google/cloud/recommendationengine_v1beta1/types/user_event_service.py index c23ea78b..330e0613 100644 --- a/google/cloud/recommendationengine_v1beta1/types/user_event_service.py +++ b/google/cloud/recommendationengine_v1beta1/types/user_event_service.py @@ -68,9 +68,18 @@ class PurgeUserEventsRequest(proto.Message): returned. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - force = proto.Field(proto.BOOL, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + force = proto.Field( + proto.BOOL, + number=3, + ) class PurgeUserEventsMetadata(proto.Message): @@ -85,8 +94,15 @@ class PurgeUserEventsMetadata(proto.Message): Operation create time. """ - operation_name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + operation_name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class PurgeUserEventsResponse(proto.Message): @@ -104,9 +120,14 @@ class PurgeUserEventsResponse(proto.Message): will be returned. """ - purged_events_count = proto.Field(proto.INT64, number=1,) + purged_events_count = proto.Field( + proto.INT64, + number=1, + ) user_events_sample = proto.RepeatedField( - proto.MESSAGE, number=2, message=gcr_user_event.UserEvent, + proto.MESSAGE, + number=2, + message=gcr_user_event.UserEvent, ) @@ -121,8 +142,15 @@ class WriteUserEventRequest(proto.Message): Required. User event to write. """ - parent = proto.Field(proto.STRING, number=1,) - user_event = proto.Field(proto.MESSAGE, number=2, message=gcr_user_event.UserEvent,) + parent = proto.Field( + proto.STRING, + number=1, + ) + user_event = proto.Field( + proto.MESSAGE, + number=2, + message=gcr_user_event.UserEvent, + ) class CollectUserEventRequest(proto.Message): @@ -148,10 +176,22 @@ class CollectUserEventRequest(proto.Message): abbreviated to reduce the payload bytes. """ - parent = proto.Field(proto.STRING, number=1,) - user_event = proto.Field(proto.STRING, number=2,) - uri = proto.Field(proto.STRING, number=3,) - ets = proto.Field(proto.INT64, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + user_event = proto.Field( + proto.STRING, + number=2, + ) + uri = proto.Field( + proto.STRING, + number=3, + ) + ets = proto.Field( + proto.INT64, + number=4, + ) class ListUserEventsRequest(proto.Message): @@ -207,10 +247,22 @@ class ListUserEventsRequest(proto.Message): - Example 6: eventsMissingCatalogItems """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) class ListUserEventsResponse(proto.Message): @@ -229,9 +281,14 @@ def raw_page(self): return self user_events = proto.RepeatedField( - proto.MESSAGE, number=1, message=gcr_user_event.UserEvent, + proto.MESSAGE, + number=1, + message=gcr_user_event.UserEvent, + ) + 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/noxfile.py b/noxfile.py index 2a2001c4..3addb4ed 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py index c803293a..e61e231d 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py @@ -102,7 +102,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [CatalogServiceClient, CatalogServiceAsyncClient,] + "client_class", + [ + CatalogServiceClient, + CatalogServiceAsyncClient, + ], ) def test_catalog_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -144,7 +148,11 @@ def test_catalog_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [CatalogServiceClient, CatalogServiceAsyncClient,] + "client_class", + [ + CatalogServiceClient, + CatalogServiceAsyncClient, + ], ) def test_catalog_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -508,7 +516,9 @@ def test_catalog_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) @@ -649,11 +659,16 @@ def test_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [catalog_service.CreateCatalogItemRequest, dict,] + "request_type", + [ + catalog_service.CreateCatalogItemRequest, + dict, + ], ) def test_create_catalog_item(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -697,7 +712,8 @@ def test_create_catalog_item_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 = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -716,7 +732,8 @@ async def test_create_catalog_item_async( request_type=catalog_service.CreateCatalogItemRequest, ): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -761,7 +778,9 @@ async def test_create_catalog_item_async_from_dict(): def test_create_catalog_item_field_headers(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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. @@ -783,7 +802,10 @@ def test_create_catalog_item_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 @@ -812,11 +834,16 @@ async def test_create_catalog_item_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_catalog_item_flattened(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -827,7 +854,8 @@ def test_create_catalog_item_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_catalog_item( - parent="parent_value", catalog_item=catalog.CatalogItem(id="id_value"), + parent="parent_value", + catalog_item=catalog.CatalogItem(id="id_value"), ) # Establish that the underlying call was made with the expected @@ -843,7 +871,9 @@ def test_create_catalog_item_flattened(): def test_create_catalog_item_flattened_error(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -872,7 +902,8 @@ async def test_create_catalog_item_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_catalog_item( - parent="parent_value", catalog_item=catalog.CatalogItem(id="id_value"), + parent="parent_value", + catalog_item=catalog.CatalogItem(id="id_value"), ) # Establish that the underlying call was made with the expected @@ -903,10 +934,17 @@ async def test_create_catalog_item_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [catalog_service.GetCatalogItemRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetCatalogItemRequest, + dict, + ], +) def test_get_catalog_item(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -948,7 +986,8 @@ def test_get_catalog_item_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 = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -964,7 +1003,8 @@ async def test_get_catalog_item_async( transport: str = "grpc_asyncio", request_type=catalog_service.GetCatalogItemRequest ): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1007,7 +1047,9 @@ async def test_get_catalog_item_async_from_dict(): def test_get_catalog_item_field_headers(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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. @@ -1027,7 +1069,10 @@ def test_get_catalog_item_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 @@ -1054,11 +1099,16 @@ async def test_get_catalog_item_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_catalog_item_flattened(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_catalog_item), "__call__") as call: @@ -1066,7 +1116,9 @@ def test_get_catalog_item_flattened(): call.return_value = catalog.CatalogItem() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_catalog_item(name="name_value",) + client.get_catalog_item( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1078,13 +1130,16 @@ def test_get_catalog_item_flattened(): def test_get_catalog_item_flattened_error(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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_catalog_item( - catalog_service.GetCatalogItemRequest(), name="name_value", + catalog_service.GetCatalogItemRequest(), + name="name_value", ) @@ -1102,7 +1157,9 @@ async def test_get_catalog_item_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(catalog.CatalogItem()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_catalog_item(name="name_value",) + response = await client.get_catalog_item( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1123,16 +1180,22 @@ async def test_get_catalog_item_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_catalog_item( - catalog_service.GetCatalogItemRequest(), name="name_value", + catalog_service.GetCatalogItemRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [catalog_service.ListCatalogItemsRequest, dict,] + "request_type", + [ + catalog_service.ListCatalogItemsRequest, + dict, + ], ) def test_list_catalog_items(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1163,7 +1226,8 @@ def test_list_catalog_items_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 = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1182,7 +1246,8 @@ async def test_list_catalog_items_async( request_type=catalog_service.ListCatalogItemsRequest, ): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1217,7 +1282,9 @@ async def test_list_catalog_items_async_from_dict(): def test_list_catalog_items_field_headers(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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. @@ -1239,7 +1306,10 @@ def test_list_catalog_items_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 @@ -1270,11 +1340,16 @@ async def test_list_catalog_items_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_catalog_items_flattened(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1285,7 +1360,8 @@ def test_list_catalog_items_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_catalog_items( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -1301,7 +1377,9 @@ def test_list_catalog_items_flattened(): def test_list_catalog_items_flattened_error(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1332,7 +1410,8 @@ async def test_list_catalog_items_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_catalog_items( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -1365,7 +1444,8 @@ async def test_list_catalog_items_flattened_error_async(): def test_list_catalog_items_pager(transport_name: str = "grpc"): client = CatalogServiceClient( - 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. @@ -1383,13 +1463,20 @@ def test_list_catalog_items_pager(transport_name: str = "grpc"): next_page_token="abc", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[], next_page_token="def", + catalog_items=[], + next_page_token="def", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(),], next_page_token="ghi", + catalog_items=[ + catalog.CatalogItem(), + ], + next_page_token="ghi", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(), catalog.CatalogItem(),], + catalog_items=[ + catalog.CatalogItem(), + catalog.CatalogItem(), + ], ), RuntimeError, ) @@ -1409,7 +1496,8 @@ def test_list_catalog_items_pager(transport_name: str = "grpc"): def test_list_catalog_items_pages(transport_name: str = "grpc"): client = CatalogServiceClient( - 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. @@ -1427,13 +1515,20 @@ def test_list_catalog_items_pages(transport_name: str = "grpc"): next_page_token="abc", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[], next_page_token="def", + catalog_items=[], + next_page_token="def", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(),], next_page_token="ghi", + catalog_items=[ + catalog.CatalogItem(), + ], + next_page_token="ghi", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(), catalog.CatalogItem(),], + catalog_items=[ + catalog.CatalogItem(), + catalog.CatalogItem(), + ], ), RuntimeError, ) @@ -1444,7 +1539,9 @@ def test_list_catalog_items_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_catalog_items_async_pager(): - client = CatalogServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = CatalogServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1463,17 +1560,26 @@ async def test_list_catalog_items_async_pager(): next_page_token="abc", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[], next_page_token="def", + catalog_items=[], + next_page_token="def", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(),], next_page_token="ghi", + catalog_items=[ + catalog.CatalogItem(), + ], + next_page_token="ghi", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(), catalog.CatalogItem(),], + catalog_items=[ + catalog.CatalogItem(), + catalog.CatalogItem(), + ], ), RuntimeError, ) - async_pager = await client.list_catalog_items(request={},) + async_pager = await client.list_catalog_items( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1485,7 +1591,9 @@ async def test_list_catalog_items_async_pager(): @pytest.mark.asyncio async def test_list_catalog_items_async_pages(): - client = CatalogServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = CatalogServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1504,13 +1612,20 @@ async def test_list_catalog_items_async_pages(): next_page_token="abc", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[], next_page_token="def", + catalog_items=[], + next_page_token="def", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(),], next_page_token="ghi", + catalog_items=[ + catalog.CatalogItem(), + ], + next_page_token="ghi", ), catalog_service.ListCatalogItemsResponse( - catalog_items=[catalog.CatalogItem(), catalog.CatalogItem(),], + catalog_items=[ + catalog.CatalogItem(), + catalog.CatalogItem(), + ], ), RuntimeError, ) @@ -1522,11 +1637,16 @@ async def test_list_catalog_items_async_pages(): @pytest.mark.parametrize( - "request_type", [catalog_service.UpdateCatalogItemRequest, dict,] + "request_type", + [ + catalog_service.UpdateCatalogItemRequest, + dict, + ], ) def test_update_catalog_item(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1570,7 +1690,8 @@ def test_update_catalog_item_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 = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1589,7 +1710,8 @@ async def test_update_catalog_item_async( request_type=catalog_service.UpdateCatalogItemRequest, ): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1634,7 +1756,9 @@ async def test_update_catalog_item_async_from_dict(): def test_update_catalog_item_field_headers(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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. @@ -1656,7 +1780,10 @@ def test_update_catalog_item_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 @@ -1685,11 +1812,16 @@ async def test_update_catalog_item_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_update_catalog_item_flattened(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1721,7 +1853,9 @@ def test_update_catalog_item_flattened(): def test_update_catalog_item_flattened_error(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1789,11 +1923,16 @@ async def test_update_catalog_item_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [catalog_service.DeleteCatalogItemRequest, dict,] + "request_type", + [ + catalog_service.DeleteCatalogItemRequest, + dict, + ], ) def test_delete_catalog_item(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1821,7 +1960,8 @@ def test_delete_catalog_item_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 = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1840,7 +1980,8 @@ async def test_delete_catalog_item_async( request_type=catalog_service.DeleteCatalogItemRequest, ): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1870,7 +2011,9 @@ async def test_delete_catalog_item_async_from_dict(): def test_delete_catalog_item_field_headers(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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. @@ -1892,7 +2035,10 @@ def test_delete_catalog_item_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 @@ -1921,11 +2067,16 @@ async def test_delete_catalog_item_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_catalog_item_flattened(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1935,7 +2086,9 @@ def test_delete_catalog_item_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_catalog_item(name="name_value",) + client.delete_catalog_item( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1947,13 +2100,16 @@ def test_delete_catalog_item_flattened(): def test_delete_catalog_item_flattened_error(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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_catalog_item( - catalog_service.DeleteCatalogItemRequest(), name="name_value", + catalog_service.DeleteCatalogItemRequest(), + name="name_value", ) @@ -1973,7 +2129,9 @@ async def test_delete_catalog_item_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_catalog_item(name="name_value",) + response = await client.delete_catalog_item( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1994,14 +2152,22 @@ async def test_delete_catalog_item_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_catalog_item( - catalog_service.DeleteCatalogItemRequest(), name="name_value", + catalog_service.DeleteCatalogItemRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [import_.ImportCatalogItemsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + import_.ImportCatalogItemsRequest, + dict, + ], +) def test_import_catalog_items(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2029,7 +2195,8 @@ def test_import_catalog_items_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 = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2047,7 +2214,8 @@ async def test_import_catalog_items_async( transport: str = "grpc_asyncio", request_type=import_.ImportCatalogItemsRequest ): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2079,7 +2247,9 @@ async def test_import_catalog_items_async_from_dict(): def test_import_catalog_items_field_headers(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + 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. @@ -2101,7 +2271,10 @@ def test_import_catalog_items_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 @@ -2132,11 +2305,16 @@ async def test_import_catalog_items_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_import_catalog_items_flattened(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2180,7 +2358,9 @@ def test_import_catalog_items_flattened(): def test_import_catalog_items_flattened_error(): - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2278,7 +2458,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = CatalogServiceClient( - 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. @@ -2298,7 +2479,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = CatalogServiceClient(client_options=options, transport=transport,) + client = CatalogServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2314,7 +2498,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = CatalogServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2359,8 +2544,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = CatalogServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.CatalogServiceGrpcTransport,) + client = CatalogServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CatalogServiceGrpcTransport, + ) def test_catalog_service_base_transport_error(): @@ -2415,7 +2605,8 @@ def test_catalog_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2573,7 +2764,8 @@ def test_catalog_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.CatalogServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2585,7 +2777,8 @@ def test_catalog_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.CatalogServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2694,12 +2887,16 @@ def test_catalog_service_transport_channel_mtls_with_adc(transport_class): def test_catalog_service_grpc_lro_client(): client = CatalogServiceClient( - 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 @@ -2707,12 +2904,16 @@ def test_catalog_service_grpc_lro_client(): def test_catalog_service_grpc_lro_async_client(): client = CatalogServiceAsyncClient( - 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 @@ -2723,7 +2924,9 @@ def test_catalog_path(): location = "clam" catalog = "whelk" expected = "projects/{project}/locations/{location}/catalogs/{catalog}".format( - project=project, location=location, catalog=catalog, + project=project, + location=location, + catalog=catalog, ) actual = CatalogServiceClient.catalog_path(project, location, catalog) assert expected == actual @@ -2764,7 +2967,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = CatalogServiceClient.common_folder_path(folder) assert expected == actual @@ -2782,7 +2987,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = CatalogServiceClient.common_organization_path(organization) assert expected == actual @@ -2800,7 +3007,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = CatalogServiceClient.common_project_path(project) assert expected == actual @@ -2820,7 +3029,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = CatalogServiceClient.common_location_path(project, location) assert expected == actual @@ -2845,7 +3055,8 @@ def test_client_with_default_client_info(): transports.CatalogServiceTransport, "_prep_wrapped_messages" ) as prep: client = CatalogServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2854,7 +3065,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CatalogServiceClient.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) @@ -2862,7 +3074,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CatalogServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py index 308eb44c..23471483 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py @@ -97,7 +97,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( "client_class", - [PredictionApiKeyRegistryClient, PredictionApiKeyRegistryAsyncClient,], + [ + PredictionApiKeyRegistryClient, + PredictionApiKeyRegistryAsyncClient, + ], ) def test_prediction_api_key_registry_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -140,7 +143,10 @@ def test_prediction_api_key_registry_client_service_account_always_use_jwt( @pytest.mark.parametrize( "client_class", - [PredictionApiKeyRegistryClient, PredictionApiKeyRegistryAsyncClient,], + [ + PredictionApiKeyRegistryClient, + PredictionApiKeyRegistryAsyncClient, + ], ) def test_prediction_api_key_registry_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -529,7 +535,9 @@ def test_prediction_api_key_registry_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) @@ -678,7 +686,8 @@ def test_prediction_api_key_registry_client_create_channel_credentials_file( ) def test_create_prediction_api_key_registration(request_type, transport: str = "grpc"): client = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -690,8 +699,10 @@ def test_create_prediction_api_key_registration(request_type, transport: str = " type(client.transport.create_prediction_api_key_registration), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = prediction_apikey_registry_service.PredictionApiKeyRegistration( - api_key="api_key_value", + call.return_value = ( + prediction_apikey_registry_service.PredictionApiKeyRegistration( + api_key="api_key_value", + ) ) response = client.create_prediction_api_key_registration(request) @@ -714,7 +725,8 @@ def test_create_prediction_api_key_registration_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 = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -736,7 +748,8 @@ async def test_create_prediction_api_key_registration_async( request_type=prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest, ): client = PredictionApiKeyRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -804,7 +817,10 @@ def test_create_prediction_api_key_registration_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 @@ -837,7 +853,10 @@ async def test_create_prediction_api_key_registration_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_prediction_api_key_registration_flattened(): @@ -961,7 +980,8 @@ async def test_create_prediction_api_key_registration_flattened_error_async(): ) def test_list_prediction_api_key_registrations(request_type, transport: str = "grpc"): client = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -995,7 +1015,8 @@ def test_list_prediction_api_key_registrations_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 = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1017,7 +1038,8 @@ async def test_list_prediction_api_key_registrations_async( request_type=prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest, ): client = PredictionApiKeyRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1083,7 +1105,10 @@ def test_list_prediction_api_key_registrations_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 @@ -1116,7 +1141,10 @@ async def test_list_prediction_api_key_registrations_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_prediction_api_key_registrations_flattened(): @@ -1134,7 +1162,9 @@ def test_list_prediction_api_key_registrations_flattened(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_prediction_api_key_registrations(parent="parent_value",) + client.list_prediction_api_key_registrations( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1209,7 +1239,8 @@ async def test_list_prediction_api_key_registrations_flattened_error_async(): def test_list_prediction_api_key_registrations_pager(transport_name: str = "grpc"): client = PredictionApiKeyRegistryClient( - 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. @@ -1227,7 +1258,8 @@ def test_list_prediction_api_key_registrations_pager(transport_name: str = "grpc next_page_token="abc", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( - prediction_api_key_registrations=[], next_page_token="def", + prediction_api_key_registrations=[], + next_page_token="def", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( prediction_api_key_registrations=[ @@ -1264,7 +1296,8 @@ def test_list_prediction_api_key_registrations_pager(transport_name: str = "grpc def test_list_prediction_api_key_registrations_pages(transport_name: str = "grpc"): client = PredictionApiKeyRegistryClient( - 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. @@ -1282,7 +1315,8 @@ def test_list_prediction_api_key_registrations_pages(transport_name: str = "grpc next_page_token="abc", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( - prediction_api_key_registrations=[], next_page_token="def", + prediction_api_key_registrations=[], + next_page_token="def", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( prediction_api_key_registrations=[ @@ -1326,7 +1360,8 @@ async def test_list_prediction_api_key_registrations_async_pager(): next_page_token="abc", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( - prediction_api_key_registrations=[], next_page_token="def", + prediction_api_key_registrations=[], + next_page_token="def", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( prediction_api_key_registrations=[ @@ -1342,7 +1377,9 @@ async def test_list_prediction_api_key_registrations_async_pager(): ), RuntimeError, ) - async_pager = await client.list_prediction_api_key_registrations(request={},) + async_pager = await client.list_prediction_api_key_registrations( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1380,7 +1417,8 @@ async def test_list_prediction_api_key_registrations_async_pages(): next_page_token="abc", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( - prediction_api_key_registrations=[], next_page_token="def", + prediction_api_key_registrations=[], + next_page_token="def", ), prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsResponse( prediction_api_key_registrations=[ @@ -1414,7 +1452,8 @@ async def test_list_prediction_api_key_registrations_async_pages(): ) def test_delete_prediction_api_key_registration(request_type, transport: str = "grpc"): client = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1445,7 +1484,8 @@ def test_delete_prediction_api_key_registration_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 = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1467,7 +1507,8 @@ async def test_delete_prediction_api_key_registration_async( request_type=prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest, ): client = PredictionApiKeyRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1526,7 +1567,10 @@ def test_delete_prediction_api_key_registration_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 @@ -1557,7 +1601,10 @@ async def test_delete_prediction_api_key_registration_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_prediction_api_key_registration_flattened(): @@ -1573,7 +1620,9 @@ def test_delete_prediction_api_key_registration_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_prediction_api_key_registration(name="name_value",) + client.delete_prediction_api_key_registration( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1649,7 +1698,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PredictionApiKeyRegistryClient( - 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. @@ -1670,7 +1720,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = PredictionApiKeyRegistryClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1687,7 +1738,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PredictionApiKeyRegistryClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1736,7 +1788,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.PredictionApiKeyRegistryGrpcTransport, + client.transport, + transports.PredictionApiKeyRegistryGrpcTransport, ) @@ -1784,7 +1837,8 @@ def test_prediction_api_key_registry_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionApiKeyRegistryTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1946,7 +2000,8 @@ def test_prediction_api_key_registry_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.PredictionApiKeyRegistryGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1958,7 +2013,8 @@ def test_prediction_api_key_registry_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.PredictionApiKeyRegistryGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2071,7 +2127,10 @@ def test_event_store_path(): catalog = "whelk" event_store = "octopus" expected = "projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}".format( - project=project, location=location, catalog=catalog, event_store=event_store, + project=project, + location=location, + catalog=catalog, + event_store=event_store, ) actual = PredictionApiKeyRegistryClient.event_store_path( project, location, catalog, event_store @@ -2153,7 +2212,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PredictionApiKeyRegistryClient.common_folder_path(folder) assert expected == actual @@ -2171,7 +2232,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PredictionApiKeyRegistryClient.common_organization_path(organization) assert expected == actual @@ -2189,7 +2252,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PredictionApiKeyRegistryClient.common_project_path(project) assert expected == actual @@ -2209,7 +2274,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PredictionApiKeyRegistryClient.common_location_path(project, location) assert expected == actual @@ -2234,7 +2300,8 @@ def test_client_with_default_client_info(): transports.PredictionApiKeyRegistryTransport, "_prep_wrapped_messages" ) as prep: client = PredictionApiKeyRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2243,7 +2310,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PredictionApiKeyRegistryClient.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) @@ -2251,7 +2319,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PredictionApiKeyRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py index a065960f..90e243a6 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py @@ -97,7 +97,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [PredictionServiceClient, PredictionServiceAsyncClient,] + "client_class", + [ + PredictionServiceClient, + PredictionServiceAsyncClient, + ], ) def test_prediction_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -139,7 +143,11 @@ def test_prediction_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [PredictionServiceClient, PredictionServiceAsyncClient,] + "client_class", + [ + PredictionServiceClient, + PredictionServiceAsyncClient, + ], ) def test_prediction_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -513,7 +521,9 @@ def test_prediction_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) @@ -653,10 +663,17 @@ def test_prediction_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [prediction_service.PredictRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest, + dict, + ], +) def test_predict(request_type, transport: str = "grpc"): client = PredictionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -691,7 +708,8 @@ def test_predict_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 = PredictionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -707,7 +725,8 @@ async def test_predict_async( transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest ): client = PredictionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -746,7 +765,9 @@ async def test_predict_async_from_dict(): def test_predict_field_headers(): - client = PredictionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PredictionServiceClient( + 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. @@ -766,7 +787,10 @@ def test_predict_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 @@ -795,11 +819,16 @@ async def test_predict_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_predict_flattened(): - client = PredictionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -825,7 +854,9 @@ def test_predict_flattened(): def test_predict_flattened_error(): - client = PredictionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -888,7 +919,8 @@ async def test_predict_flattened_error_async(): def test_predict_pager(transport_name: str = "grpc"): client = PredictionServiceClient( - 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. @@ -903,9 +935,14 @@ def test_predict_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - prediction_service.PredictResponse(results=[], next_page_token="def",), prediction_service.PredictResponse( - results=[prediction_service.PredictResponse.PredictionResult(),], + results=[], + next_page_token="def", + ), + prediction_service.PredictResponse( + results=[ + prediction_service.PredictResponse.PredictionResult(), + ], next_page_token="ghi", ), prediction_service.PredictResponse( @@ -935,7 +972,8 @@ def test_predict_pager(transport_name: str = "grpc"): def test_predict_pages(transport_name: str = "grpc"): client = PredictionServiceClient( - 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. @@ -950,9 +988,14 @@ def test_predict_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - prediction_service.PredictResponse(results=[], next_page_token="def",), prediction_service.PredictResponse( - results=[prediction_service.PredictResponse.PredictionResult(),], + results=[], + next_page_token="def", + ), + prediction_service.PredictResponse( + results=[ + prediction_service.PredictResponse.PredictionResult(), + ], next_page_token="ghi", ), prediction_service.PredictResponse( @@ -988,9 +1031,14 @@ async def test_predict_async_pager(): ], next_page_token="abc", ), - prediction_service.PredictResponse(results=[], next_page_token="def",), prediction_service.PredictResponse( - results=[prediction_service.PredictResponse.PredictionResult(),], + results=[], + next_page_token="def", + ), + prediction_service.PredictResponse( + results=[ + prediction_service.PredictResponse.PredictionResult(), + ], next_page_token="ghi", ), prediction_service.PredictResponse( @@ -1001,7 +1049,9 @@ async def test_predict_async_pager(): ), RuntimeError, ) - async_pager = await client.predict(request={},) + async_pager = await client.predict( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1034,9 +1084,14 @@ async def test_predict_async_pages(): ], next_page_token="abc", ), - prediction_service.PredictResponse(results=[], next_page_token="def",), prediction_service.PredictResponse( - results=[prediction_service.PredictResponse.PredictionResult(),], + results=[], + next_page_token="def", + ), + prediction_service.PredictResponse( + results=[ + prediction_service.PredictResponse.PredictionResult(), + ], next_page_token="ghi", ), prediction_service.PredictResponse( @@ -1061,7 +1116,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PredictionServiceClient( - 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. @@ -1081,7 +1137,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = PredictionServiceClient(client_options=options, transport=transport,) + client = PredictionServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1097,7 +1156,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PredictionServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1142,8 +1202,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = PredictionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.PredictionServiceGrpcTransport,) + client = PredictionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.PredictionServiceGrpcTransport, + ) def test_prediction_service_base_transport_error(): @@ -1186,7 +1251,8 @@ def test_prediction_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1344,7 +1410,8 @@ def test_prediction_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.PredictionServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1356,7 +1423,8 @@ def test_prediction_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.PredictionServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1519,7 +1587,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 = PredictionServiceClient.common_folder_path(folder) assert expected == actual @@ -1537,7 +1607,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 = PredictionServiceClient.common_organization_path(organization) assert expected == actual @@ -1555,7 +1627,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 = PredictionServiceClient.common_project_path(project) assert expected == actual @@ -1575,7 +1649,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 = PredictionServiceClient.common_location_path(project, location) assert expected == actual @@ -1600,7 +1675,8 @@ def test_client_with_default_client_info(): transports.PredictionServiceTransport, "_prep_wrapped_messages" ) as prep: client = PredictionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1609,7 +1685,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PredictionServiceClient.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) @@ -1617,7 +1694,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PredictionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py index 699b1afc..fecc5556 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py @@ -105,7 +105,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [UserEventServiceClient, UserEventServiceAsyncClient,] + "client_class", + [ + UserEventServiceClient, + UserEventServiceAsyncClient, + ], ) def test_user_event_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -147,7 +151,11 @@ def test_user_event_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [UserEventServiceClient, UserEventServiceAsyncClient,] + "client_class", + [ + UserEventServiceClient, + UserEventServiceAsyncClient, + ], ) def test_user_event_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -521,7 +529,9 @@ def test_user_event_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) @@ -662,11 +672,16 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [user_event_service.WriteUserEventRequest, dict,] + "request_type", + [ + user_event_service.WriteUserEventRequest, + dict, + ], ) def test_write_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -697,7 +712,8 @@ def test_write_user_event_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 = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -714,7 +730,8 @@ async def test_write_user_event_async( request_type=user_event_service.WriteUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -749,7 +766,9 @@ async def test_write_user_event_async_from_dict(): def test_write_user_event_field_headers(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + 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. @@ -769,7 +788,10 @@ def test_write_user_event_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 @@ -798,11 +820,16 @@ async def test_write_user_event_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_write_user_event_flattened(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.write_user_event), "__call__") as call: @@ -828,7 +855,9 @@ def test_write_user_event_flattened(): def test_write_user_event_flattened_error(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -890,11 +919,16 @@ async def test_write_user_event_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [user_event_service.CollectUserEventRequest, dict,] + "request_type", + [ + user_event_service.CollectUserEventRequest, + dict, + ], ) def test_collect_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -907,7 +941,8 @@ def test_collect_user_event(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = httpbody_pb2.HttpBody( - content_type="content_type_value", data=b"data_blob", + content_type="content_type_value", + data=b"data_blob", ) response = client.collect_user_event(request) @@ -926,7 +961,8 @@ def test_collect_user_event_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 = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -945,7 +981,8 @@ async def test_collect_user_event_async( request_type=user_event_service.CollectUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -958,7 +995,10 @@ async def test_collect_user_event_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - httpbody_pb2.HttpBody(content_type="content_type_value", data=b"data_blob",) + httpbody_pb2.HttpBody( + content_type="content_type_value", + data=b"data_blob", + ) ) response = await client.collect_user_event(request) @@ -979,7 +1019,9 @@ async def test_collect_user_event_async_from_dict(): def test_collect_user_event_field_headers(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + 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. @@ -1001,7 +1043,10 @@ def test_collect_user_event_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 @@ -1032,11 +1077,16 @@ async def test_collect_user_event_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_collect_user_event_flattened(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1072,7 +1122,9 @@ def test_collect_user_event_flattened(): def test_collect_user_event_flattened_error(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1148,11 +1200,16 @@ async def test_collect_user_event_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [user_event_service.ListUserEventsRequest, dict,] + "request_type", + [ + user_event_service.ListUserEventsRequest, + dict, + ], ) def test_list_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1181,7 +1238,8 @@ def test_list_user_events_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 = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1198,7 +1256,8 @@ async def test_list_user_events_async( request_type=user_event_service.ListUserEventsRequest, ): client = UserEventServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1231,7 +1290,9 @@ async def test_list_user_events_async_from_dict(): def test_list_user_events_field_headers(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + 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. @@ -1251,7 +1312,10 @@ def test_list_user_events_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 @@ -1280,11 +1344,16 @@ async def test_list_user_events_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_user_events_flattened(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_user_events), "__call__") as call: @@ -1293,7 +1362,8 @@ def test_list_user_events_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_user_events( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -1309,7 +1379,9 @@ def test_list_user_events_flattened(): def test_list_user_events_flattened_error(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1338,7 +1410,8 @@ async def test_list_user_events_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_user_events( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -1371,7 +1444,8 @@ async def test_list_user_events_flattened_error_async(): def test_list_user_events_pager(transport_name: str = "grpc"): client = UserEventServiceClient( - 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. @@ -1387,13 +1461,20 @@ def test_list_user_events_pager(transport_name: str = "grpc"): next_page_token="abc", ), user_event_service.ListUserEventsResponse( - user_events=[], next_page_token="def", + user_events=[], + next_page_token="def", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(),], next_page_token="ghi", + user_events=[ + user_event.UserEvent(), + ], + next_page_token="ghi", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(), user_event.UserEvent(),], + user_events=[ + user_event.UserEvent(), + user_event.UserEvent(), + ], ), RuntimeError, ) @@ -1413,7 +1494,8 @@ def test_list_user_events_pager(transport_name: str = "grpc"): def test_list_user_events_pages(transport_name: str = "grpc"): client = UserEventServiceClient( - 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. @@ -1429,13 +1511,20 @@ def test_list_user_events_pages(transport_name: str = "grpc"): next_page_token="abc", ), user_event_service.ListUserEventsResponse( - user_events=[], next_page_token="def", + user_events=[], + next_page_token="def", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(),], next_page_token="ghi", + user_events=[ + user_event.UserEvent(), + ], + next_page_token="ghi", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(), user_event.UserEvent(),], + user_events=[ + user_event.UserEvent(), + user_event.UserEvent(), + ], ), RuntimeError, ) @@ -1465,17 +1554,26 @@ async def test_list_user_events_async_pager(): next_page_token="abc", ), user_event_service.ListUserEventsResponse( - user_events=[], next_page_token="def", + user_events=[], + next_page_token="def", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(),], next_page_token="ghi", + user_events=[ + user_event.UserEvent(), + ], + next_page_token="ghi", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(), user_event.UserEvent(),], + user_events=[ + user_event.UserEvent(), + user_event.UserEvent(), + ], ), RuntimeError, ) - async_pager = await client.list_user_events(request={},) + async_pager = await client.list_user_events( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1506,13 +1604,20 @@ async def test_list_user_events_async_pages(): next_page_token="abc", ), user_event_service.ListUserEventsResponse( - user_events=[], next_page_token="def", + user_events=[], + next_page_token="def", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(),], next_page_token="ghi", + user_events=[ + user_event.UserEvent(), + ], + next_page_token="ghi", ), user_event_service.ListUserEventsResponse( - user_events=[user_event.UserEvent(), user_event.UserEvent(),], + user_events=[ + user_event.UserEvent(), + user_event.UserEvent(), + ], ), RuntimeError, ) @@ -1524,11 +1629,16 @@ async def test_list_user_events_async_pages(): @pytest.mark.parametrize( - "request_type", [user_event_service.PurgeUserEventsRequest, dict,] + "request_type", + [ + user_event_service.PurgeUserEventsRequest, + dict, + ], ) def test_purge_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1556,7 +1666,8 @@ def test_purge_user_events_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 = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1575,7 +1686,8 @@ async def test_purge_user_events_async( request_type=user_event_service.PurgeUserEventsRequest, ): client = UserEventServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1607,7 +1719,9 @@ async def test_purge_user_events_async_from_dict(): def test_purge_user_events_field_headers(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + 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. @@ -1629,7 +1743,10 @@ def test_purge_user_events_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 @@ -1660,11 +1777,16 @@ async def test_purge_user_events_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_purge_user_events_flattened(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1675,7 +1797,9 @@ def test_purge_user_events_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.purge_user_events( - parent="parent_value", filter="filter_value", force=True, + parent="parent_value", + filter="filter_value", + force=True, ) # Establish that the underlying call was made with the expected @@ -1694,7 +1818,9 @@ def test_purge_user_events_flattened(): def test_purge_user_events_flattened_error(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1726,7 +1852,9 @@ async def test_purge_user_events_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.purge_user_events( - parent="parent_value", filter="filter_value", force=True, + parent="parent_value", + filter="filter_value", + force=True, ) # Establish that the underlying call was made with the expected @@ -1761,10 +1889,17 @@ async def test_purge_user_events_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [import_.ImportUserEventsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + import_.ImportUserEventsRequest, + dict, + ], +) def test_import_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1792,7 +1927,8 @@ def test_import_user_events_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 = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1810,7 +1946,8 @@ async def test_import_user_events_async( transport: str = "grpc_asyncio", request_type=import_.ImportUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1842,7 +1979,9 @@ async def test_import_user_events_async_from_dict(): def test_import_user_events_field_headers(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + 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. @@ -1864,7 +2003,10 @@ def test_import_user_events_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 @@ -1895,11 +2037,16 @@ async def test_import_user_events_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_import_user_events_flattened(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1943,7 +2090,9 @@ def test_import_user_events_flattened(): def test_import_user_events_flattened_error(): - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2041,7 +2190,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = UserEventServiceClient( - 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. @@ -2061,7 +2211,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = UserEventServiceClient(client_options=options, transport=transport,) + client = UserEventServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2077,7 +2230,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = UserEventServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2122,8 +2276,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = UserEventServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.UserEventServiceGrpcTransport,) + client = UserEventServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.UserEventServiceGrpcTransport, + ) def test_user_event_service_base_transport_error(): @@ -2177,7 +2336,8 @@ def test_user_event_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2335,7 +2495,8 @@ def test_user_event_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.UserEventServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2347,7 +2508,8 @@ def test_user_event_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.UserEventServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2456,12 +2618,16 @@ def test_user_event_service_transport_channel_mtls_with_adc(transport_class): def test_user_event_service_grpc_lro_client(): client = UserEventServiceClient( - 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 @@ -2469,12 +2635,16 @@ def test_user_event_service_grpc_lro_client(): def test_user_event_service_grpc_lro_async_client(): client = UserEventServiceAsyncClient( - 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 @@ -2486,7 +2656,10 @@ def test_event_store_path(): catalog = "whelk" event_store = "octopus" expected = "projects/{project}/locations/{location}/catalogs/{catalog}/eventStores/{event_store}".format( - project=project, location=location, catalog=catalog, event_store=event_store, + project=project, + location=location, + catalog=catalog, + event_store=event_store, ) actual = UserEventServiceClient.event_store_path( project, location, catalog, event_store @@ -2530,7 +2703,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 = UserEventServiceClient.common_folder_path(folder) assert expected == actual @@ -2548,7 +2723,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 = UserEventServiceClient.common_organization_path(organization) assert expected == actual @@ -2566,7 +2743,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 = UserEventServiceClient.common_project_path(project) assert expected == actual @@ -2586,7 +2765,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 = UserEventServiceClient.common_location_path(project, location) assert expected == actual @@ -2611,7 +2791,8 @@ def test_client_with_default_client_info(): transports.UserEventServiceTransport, "_prep_wrapped_messages" ) as prep: client = UserEventServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2620,7 +2801,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = UserEventServiceClient.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) @@ -2628,7 +2810,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = UserEventServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" From 7179e9d015d43071ee76a0dc25ca854582d26216 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 16:44:24 +0000 Subject: [PATCH 02/17] chore(python): add E231 to .flake8 ignore list (#135) Source-Link: https://github.com/googleapis/synthtool/commit/7ff4aad2ec5af0380e8bd6da1fa06eaadf24ec81 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 29227d4c..2e438749 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 87dd0061..9e0a9356 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 From 033a6309712da6d354376f5e802fbcfac2a426e5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:10:26 +0000 Subject: [PATCH 03/17] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#136) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d --- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e0a9356..22cc254a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a77..46d23716 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 From 07506d228433adf0a630b224684ef13b069ae41e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 31 Mar 2022 22:03:42 -0400 Subject: [PATCH 04/17] chore(python): Enable size-label bot (#137) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254a..58a0b153 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 00000000..09c8d735 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From 516d96d663edbee73f136b70c9870c53b7bb0195 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 15:38:59 -0400 Subject: [PATCH 05/17] chore(python): refactor unit / system test dependency install (#138) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b153..fa576229 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 3addb4ed..6ee5e8ab 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -81,23 +105,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -121,6 +163,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -143,13 +214,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: From aac26ccacbd477bcc3e692df790c140d04f945e6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 06:57:09 -0400 Subject: [PATCH 06/17] chore(python): add license header to auto-label.yaml (#139) Source-Link: https://github.com/googleapis/synthtool/commit/eb78c980b52c7c6746d2edb77d9cf7aaa99a2aab Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa576229..bc893c97 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 +# created: 2022-04-06T10:30:21.687684602Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d735..41bff0b5 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +1,15 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. requestsize: enabled: true From 2af84f99ff01b4209a34cb6638dc1bb70767ba0c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 07:39:02 -0400 Subject: [PATCH 07/17] chore: use gapic-generator-python 0.65.1 (#143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: https://github.com/googleapis/googleapis/commit/2a273915b3f70fe86c9d2a75470a0b83e48d0abf Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/catalog_service/async_client.py | 4 +- .../services/catalog_service/client.py | 4 +- .../catalog_service/transports/base.py | 5 + .../catalog_service/transports/grpc.py | 4 + .../async_client.py | 3 +- .../prediction_api_key_registry/client.py | 3 +- .../transports/base.py | 5 + .../transports/grpc.py | 4 + .../prediction_service/async_client.py | 3 +- .../services/prediction_service/client.py | 3 +- .../prediction_service/transports/base.py | 5 + .../prediction_service/transports/grpc.py | 4 + .../user_event_service/async_client.py | 6 +- .../services/user_event_service/client.py | 6 +- .../user_event_service/transports/base.py | 5 + .../user_event_service/transports/grpc.py | 4 + .../types/__init__.py | 4 +- .../types/catalog.py | 2 +- .../types/common.py | 4 +- .../types/prediction_service.py | 8 +- .../types/user_event.py | 4 +- ...metadata_recommendationengine_v1beta1.json | 1358 ++++++++++++++++- .../test_catalog_service.py | 81 +- .../test_prediction_api_key_registry.py | 83 +- .../test_prediction_service.py | 85 +- .../test_user_event_service.py | 85 +- 26 files changed, 1612 insertions(+), 170 deletions(-) diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py index 59d873df..80f21517 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -577,7 +577,6 @@ async def update_catalog_item( r"""Updates a catalog item. Partial updating is supported. Non-existing items will be created. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -810,7 +809,6 @@ async def import_catalog_items( it is possible for a subset of the items to be successfully updated. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py index 3a34132e..c837d295 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -770,7 +770,6 @@ def update_catalog_item( r"""Updates a catalog item. Partial updating is supported. Non-existing items will be created. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -983,7 +982,6 @@ def import_catalog_items( it is possible for a subset of the items to be successfully updated. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py index 6cb7f104..fce50654 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -288,5 +289,9 @@ def import_catalog_items( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("CatalogServiceTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py index 293d8ae1..5a898464 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/transports/grpc.py @@ -417,5 +417,9 @@ def import_catalog_items( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("CatalogServiceGrpcTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py index 1b6fca61..c595a82c 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -358,7 +358,6 @@ async def list_prediction_api_key_registrations( r"""List the registered apiKeys for use with predict method. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py index e243aada..b50ab737 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -594,7 +594,6 @@ def list_prediction_api_key_registrations( r"""List the registered apiKeys for use with predict method. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py index 86b479e2..8fdd60aa 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -214,5 +215,9 @@ def delete_prediction_api_key_registration( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("PredictionApiKeyRegistryTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py index cbbb93b5..8391f031 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/transports/grpc.py @@ -335,5 +335,9 @@ def delete_prediction_api_key_registration( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("PredictionApiKeyRegistryGrpcTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py index f8aaf971..a0d1c771 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -219,7 +219,6 @@ async def predict( service. `Learn more `__. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py index c5cd4de8..5e804e89 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -447,7 +447,6 @@ def predict( service. `Learn more `__. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py index 706a47e5..72fa33e5 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/base.py @@ -80,6 +80,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -158,5 +159,9 @@ def predict( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("PredictionServiceTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py index 4f5a23c1..c765bf3b 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/transports/grpc.py @@ -262,5 +262,9 @@ def predict( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("PredictionServiceGrpcTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py index 5b0aff44..b6251a48 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -351,7 +351,6 @@ async def collect_user_event( JavaScript pixel. Users should not call this method directly. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -540,7 +539,6 @@ async def list_user_events( r"""Gets a list of user events within a time range, with potential filtering. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -708,7 +706,6 @@ async def purge_user_events( or days to complete. To test a filter, use the list command first. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -878,7 +875,6 @@ async def import_user_events( successfully inserted. Operation.metadata is of type ImportMetadata. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py index f8938356..17523b75 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -567,7 +567,6 @@ def collect_user_event( JavaScript pixel. Users should not call this method directly. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -746,7 +745,6 @@ def list_user_events( r"""Gets a list of user events within a time range, with potential filtering. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -904,7 +902,6 @@ def purge_user_events( or days to complete. To test a filter, use the list command first. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 @@ -1064,7 +1061,6 @@ def import_user_events( successfully inserted. Operation.metadata is of type ImportMetadata. - .. code-block:: python from google.cloud import recommendationengine_v1beta1 diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py index 2a852ce2..f28c8e92 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -264,5 +265,9 @@ def import_user_events( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("UserEventServiceTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py index 171b60fe..7f41c702 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/transports/grpc.py @@ -402,5 +402,9 @@ def import_user_events( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("UserEventServiceGrpcTransport",) diff --git a/google/cloud/recommendationengine_v1beta1/types/__init__.py b/google/cloud/recommendationengine_v1beta1/types/__init__.py index 355c7890..c64229fe 100644 --- a/google/cloud/recommendationengine_v1beta1/types/__init__.py +++ b/google/cloud/recommendationengine_v1beta1/types/__init__.py @@ -26,7 +26,9 @@ ListCatalogItemsResponse, UpdateCatalogItemRequest, ) -from .common import FeatureMap +from .common import ( + FeatureMap, +) from .import_ import ( CatalogInlineSource, GcsSource, diff --git a/google/cloud/recommendationengine_v1beta1/types/catalog.py b/google/cloud/recommendationengine_v1beta1/types/catalog.py index 289eaf9f..ee6bcac2 100644 --- a/google/cloud/recommendationengine_v1beta1/types/catalog.py +++ b/google/cloud/recommendationengine_v1beta1/types/catalog.py @@ -178,7 +178,7 @@ class ProductCatalogItem(proto.Message): Optional. The product price range. This field is a member of `oneof`_ ``price``. - costs (Sequence[google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem.CostsEntry]): + costs (Mapping[str, float]): Optional. A map to pass the costs associated with the product. diff --git a/google/cloud/recommendationengine_v1beta1/types/common.py b/google/cloud/recommendationengine_v1beta1/types/common.py index cb040da9..4927ef10 100644 --- a/google/cloud/recommendationengine_v1beta1/types/common.py +++ b/google/cloud/recommendationengine_v1beta1/types/common.py @@ -30,7 +30,7 @@ class FeatureMap(proto.Message): categorical/numerical features. Attributes: - categorical_features (Sequence[google.cloud.recommendationengine_v1beta1.types.FeatureMap.CategoricalFeaturesEntry]): + categorical_features (Mapping[str, google.cloud.recommendationengine_v1beta1.types.FeatureMap.StringList]): Categorical features that can take on one of a limited number of possible values. Some examples would be the brand/maker of a product, or country of a customer. @@ -39,7 +39,7 @@ class FeatureMap(proto.Message): For example: ``{ "colors": {"value": ["yellow", "green"]}, "sizes": {"value":["S", "M"]}`` - numerical_features (Sequence[google.cloud.recommendationengine_v1beta1.types.FeatureMap.NumericalFeaturesEntry]): + numerical_features (Mapping[str, google.cloud.recommendationengine_v1beta1.types.FeatureMap.FloatList]): Numerical features. Some examples would be the height/weight of a product, or age of a customer. diff --git a/google/cloud/recommendationengine_v1beta1/types/prediction_service.py b/google/cloud/recommendationengine_v1beta1/types/prediction_service.py index 4633555d..7c16f2c4 100644 --- a/google/cloud/recommendationengine_v1beta1/types/prediction_service.py +++ b/google/cloud/recommendationengine_v1beta1/types/prediction_service.py @@ -109,7 +109,7 @@ class PredictRequest(proto.Message): used that returns arbitrary catalog items. Note that the dryRun mode should only be used for testing the API, or if the model is not ready. - params (Sequence[google.cloud.recommendationengine_v1beta1.types.PredictRequest.ParamsEntry]): + params (Mapping[str, google.protobuf.struct_pb2.Value]): Optional. Additional domain specific parameters for the predictions. @@ -125,7 +125,7 @@ class PredictRequest(proto.Message): response. The given 'score' indicates the probability of an item being clicked/purchased given the user's context and history. - labels (Sequence[google.cloud.recommendationengine_v1beta1.types.PredictRequest.LabelsEntry]): + labels (Mapping[str, str]): Optional. The labels for the predict request. - Label keys can contain lowercase letters, digits and @@ -198,7 +198,7 @@ class PredictResponse(proto.Message): dry_run (bool): True if the dryRun property was set in the request. - metadata (Sequence[google.cloud.recommendationengine_v1beta1.types.PredictResponse.MetadataEntry]): + metadata (Mapping[str, google.protobuf.struct_pb2.Value]): Additional domain specific prediction response metadata. next_page_token (str): @@ -213,7 +213,7 @@ class PredictionResult(proto.Message): Attributes: id (str): ID of the recommended catalog item - item_metadata (Sequence[google.cloud.recommendationengine_v1beta1.types.PredictResponse.PredictionResult.ItemMetadataEntry]): + item_metadata (Mapping[str, google.protobuf.struct_pb2.Value]): Additional item metadata / annotations. Possible values: diff --git a/google/cloud/recommendationengine_v1beta1/types/user_event.py b/google/cloud/recommendationengine_v1beta1/types/user_event.py index 64d1e271..eff2df19 100644 --- a/google/cloud/recommendationengine_v1beta1/types/user_event.py +++ b/google/cloud/recommendationengine_v1beta1/types/user_event.py @@ -389,10 +389,10 @@ class PurchaseTransaction(proto.Message): adjustments to total revenue that you want to include as part of your revenue calculations. This field is not required if the event type is ``refund``. - taxes (Sequence[google.cloud.recommendationengine_v1beta1.types.PurchaseTransaction.TaxesEntry]): + taxes (Mapping[str, float]): Optional. All the taxes associated with the transaction. - costs (Sequence[google.cloud.recommendationengine_v1beta1.types.PurchaseTransaction.CostsEntry]): + costs (Mapping[str, float]): Optional. All the costs associated with the product. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs. diff --git a/samples/generated_samples/snippet_metadata_recommendationengine_v1beta1.json b/samples/generated_samples/snippet_metadata_recommendationengine_v1beta1.json index d911073b..c58bae73 100644 --- a/samples/generated_samples/snippet_metadata_recommendationengine_v1beta1.json +++ b/samples/generated_samples/snippet_metadata_recommendationengine_v1beta1.json @@ -1,16 +1,65 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.recommendationengine.v1beta1", + "version": "v1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-recommendations-ai" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient", + "shortName": "CatalogServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient.create_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.CreateCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "CreateCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.CreateCatalogItemRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "catalog_item", + "type": "google.cloud.recommendationengine_v1beta1.types.CatalogItem" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.CatalogItem", + "shortName": "create_catalog_item" }, + "description": "Sample for CreateCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_create_catalog_item_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_CreateCatalogItem_async", "segments": [ { @@ -43,18 +92,58 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_create_catalog_item_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient", + "shortName": "CatalogServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient.create_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.CreateCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "CreateCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.CreateCatalogItemRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "catalog_item", + "type": "google.cloud.recommendationengine_v1beta1.types.CatalogItem" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.CatalogItem", + "shortName": "create_catalog_item" }, + "description": "Sample for CreateCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_create_catalog_item_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_CreateCatalogItem_sync", "segments": [ { @@ -87,19 +176,54 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_create_catalog_item_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient", + "shortName": "CatalogServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient.delete_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.DeleteCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "DeleteCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.DeleteCatalogItemRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_catalog_item" }, + "description": "Sample for DeleteCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_delete_catalog_item_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_DeleteCatalogItem_async", "segments": [ { @@ -130,18 +254,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_delete_catalog_item_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient", + "shortName": "CatalogServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient.delete_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.DeleteCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "DeleteCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.DeleteCatalogItemRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_catalog_item" }, + "description": "Sample for DeleteCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_delete_catalog_item_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_DeleteCatalogItem_sync", "segments": [ { @@ -172,19 +331,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_delete_catalog_item_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient", + "shortName": "CatalogServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient.get_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.GetCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "GetCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.GetCatalogItemRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.CatalogItem", + "shortName": "get_catalog_item" }, + "description": "Sample for GetCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_get_catalog_item_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_GetCatalogItem_async", "segments": [ { @@ -217,18 +412,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_get_catalog_item_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient", + "shortName": "CatalogServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient.get_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.GetCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "GetCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.GetCatalogItemRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.CatalogItem", + "shortName": "get_catalog_item" }, + "description": "Sample for GetCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_get_catalog_item_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_GetCatalogItem_sync", "segments": [ { @@ -261,19 +492,67 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_get_catalog_item_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient", + "shortName": "CatalogServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient.import_catalog_items", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.ImportCatalogItems", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "ImportCatalogItems" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportCatalogItemsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "request_id", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.recommendationengine_v1beta1.types.InputConfig" + }, + { + "name": "errors_config", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_catalog_items" }, + "description": "Sample for ImportCatalogItems", "file": "recommendationengine_v1beta1_generated_catalog_service_import_catalog_items_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_ImportCatalogItems_async", "segments": [ { @@ -306,18 +585,66 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_import_catalog_items_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient", + "shortName": "CatalogServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient.import_catalog_items", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.ImportCatalogItems", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "ImportCatalogItems" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportCatalogItemsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "request_id", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.recommendationengine_v1beta1.types.InputConfig" + }, + { + "name": "errors_config", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_catalog_items" }, + "description": "Sample for ImportCatalogItems", "file": "recommendationengine_v1beta1_generated_catalog_service_import_catalog_items_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_ImportCatalogItems_sync", "segments": [ { @@ -350,19 +677,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_import_catalog_items_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient", + "shortName": "CatalogServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient.list_catalog_items", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.ListCatalogItems", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "ListCatalogItems" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ListCatalogItemsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "filter", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.catalog_service.pagers.ListCatalogItemsAsyncPager", + "shortName": "list_catalog_items" }, + "description": "Sample for ListCatalogItems", "file": "recommendationengine_v1beta1_generated_catalog_service_list_catalog_items_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_ListCatalogItems_async", "segments": [ { @@ -395,18 +762,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_list_catalog_items_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient", + "shortName": "CatalogServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient.list_catalog_items", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.ListCatalogItems", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "ListCatalogItems" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ListCatalogItemsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "filter", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.catalog_service.pagers.ListCatalogItemsPager", + "shortName": "list_catalog_items" }, + "description": "Sample for ListCatalogItems", "file": "recommendationengine_v1beta1_generated_catalog_service_list_catalog_items_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_ListCatalogItems_sync", "segments": [ { @@ -439,19 +846,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_list_catalog_items_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient", + "shortName": "CatalogServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceAsyncClient.update_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.UpdateCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "UpdateCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.UpdateCatalogItemRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "catalog_item", + "type": "google.cloud.recommendationengine_v1beta1.types.CatalogItem" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.CatalogItem", + "shortName": "update_catalog_item" }, + "description": "Sample for UpdateCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_update_catalog_item_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_UpdateCatalogItem_async", "segments": [ { @@ -484,18 +935,62 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_update_catalog_item_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient", + "shortName": "CatalogServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.CatalogServiceClient.update_catalog_item", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService.UpdateCatalogItem", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.CatalogService", "shortName": "CatalogService" }, "shortName": "UpdateCatalogItem" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.UpdateCatalogItemRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "catalog_item", + "type": "google.cloud.recommendationengine_v1beta1.types.CatalogItem" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.CatalogItem", + "shortName": "update_catalog_item" }, + "description": "Sample for UpdateCatalogItem", "file": "recommendationengine_v1beta1_generated_catalog_service_update_catalog_item_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_CatalogService_UpdateCatalogItem_sync", "segments": [ { @@ -528,19 +1023,59 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_catalog_service_update_catalog_item_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient", + "shortName": "PredictionApiKeyRegistryAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient.create_prediction_api_key_registration", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry.CreatePredictionApiKeyRegistration", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry", "shortName": "PredictionApiKeyRegistry" }, "shortName": "CreatePredictionApiKeyRegistration" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.CreatePredictionApiKeyRegistrationRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "prediction_api_key_registration", + "type": "google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration", + "shortName": "create_prediction_api_key_registration" }, + "description": "Sample for CreatePredictionApiKeyRegistration", "file": "recommendationengine_v1beta1_generated_prediction_api_key_registry_create_prediction_api_key_registration_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionApiKeyRegistry_CreatePredictionApiKeyRegistration_async", "segments": [ { @@ -573,18 +1108,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_api_key_registry_create_prediction_api_key_registration_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryClient", + "shortName": "PredictionApiKeyRegistryClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryClient.create_prediction_api_key_registration", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry.CreatePredictionApiKeyRegistration", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry", "shortName": "PredictionApiKeyRegistry" }, "shortName": "CreatePredictionApiKeyRegistration" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.CreatePredictionApiKeyRegistrationRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "prediction_api_key_registration", + "type": "google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration", + "shortName": "create_prediction_api_key_registration" }, + "description": "Sample for CreatePredictionApiKeyRegistration", "file": "recommendationengine_v1beta1_generated_prediction_api_key_registry_create_prediction_api_key_registration_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionApiKeyRegistry_CreatePredictionApiKeyRegistration_sync", "segments": [ { @@ -617,19 +1192,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_api_key_registry_create_prediction_api_key_registration_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient", + "shortName": "PredictionApiKeyRegistryAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient.delete_prediction_api_key_registration", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry.DeletePredictionApiKeyRegistration", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry", "shortName": "PredictionApiKeyRegistry" }, "shortName": "DeletePredictionApiKeyRegistration" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.DeletePredictionApiKeyRegistrationRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_prediction_api_key_registration" }, + "description": "Sample for DeletePredictionApiKeyRegistration", "file": "recommendationengine_v1beta1_generated_prediction_api_key_registry_delete_prediction_api_key_registration_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionApiKeyRegistry_DeletePredictionApiKeyRegistration_async", "segments": [ { @@ -660,18 +1270,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_api_key_registry_delete_prediction_api_key_registration_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryClient", + "shortName": "PredictionApiKeyRegistryClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryClient.delete_prediction_api_key_registration", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry.DeletePredictionApiKeyRegistration", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry", "shortName": "PredictionApiKeyRegistry" }, "shortName": "DeletePredictionApiKeyRegistration" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.DeletePredictionApiKeyRegistrationRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_prediction_api_key_registration" }, + "description": "Sample for DeletePredictionApiKeyRegistration", "file": "recommendationengine_v1beta1_generated_prediction_api_key_registry_delete_prediction_api_key_registration_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionApiKeyRegistry_DeletePredictionApiKeyRegistration_sync", "segments": [ { @@ -702,19 +1347,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_api_key_registry_delete_prediction_api_key_registration_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient", + "shortName": "PredictionApiKeyRegistryAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient.list_prediction_api_key_registrations", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry.ListPredictionApiKeyRegistrations", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry", "shortName": "PredictionApiKeyRegistry" }, "shortName": "ListPredictionApiKeyRegistrations" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ListPredictionApiKeyRegistrationsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.prediction_api_key_registry.pagers.ListPredictionApiKeyRegistrationsAsyncPager", + "shortName": "list_prediction_api_key_registrations" }, + "description": "Sample for ListPredictionApiKeyRegistrations", "file": "recommendationengine_v1beta1_generated_prediction_api_key_registry_list_prediction_api_key_registrations_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionApiKeyRegistry_ListPredictionApiKeyRegistrations_async", "segments": [ { @@ -747,18 +1428,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_api_key_registry_list_prediction_api_key_registrations_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryClient", + "shortName": "PredictionApiKeyRegistryClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionApiKeyRegistryClient.list_prediction_api_key_registrations", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry.ListPredictionApiKeyRegistrations", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry", "shortName": "PredictionApiKeyRegistry" }, "shortName": "ListPredictionApiKeyRegistrations" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ListPredictionApiKeyRegistrationsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.prediction_api_key_registry.pagers.ListPredictionApiKeyRegistrationsPager", + "shortName": "list_prediction_api_key_registrations" }, + "description": "Sample for ListPredictionApiKeyRegistrations", "file": "recommendationengine_v1beta1_generated_prediction_api_key_registry_list_prediction_api_key_registrations_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionApiKeyRegistry_ListPredictionApiKeyRegistrations_sync", "segments": [ { @@ -791,19 +1508,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_api_key_registry_list_prediction_api_key_registrations_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionServiceAsyncClient", + "shortName": "PredictionServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionServiceAsyncClient.predict", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionService.Predict", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionService", "shortName": "PredictionService" }, "shortName": "Predict" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.PredictRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "user_event", + "type": "google.cloud.recommendationengine_v1beta1.types.UserEvent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.prediction_service.pagers.PredictAsyncPager", + "shortName": "predict" }, + "description": "Sample for Predict", "file": "recommendationengine_v1beta1_generated_prediction_service_predict_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionService_Predict_async", "segments": [ { @@ -836,18 +1593,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_service_predict_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionServiceClient", + "shortName": "PredictionServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.PredictionServiceClient.predict", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionService.Predict", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.PredictionService", "shortName": "PredictionService" }, "shortName": "Predict" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.PredictRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "user_event", + "type": "google.cloud.recommendationengine_v1beta1.types.UserEvent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.prediction_service.pagers.PredictPager", + "shortName": "predict" }, + "description": "Sample for Predict", "file": "recommendationengine_v1beta1_generated_prediction_service_predict_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_PredictionService_Predict_sync", "segments": [ { @@ -880,19 +1677,67 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_prediction_service_predict_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient", + "shortName": "UserEventServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient.collect_user_event", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.CollectUserEvent", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "CollectUserEvent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.CollectUserEventRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "user_event", + "type": "str" + }, + { + "name": "uri", + "type": "str" + }, + { + "name": "ets", + "type": "int" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api.httpbody_pb2.HttpBody", + "shortName": "collect_user_event" }, + "description": "Sample for CollectUserEvent", "file": "recommendationengine_v1beta1_generated_user_event_service_collect_user_event_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_CollectUserEvent_async", "segments": [ { @@ -925,18 +1770,66 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_collect_user_event_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient", + "shortName": "UserEventServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient.collect_user_event", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.CollectUserEvent", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "CollectUserEvent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.CollectUserEventRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "user_event", + "type": "str" + }, + { + "name": "uri", + "type": "str" + }, + { + "name": "ets", + "type": "int" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api.httpbody_pb2.HttpBody", + "shortName": "collect_user_event" }, + "description": "Sample for CollectUserEvent", "file": "recommendationengine_v1beta1_generated_user_event_service_collect_user_event_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_CollectUserEvent_sync", "segments": [ { @@ -969,19 +1862,67 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_collect_user_event_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient", + "shortName": "UserEventServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient.import_user_events", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.ImportUserEvents", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "ImportUserEvents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportUserEventsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "request_id", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.recommendationengine_v1beta1.types.InputConfig" + }, + { + "name": "errors_config", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_user_events" }, + "description": "Sample for ImportUserEvents", "file": "recommendationengine_v1beta1_generated_user_event_service_import_user_events_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_ImportUserEvents_async", "segments": [ { @@ -1014,18 +1955,66 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_import_user_events_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient", + "shortName": "UserEventServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient.import_user_events", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.ImportUserEvents", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "ImportUserEvents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportUserEventsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "request_id", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.recommendationengine_v1beta1.types.InputConfig" + }, + { + "name": "errors_config", + "type": "google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_user_events" }, + "description": "Sample for ImportUserEvents", "file": "recommendationengine_v1beta1_generated_user_event_service_import_user_events_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_ImportUserEvents_sync", "segments": [ { @@ -1058,19 +2047,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_import_user_events_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient", + "shortName": "UserEventServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient.list_user_events", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.ListUserEvents", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "ListUserEvents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ListUserEventsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "filter", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.user_event_service.pagers.ListUserEventsAsyncPager", + "shortName": "list_user_events" }, + "description": "Sample for ListUserEvents", "file": "recommendationengine_v1beta1_generated_user_event_service_list_user_events_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_ListUserEvents_async", "segments": [ { @@ -1103,18 +2132,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_list_user_events_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient", + "shortName": "UserEventServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient.list_user_events", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.ListUserEvents", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "ListUserEvents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.ListUserEventsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "filter", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.services.user_event_service.pagers.ListUserEventsPager", + "shortName": "list_user_events" }, + "description": "Sample for ListUserEvents", "file": "recommendationengine_v1beta1_generated_user_event_service_list_user_events_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_ListUserEvents_sync", "segments": [ { @@ -1147,19 +2216,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_list_user_events_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient", + "shortName": "UserEventServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient.purge_user_events", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.PurgeUserEvents", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "PurgeUserEvents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.PurgeUserEventsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "filter", + "type": "str" + }, + { + "name": "force", + "type": "bool" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "purge_user_events" }, + "description": "Sample for PurgeUserEvents", "file": "recommendationengine_v1beta1_generated_user_event_service_purge_user_events_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_PurgeUserEvents_async", "segments": [ { @@ -1192,18 +2305,62 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_purge_user_events_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient", + "shortName": "UserEventServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient.purge_user_events", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.PurgeUserEvents", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "PurgeUserEvents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.PurgeUserEventsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "filter", + "type": "str" + }, + { + "name": "force", + "type": "bool" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "purge_user_events" }, + "description": "Sample for PurgeUserEvents", "file": "recommendationengine_v1beta1_generated_user_event_service_purge_user_events_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_PurgeUserEvents_sync", "segments": [ { @@ -1236,19 +2393,59 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_purge_user_events_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient", + "shortName": "UserEventServiceAsyncClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceAsyncClient.write_user_event", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.WriteUserEvent", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "WriteUserEvent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.WriteUserEventRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "user_event", + "type": "google.cloud.recommendationengine_v1beta1.types.UserEvent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.UserEvent", + "shortName": "write_user_event" }, + "description": "Sample for WriteUserEvent", "file": "recommendationengine_v1beta1_generated_user_event_service_write_user_event_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_WriteUserEvent_async", "segments": [ { @@ -1281,18 +2478,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_write_user_event_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient", + "shortName": "UserEventServiceClient" + }, + "fullName": "google.cloud.recommendationengine_v1beta1.UserEventServiceClient.write_user_event", "method": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService.WriteUserEvent", "service": { + "fullName": "google.cloud.recommendationengine.v1beta1.UserEventService", "shortName": "UserEventService" }, "shortName": "WriteUserEvent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.recommendationengine_v1beta1.types.WriteUserEventRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "user_event", + "type": "google.cloud.recommendationengine_v1beta1.types.UserEvent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.recommendationengine_v1beta1.types.UserEvent", + "shortName": "write_user_event" }, + "description": "Sample for WriteUserEvent", "file": "recommendationengine_v1beta1_generated_user_event_service_write_user_event_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "recommendationengine_v1beta1_generated_UserEventService_WriteUserEvent_sync", "segments": [ { @@ -1325,7 +2562,8 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "recommendationengine_v1beta1_generated_user_event_service_write_user_event_sync.py" } ] } diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py index e61e231d..60b055d6 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py @@ -102,24 +102,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - CatalogServiceClient, - CatalogServiceAsyncClient, + (CatalogServiceClient, "grpc"), + (CatalogServiceAsyncClient, "grpc_asyncio"), ], ) -def test_catalog_service_client_from_service_account_info(client_class): +def test_catalog_service_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") @pytest.mark.parametrize( @@ -148,27 +148,31 @@ def test_catalog_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - CatalogServiceClient, - CatalogServiceAsyncClient, + (CatalogServiceClient, "grpc"), + (CatalogServiceAsyncClient, "grpc_asyncio"), ], ) -def test_catalog_service_client_from_service_account_file(client_class): +def test_catalog_service_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") def test_catalog_service_client_get_transport_class(): @@ -1582,7 +1586,7 @@ async def test_list_catalog_items_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1630,7 +1634,9 @@ async def test_list_catalog_items_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_catalog_items(request={})).pages: + async for page_ in ( + await client.list_catalog_items(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2542,6 +2548,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = CatalogServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CatalogServiceClient( @@ -2594,6 +2613,14 @@ def test_catalog_service_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_catalog_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2739,24 +2766,40 @@ def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_catalog_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_catalog_service_host_no_port(transport_name): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") -def test_catalog_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_catalog_service_host_with_port(transport_name): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:8000" + assert client.transport._host == ("recommendationengine.googleapis.com:8000") def test_catalog_service_grpc_transport_channel(): diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py index 23471483..ea4d93f3 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py @@ -96,24 +96,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - PredictionApiKeyRegistryClient, - PredictionApiKeyRegistryAsyncClient, + (PredictionApiKeyRegistryClient, "grpc"), + (PredictionApiKeyRegistryAsyncClient, "grpc_asyncio"), ], ) -def test_prediction_api_key_registry_client_from_service_account_info(client_class): +def test_prediction_api_key_registry_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") @pytest.mark.parametrize( @@ -142,27 +144,33 @@ def test_prediction_api_key_registry_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - PredictionApiKeyRegistryClient, - PredictionApiKeyRegistryAsyncClient, + (PredictionApiKeyRegistryClient, "grpc"), + (PredictionApiKeyRegistryAsyncClient, "grpc_asyncio"), ], ) -def test_prediction_api_key_registry_client_from_service_account_file(client_class): +def test_prediction_api_key_registry_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") def test_prediction_api_key_registry_client_get_transport_class(): @@ -1382,7 +1390,7 @@ async def test_list_prediction_api_key_registrations_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1437,7 +1445,7 @@ async def test_list_prediction_api_key_registrations_async_pages(): pages = [] async for page_ in ( await client.list_prediction_api_key_registrations(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1782,6 +1790,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = PredictionApiKeyRegistryClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = PredictionApiKeyRegistryClient( @@ -1826,6 +1847,14 @@ def test_prediction_api_key_registry_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_prediction_api_key_registry_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1975,24 +2004,40 @@ def test_prediction_api_key_registry_grpc_transport_client_cert_source_for_mtls( ) -def test_prediction_api_key_registry_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_prediction_api_key_registry_host_no_port(transport_name): client = PredictionApiKeyRegistryClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") -def test_prediction_api_key_registry_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_prediction_api_key_registry_host_with_port(transport_name): client = PredictionApiKeyRegistryClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:8000" + assert client.transport._host == ("recommendationengine.googleapis.com:8000") def test_prediction_api_key_registry_grpc_transport_channel(): diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py index 90e243a6..86fc7383 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py @@ -97,24 +97,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - PredictionServiceClient, - PredictionServiceAsyncClient, + (PredictionServiceClient, "grpc"), + (PredictionServiceAsyncClient, "grpc_asyncio"), ], ) -def test_prediction_service_client_from_service_account_info(client_class): +def test_prediction_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") @pytest.mark.parametrize( @@ -143,27 +145,33 @@ def test_prediction_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - PredictionServiceClient, - PredictionServiceAsyncClient, + (PredictionServiceClient, "grpc"), + (PredictionServiceAsyncClient, "grpc_asyncio"), ], ) -def test_prediction_service_client_from_service_account_file(client_class): +def test_prediction_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") def test_prediction_service_client_get_transport_class(): @@ -1054,7 +1062,7 @@ async def test_predict_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1103,7 +1111,9 @@ async def test_predict_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.predict(request={})).pages: + async for page_ in ( + await client.predict(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1200,6 +1210,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = PredictionServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = PredictionServiceClient( @@ -1240,6 +1263,14 @@ def test_prediction_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_prediction_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1385,24 +1416,40 @@ def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport ) -def test_prediction_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_prediction_service_host_no_port(transport_name): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") -def test_prediction_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_prediction_service_host_with_port(transport_name): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:8000" + assert client.transport._host == ("recommendationengine.googleapis.com:8000") def test_prediction_service_grpc_transport_channel(): diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py index fecc5556..76fe01a2 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py @@ -105,24 +105,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - UserEventServiceClient, - UserEventServiceAsyncClient, + (UserEventServiceClient, "grpc"), + (UserEventServiceAsyncClient, "grpc_asyncio"), ], ) -def test_user_event_service_client_from_service_account_info(client_class): +def test_user_event_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") @pytest.mark.parametrize( @@ -151,27 +153,33 @@ def test_user_event_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - UserEventServiceClient, - UserEventServiceAsyncClient, + (UserEventServiceClient, "grpc"), + (UserEventServiceAsyncClient, "grpc_asyncio"), ], ) -def test_user_event_service_client_from_service_account_file(client_class): +def test_user_event_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") def test_user_event_service_client_get_transport_class(): @@ -1576,7 +1584,7 @@ async def test_list_user_events_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1622,7 +1630,9 @@ async def test_list_user_events_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_user_events(request={})).pages: + async for page_ in ( + await client.list_user_events(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2274,6 +2284,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = UserEventServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = UserEventServiceClient( @@ -2325,6 +2348,14 @@ def test_user_event_service_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_user_event_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2470,24 +2501,40 @@ def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport ) -def test_user_event_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_user_event_service_host_no_port(transport_name): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:443" + assert client.transport._host == ("recommendationengine.googleapis.com:443") -def test_user_event_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_user_event_service_host_with_port(transport_name): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="recommendationengine.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "recommendationengine.googleapis.com:8000" + assert client.transport._host == ("recommendationengine.googleapis.com:8000") def test_user_event_service_grpc_transport_channel(): From 25aeafdab950b26e6a205735256c318ddcf79307 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 21:25:06 -0400 Subject: [PATCH 08/17] chore(python): add nox session to sort python imports (#144) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- noxfile.py | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bc893c97..7c454abf 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 -# created: 2022-04-06T10:30:21.687684602Z + digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 +# created: 2022-04-20T23:42:53.970438194Z diff --git a/noxfile.py b/noxfile.py index 6ee5e8ab..92da31f8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,7 +25,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +84,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +95,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) From 1646ded1e87c59415ebe5fc7824b314e5ed4067e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 16:24:23 +0000 Subject: [PATCH 09/17] chore(python): use ubuntu 22.04 in docs image (#146) Source-Link: https://github.com/googleapis/synthtool/commit/f15cc72fb401b4861cedebb10af74afe428fb1f8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/docker/docs/Dockerfile | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7c454abf..64f82d6b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 -# created: 2022-04-20T23:42:53.970438194Z + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb8..238b87b9 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] From 3106c77796fe1dc43ecbdb6e38017a0aca71a271 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 28 Apr 2022 07:41:25 -0400 Subject: [PATCH 10/17] chore: use gapic-generator-python 0.65.2 (#147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: https://github.com/googleapis/googleapis/commit/f91b6cf82e929280f6562f6110957c654bd9e2e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/16eb36095c294e712c74a1bf23550817b42174e5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/catalog_service/async_client.py | 36 ++++++------- .../async_client.py | 18 +++---- .../prediction_service/async_client.py | 6 +-- .../user_event_service/async_client.py | 30 +++++------ .../test_catalog_service.py | 50 +++++++++---------- .../test_prediction_api_key_registry.py | 26 +++++----- .../test_prediction_service.py | 10 ++-- .../test_user_event_service.py | 42 ++++++++-------- 8 files changed, 109 insertions(+), 109 deletions(-) diff --git a/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py index 80f21517..7a7bb015 100644 --- a/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/catalog_service/async_client.py @@ -227,9 +227,9 @@ async def create_catalog_item( from google.cloud import recommendationengine_v1beta1 - def sample_create_catalog_item(): + async def sample_create_catalog_item(): # Create a client - client = recommendationengine_v1beta1.CatalogServiceClient() + client = recommendationengine_v1beta1.CatalogServiceAsyncClient() # Initialize request argument(s) catalog_item = recommendationengine_v1beta1.CatalogItem() @@ -243,7 +243,7 @@ def sample_create_catalog_item(): ) # Make the request - response = client.create_catalog_item(request=request) + response = await client.create_catalog_item(request=request) # Handle the response print(response) @@ -345,9 +345,9 @@ async def get_catalog_item( from google.cloud import recommendationengine_v1beta1 - def sample_get_catalog_item(): + async def sample_get_catalog_item(): # Create a client - client = recommendationengine_v1beta1.CatalogServiceClient() + client = recommendationengine_v1beta1.CatalogServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.GetCatalogItemRequest( @@ -355,7 +355,7 @@ def sample_get_catalog_item(): ) # Make the request - response = client.get_catalog_item(request=request) + response = await client.get_catalog_item(request=request) # Handle the response print(response) @@ -451,9 +451,9 @@ async def list_catalog_items( from google.cloud import recommendationengine_v1beta1 - def sample_list_catalog_items(): + async def sample_list_catalog_items(): # Create a client - client = recommendationengine_v1beta1.CatalogServiceClient() + client = recommendationengine_v1beta1.CatalogServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.ListCatalogItemsRequest( @@ -464,7 +464,7 @@ def sample_list_catalog_items(): page_result = client.list_catalog_items(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -581,9 +581,9 @@ async def update_catalog_item( from google.cloud import recommendationengine_v1beta1 - def sample_update_catalog_item(): + async def sample_update_catalog_item(): # Create a client - client = recommendationengine_v1beta1.CatalogServiceClient() + client = recommendationengine_v1beta1.CatalogServiceAsyncClient() # Initialize request argument(s) catalog_item = recommendationengine_v1beta1.CatalogItem() @@ -597,7 +597,7 @@ def sample_update_catalog_item(): ) # Make the request - response = client.update_catalog_item(request=request) + response = await client.update_catalog_item(request=request) # Handle the response print(response) @@ -711,9 +711,9 @@ async def delete_catalog_item( from google.cloud import recommendationengine_v1beta1 - def sample_delete_catalog_item(): + async def sample_delete_catalog_item(): # Create a client - client = recommendationengine_v1beta1.CatalogServiceClient() + client = recommendationengine_v1beta1.CatalogServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.DeleteCatalogItemRequest( @@ -721,7 +721,7 @@ def sample_delete_catalog_item(): ) # Make the request - client.delete_catalog_item(request=request) + await client.delete_catalog_item(request=request) Args: request (Union[google.cloud.recommendationengine_v1beta1.types.DeleteCatalogItemRequest, dict]): @@ -813,9 +813,9 @@ async def import_catalog_items( from google.cloud import recommendationengine_v1beta1 - def sample_import_catalog_items(): + async def sample_import_catalog_items(): # Create a client - client = recommendationengine_v1beta1.CatalogServiceClient() + client = recommendationengine_v1beta1.CatalogServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.ImportCatalogItemsRequest( @@ -827,7 +827,7 @@ def sample_import_catalog_items(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py index c595a82c..d89261ad 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_api_key_registry/async_client.py @@ -244,9 +244,9 @@ async def create_prediction_api_key_registration( from google.cloud import recommendationengine_v1beta1 - def sample_create_prediction_api_key_registration(): + async def sample_create_prediction_api_key_registration(): # Create a client - client = recommendationengine_v1beta1.PredictionApiKeyRegistryClient() + client = recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.CreatePredictionApiKeyRegistrationRequest( @@ -254,7 +254,7 @@ def sample_create_prediction_api_key_registration(): ) # Make the request - response = client.create_prediction_api_key_registration(request=request) + response = await client.create_prediction_api_key_registration(request=request) # Handle the response print(response) @@ -362,9 +362,9 @@ async def list_prediction_api_key_registrations( from google.cloud import recommendationengine_v1beta1 - def sample_list_prediction_api_key_registrations(): + async def sample_list_prediction_api_key_registrations(): # Create a client - client = recommendationengine_v1beta1.PredictionApiKeyRegistryClient() + client = recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.ListPredictionApiKeyRegistrationsRequest( @@ -375,7 +375,7 @@ def sample_list_prediction_api_key_registrations(): page_result = client.list_prediction_api_key_registrations(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -487,9 +487,9 @@ async def delete_prediction_api_key_registration( from google.cloud import recommendationengine_v1beta1 - def sample_delete_prediction_api_key_registration(): + async def sample_delete_prediction_api_key_registration(): # Create a client - client = recommendationengine_v1beta1.PredictionApiKeyRegistryClient() + client = recommendationengine_v1beta1.PredictionApiKeyRegistryAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.DeletePredictionApiKeyRegistrationRequest( @@ -497,7 +497,7 @@ def sample_delete_prediction_api_key_registration(): ) # Make the request - client.delete_prediction_api_key_registration(request=request) + await client.delete_prediction_api_key_registration(request=request) Args: request (Union[google.cloud.recommendationengine_v1beta1.types.DeletePredictionApiKeyRegistrationRequest, dict]): diff --git a/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py index a0d1c771..0becfa2c 100644 --- a/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/prediction_service/async_client.py @@ -223,9 +223,9 @@ async def predict( from google.cloud import recommendationengine_v1beta1 - def sample_predict(): + async def sample_predict(): # Create a client - client = recommendationengine_v1beta1.PredictionServiceClient() + client = recommendationengine_v1beta1.PredictionServiceAsyncClient() # Initialize request argument(s) user_event = recommendationengine_v1beta1.UserEvent() @@ -241,7 +241,7 @@ def sample_predict(): page_result = client.predict(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: diff --git a/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py b/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py index b6251a48..1df4282d 100644 --- a/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py +++ b/google/cloud/recommendationengine_v1beta1/services/user_event_service/async_client.py @@ -228,9 +228,9 @@ async def write_user_event( from google.cloud import recommendationengine_v1beta1 - def sample_write_user_event(): + async def sample_write_user_event(): # Create a client - client = recommendationengine_v1beta1.UserEventServiceClient() + client = recommendationengine_v1beta1.UserEventServiceAsyncClient() # Initialize request argument(s) user_event = recommendationengine_v1beta1.UserEvent() @@ -243,7 +243,7 @@ def sample_write_user_event(): ) # Make the request - response = client.write_user_event(request=request) + response = await client.write_user_event(request=request) # Handle the response print(response) @@ -355,9 +355,9 @@ async def collect_user_event( from google.cloud import recommendationengine_v1beta1 - def sample_collect_user_event(): + async def sample_collect_user_event(): # Create a client - client = recommendationengine_v1beta1.UserEventServiceClient() + client = recommendationengine_v1beta1.UserEventServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.CollectUserEventRequest( @@ -366,7 +366,7 @@ def sample_collect_user_event(): ) # Make the request - response = client.collect_user_event(request=request) + response = await client.collect_user_event(request=request) # Handle the response print(response) @@ -543,9 +543,9 @@ async def list_user_events( from google.cloud import recommendationengine_v1beta1 - def sample_list_user_events(): + async def sample_list_user_events(): # Create a client - client = recommendationengine_v1beta1.UserEventServiceClient() + client = recommendationengine_v1beta1.UserEventServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.ListUserEventsRequest( @@ -556,7 +556,7 @@ def sample_list_user_events(): page_result = client.list_user_events(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -710,9 +710,9 @@ async def purge_user_events( from google.cloud import recommendationengine_v1beta1 - def sample_purge_user_events(): + async def sample_purge_user_events(): # Create a client - client = recommendationengine_v1beta1.UserEventServiceClient() + client = recommendationengine_v1beta1.UserEventServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.PurgeUserEventsRequest( @@ -725,7 +725,7 @@ def sample_purge_user_events(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -879,9 +879,9 @@ async def import_user_events( from google.cloud import recommendationengine_v1beta1 - def sample_import_user_events(): + async def sample_import_user_events(): # Create a client - client = recommendationengine_v1beta1.UserEventServiceClient() + client = recommendationengine_v1beta1.UserEventServiceAsyncClient() # Initialize request argument(s) request = recommendationengine_v1beta1.ImportUserEventsRequest( @@ -893,7 +893,7 @@ def sample_import_user_events(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py index 60b055d6..164045bf 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py @@ -790,7 +790,7 @@ def test_create_catalog_item_field_headers(): # a field header. Set these to a non-empty value. request = catalog_service.CreateCatalogItemRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -808,7 +808,7 @@ def test_create_catalog_item_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -822,7 +822,7 @@ async def test_create_catalog_item_field_headers_async(): # a field header. Set these to a non-empty value. request = catalog_service.CreateCatalogItemRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -840,7 +840,7 @@ async def test_create_catalog_item_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1059,7 +1059,7 @@ def test_get_catalog_item_field_headers(): # a field header. Set these to a non-empty value. request = catalog_service.GetCatalogItemRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_catalog_item), "__call__") as call: @@ -1075,7 +1075,7 @@ def test_get_catalog_item_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1089,7 +1089,7 @@ async def test_get_catalog_item_field_headers_async(): # a field header. Set these to a non-empty value. request = catalog_service.GetCatalogItemRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_catalog_item), "__call__") as call: @@ -1105,7 +1105,7 @@ async def test_get_catalog_item_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1294,7 +1294,7 @@ def test_list_catalog_items_field_headers(): # a field header. Set these to a non-empty value. request = catalog_service.ListCatalogItemsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1312,7 +1312,7 @@ def test_list_catalog_items_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1326,7 +1326,7 @@ async def test_list_catalog_items_field_headers_async(): # a field header. Set these to a non-empty value. request = catalog_service.ListCatalogItemsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1346,7 +1346,7 @@ async def test_list_catalog_items_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1493,7 +1493,7 @@ def test_list_catalog_items_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, catalog.CatalogItem) for i in results) @@ -1770,7 +1770,7 @@ def test_update_catalog_item_field_headers(): # a field header. Set these to a non-empty value. request = catalog_service.UpdateCatalogItemRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1788,7 +1788,7 @@ def test_update_catalog_item_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1802,7 +1802,7 @@ async def test_update_catalog_item_field_headers_async(): # a field header. Set these to a non-empty value. request = catalog_service.UpdateCatalogItemRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1820,7 +1820,7 @@ async def test_update_catalog_item_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2025,7 +2025,7 @@ def test_delete_catalog_item_field_headers(): # a field header. Set these to a non-empty value. request = catalog_service.DeleteCatalogItemRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2043,7 +2043,7 @@ def test_delete_catalog_item_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2057,7 +2057,7 @@ async def test_delete_catalog_item_field_headers_async(): # a field header. Set these to a non-empty value. request = catalog_service.DeleteCatalogItemRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2075,7 +2075,7 @@ async def test_delete_catalog_item_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2261,7 +2261,7 @@ def test_import_catalog_items_field_headers(): # a field header. Set these to a non-empty value. request = import_.ImportCatalogItemsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2279,7 +2279,7 @@ def test_import_catalog_items_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2293,7 +2293,7 @@ async def test_import_catalog_items_field_headers_async(): # a field header. Set these to a non-empty value. request = import_.ImportCatalogItemsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2313,7 +2313,7 @@ async def test_import_catalog_items_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py index ea4d93f3..2a06dad1 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py @@ -807,7 +807,7 @@ def test_create_prediction_api_key_registration_field_headers(): prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest() ) - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -827,7 +827,7 @@ def test_create_prediction_api_key_registration_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -843,7 +843,7 @@ async def test_create_prediction_api_key_registration_field_headers_async(): prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest() ) - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -863,7 +863,7 @@ async def test_create_prediction_api_key_registration_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1095,7 +1095,7 @@ def test_list_prediction_api_key_registrations_field_headers(): prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest() ) - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1115,7 +1115,7 @@ def test_list_prediction_api_key_registrations_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1131,7 +1131,7 @@ async def test_list_prediction_api_key_registrations_field_headers_async(): prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest() ) - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1151,7 +1151,7 @@ async def test_list_prediction_api_key_registrations_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1292,7 +1292,7 @@ def test_list_prediction_api_key_registrations_pager(transport_name: str = "grpc assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance( @@ -1559,7 +1559,7 @@ def test_delete_prediction_api_key_registration_field_headers(): prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest() ) - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1577,7 +1577,7 @@ def test_delete_prediction_api_key_registration_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1593,7 +1593,7 @@ async def test_delete_prediction_api_key_registration_field_headers_async(): prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest() ) - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1611,7 +1611,7 @@ async def test_delete_prediction_api_key_registration_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py index 86fc7383..e4ba87eb 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py @@ -781,7 +781,7 @@ def test_predict_field_headers(): # a field header. Set these to a non-empty value. request = prediction_service.PredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -797,7 +797,7 @@ def test_predict_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -811,7 +811,7 @@ async def test_predict_field_headers_async(): # a field header. Set these to a non-empty value. request = prediction_service.PredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -829,7 +829,7 @@ async def test_predict_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -970,7 +970,7 @@ def test_predict_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, prediction_service.PredictResponse.PredictionResult) diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py index 76fe01a2..a685ca59 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py @@ -782,7 +782,7 @@ def test_write_user_event_field_headers(): # a field header. Set these to a non-empty value. request = user_event_service.WriteUserEventRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.write_user_event), "__call__") as call: @@ -798,7 +798,7 @@ def test_write_user_event_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -812,7 +812,7 @@ async def test_write_user_event_field_headers_async(): # a field header. Set these to a non-empty value. request = user_event_service.WriteUserEventRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.write_user_event), "__call__") as call: @@ -830,7 +830,7 @@ async def test_write_user_event_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1035,7 +1035,7 @@ def test_collect_user_event_field_headers(): # a field header. Set these to a non-empty value. request = user_event_service.CollectUserEventRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1053,7 +1053,7 @@ def test_collect_user_event_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1067,7 +1067,7 @@ async def test_collect_user_event_field_headers_async(): # a field header. Set these to a non-empty value. request = user_event_service.CollectUserEventRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1087,7 +1087,7 @@ async def test_collect_user_event_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1306,7 +1306,7 @@ def test_list_user_events_field_headers(): # a field header. Set these to a non-empty value. request = user_event_service.ListUserEventsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_user_events), "__call__") as call: @@ -1322,7 +1322,7 @@ def test_list_user_events_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1336,7 +1336,7 @@ async def test_list_user_events_field_headers_async(): # a field header. Set these to a non-empty value. request = user_event_service.ListUserEventsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_user_events), "__call__") as call: @@ -1354,7 +1354,7 @@ async def test_list_user_events_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1495,7 +1495,7 @@ def test_list_user_events_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, user_event.UserEvent) for i in results) @@ -1737,7 +1737,7 @@ def test_purge_user_events_field_headers(): # a field header. Set these to a non-empty value. request = user_event_service.PurgeUserEventsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1755,7 +1755,7 @@ def test_purge_user_events_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1769,7 +1769,7 @@ async def test_purge_user_events_field_headers_async(): # a field header. Set these to a non-empty value. request = user_event_service.PurgeUserEventsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1789,7 +1789,7 @@ async def test_purge_user_events_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1997,7 +1997,7 @@ def test_import_user_events_field_headers(): # a field header. Set these to a non-empty value. request = import_.ImportUserEventsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2015,7 +2015,7 @@ def test_import_user_events_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2029,7 +2029,7 @@ async def test_import_user_events_field_headers_async(): # a field header. Set these to a non-empty value. request = import_.ImportUserEventsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2049,7 +2049,7 @@ async def test_import_user_events_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] From 2cf25543f038d3ddafc4280cd48aeadf795dd071 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:58:53 -0400 Subject: [PATCH 11/17] chore: [autoapprove] update readme_gen.py to include autoescape True (#148) Source-Link: https://github.com/googleapis/synthtool/commit/6b4d5a6407d740beb4158b302194a62a4108a8a6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- scripts/readme-gen/readme_gen.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 64f82d6b..b631901e 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd -# created: 2022-04-21T15:43:16.246106921Z + digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 +# created: 2022-05-05T15:17:27.599381182Z diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e9..91b59676 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') From aa06279f9dd75994be2ad89ba845486dd36060ad Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 23:06:22 +0000 Subject: [PATCH 12/17] chore(python): auto approve template changes (#150) Source-Link: https://github.com/googleapis/synthtool/commit/453a5d9c9a55d1969240a37d36cec626d20a9024 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-approve.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/auto-approve.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b631901e..757c9dca 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 -# created: 2022-05-05T15:17:27.599381182Z + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 00000000..311ebbb8 --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" From a140b95e4785a487bf3581058232ccdd76d2cb7c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 17:30:32 +0000 Subject: [PATCH 13/17] chore: use gapic-generator-python 1.0.0 (#151) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 451250442 Source-Link: https://github.com/googleapis/googleapis/commit/cca5e8181f6442b134e8d4d206fbe9e0e74684ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/0b219da161a8bdcc3c6f7b2efcd82105182a30ca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9 --- .../recommendationengine_v1beta1/test_catalog_service.py | 8 +++++++- .../test_prediction_api_key_registry.py | 8 +++++++- .../test_prediction_service.py | 8 +++++++- .../test_user_event_service.py | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py index 164045bf..a1e4a16a 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py index 2a06dad1..01a81365 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py index e4ba87eb..3d7c53d4 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio diff --git a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py index a685ca59..526e791e 100644 --- a/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py +++ b/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio From 53685485b60cca5338a1df7af22c64024cc17167 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 1 Jun 2022 22:37:43 -0400 Subject: [PATCH 14/17] fix(deps): require protobuf <4.0.0dev (#152) --- setup.py | 3 ++- testing/constraints-3.6.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2c22a5e4..8f787195 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,8 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", ), python_requires=">=3.6", classifiers=[ diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index be5a64f3..786e6373 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -6,3 +6,4 @@ # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 +protobuf==3.19.0 From 35a440a1606398fc7fae60c28c21df52058e043b Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:29:00 -0400 Subject: [PATCH 15/17] docs: fix changelog header to consistent size (#153) Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c52344..1728fdd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -### [0.6.1](https://github.com/googleapis/python-recommendations-ai/compare/v0.6.0...v0.6.1) (2022-03-05) +## [0.6.1](https://github.com/googleapis/python-recommendations-ai/compare/v0.6.0...v0.6.1) (2022-03-05) ### Bug Fixes @@ -24,7 +24,7 @@ * add generated snippets ([#122](https://github.com/googleapis/python-recommendations-ai/issues/122)) ([eebbeb6](https://github.com/googleapis/python-recommendations-ai/commit/eebbeb618b6dc62a1103cb6b3cbc9df65630fff3)) -### [0.5.1](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.5.0...v0.5.1) (2021-11-01) +## [0.5.1](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.5.0...v0.5.1) (2021-11-01) ### Bug Fixes @@ -61,14 +61,14 @@ * improper types in pagers generation ([2d73287](https://www.github.com/googleapis/python-recommendations-ai/commit/2d732875566d49e9eed8702a40120c427222d529)) -### [0.3.3](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.3.2...v0.3.3) (2021-09-24) +## [0.3.3](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.3.2...v0.3.3) (2021-09-24) ### Bug Fixes * add 'dict' annotation type to 'request' ([ff8c418](https://www.github.com/googleapis/python-recommendations-ai/commit/ff8c4189e70770b83b84eb0d6cf886104d62d36a)) -### [0.3.2](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.3.1...v0.3.2) (2021-07-28) +## [0.3.2](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.3.1...v0.3.2) (2021-07-28) ### Bug Fixes @@ -85,7 +85,7 @@ * release as 0.3.2 ([#73](https://www.github.com/googleapis/python-recommendations-ai/issues/73)) ([67460b7](https://www.github.com/googleapis/python-recommendations-ai/commit/67460b7c78ebbdbc0b3fd45623a8ff325f1bb86e)) -### [0.3.1](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.3.0...v0.3.1) (2021-07-20) +## [0.3.1](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.3.0...v0.3.1) (2021-07-20) ### Bug Fixes @@ -109,14 +109,14 @@ * omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-recommendations-ai/issues/1127)) ([#55](https://www.github.com/googleapis/python-recommendations-ai/issues/55)) ([47faef8](https://www.github.com/googleapis/python-recommendations-ai/commit/47faef890d8356ce60da06925b92a50f23a34e20)), closes [#1126](https://www.github.com/googleapis/python-recommendations-ai/issues/1126) -### [0.2.2](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.2.1...v0.2.2) (2021-06-16) +## [0.2.2](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.2.1...v0.2.2) (2021-06-16) ### Bug Fixes * exclude docs and tests from package ([#52](https://www.github.com/googleapis/python-recommendations-ai/issues/52)) ([5d4926d](https://www.github.com/googleapis/python-recommendations-ai/commit/5d4926d7220f924ba296098e102d8c64b010ad36)) -### [0.2.1](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.2.0...v0.2.1) (2021-05-28) +## [0.2.1](https://www.github.com/googleapis/python-recommendations-ai/compare/v0.2.0...v0.2.1) (2021-05-28) ### Bug Fixes From 6bc21f874b24d4dbaed32559132c9a49d29544e9 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 6 Jun 2022 11:00:57 -0400 Subject: [PATCH 16/17] chore: test minimum dependencies in python 3.7 (#156) --- testing/constraints-3.7.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index da93009b..786e6373 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,2 +1,9 @@ -# This constraints file is left inentionally empty -# so the latest version of dependencies is installed \ No newline at end of file +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.31.5 +proto-plus==1.15.0 +protobuf==3.19.0 From 74fd56fb7b62a5628fa35db1f7fb8ab3e550f73f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 17:27:42 -0400 Subject: [PATCH 17/17] chore(main): release 0.6.2 (#154) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1728fdd9..6a6a916d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.6.2](https://github.com/googleapis/python-recommendations-ai/compare/v0.6.1...v0.6.2) (2022-06-06) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#152](https://github.com/googleapis/python-recommendations-ai/issues/152)) ([5368548](https://github.com/googleapis/python-recommendations-ai/commit/53685485b60cca5338a1df7af22c64024cc17167)) + + +### Documentation + +* fix changelog header to consistent size ([#153](https://github.com/googleapis/python-recommendations-ai/issues/153)) ([35a440a](https://github.com/googleapis/python-recommendations-ai/commit/35a440a1606398fc7fae60c28c21df52058e043b)) + ## [0.6.1](https://github.com/googleapis/python-recommendations-ai/compare/v0.6.0...v0.6.1) (2022-03-05) diff --git a/setup.py b/setup.py index 8f787195..de4608a9 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "0.6.1" +version = "0.6.2" package_root = os.path.abspath(os.path.dirname(__file__))