From 2f9c66144d8fefad9672ec7f13c2165e87c7c2b9 Mon Sep 17 00:00:00 2001 From: dpebot Date: Tue, 6 Nov 2018 05:11:03 -0800 Subject: [PATCH] [CHANGE ME] Re-generated automl to pick up changes in the API or client library generator. --- .../automl_v1beta1/gapic/auto_ml_client.py | 115 ++++++++---------- .../gapic/prediction_service_client.py | 19 ++- .../transports/auto_ml_grpc_transport.py | 42 +++---- 3 files changed, 77 insertions(+), 99 deletions(-) diff --git a/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py b/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py index 493c81f18a20..f4e0ea503938 100644 --- a/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py +++ b/automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py @@ -54,13 +54,13 @@ class AutoMlClient(object): """ AutoML Server API. - The resource names are assigned by the server. - The server never reuses names that it has created after the resources with - those names are deleted. + The resource names are assigned by the server. The server never reuses + names that it has created after the resources with those names are + deleted. An ID of a resource is the last element of the item's resource name. For - ``projects/{project_id}/locations/{location_id}/datasets/{dataset_id}``, then - the id for the item is ``{dataset_id}``. + ``projects/{project_id}/locations/{location_id}/datasets/{dataset_id}``, + then the id for the item is ``{dataset_id}``. """ SERVICE_ADDRESS = 'automl.googleapis.com:443' @@ -199,9 +199,10 @@ def __init__(self, ) if client_info is None: - client_info = ( - google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) - client_info.gapic_version = _GAPIC_LIBRARY_VERSION + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION, ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC @@ -234,7 +235,7 @@ def create_dataset(self, >>> >>> parent = client.location_path('[PROJECT]', '[LOCATION]') >>> - >>> # TODO: Initialize ``dataset``: + >>> # TODO: Initialize `dataset`: >>> dataset = {} >>> >>> response = client.create_dataset(parent, dataset) @@ -242,6 +243,7 @@ def create_dataset(self, Args: parent (str): The resource name of the project to create the dataset for. dataset (Union[dict, ~google.cloud.automl_v1beta1.types.Dataset]): The dataset to create. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.automl_v1beta1.types.Dataset` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -359,7 +361,7 @@ def list_datasets(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_datasets(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_datasets(parent).pages: ... for element in page: ... # process element ... pass @@ -368,13 +370,12 @@ def list_datasets(self, parent (str): The resource name of the project from which to list datasets. filter_ (str): An expression for filtering the results of the request. - * ``dataset_metadata`` - for existence of the case. + - ``dataset_metadata`` - for existence of the case. An example of using the filter is: - * ``translation_dataset_metadata:*`` --> The dataset has - :: - translation_dataset_metadata. + - ``translation_dataset_metadata:*`` --> The dataset has + translation\_dataset\_metadata. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page @@ -438,10 +439,8 @@ def delete_dataset(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Deletes a dataset and all of its contents. - Returns empty response in the - ``response`` field when it completes, - and ``delete_details`` in the + Deletes a dataset and all of its contents. Returns empty response in the + ``response`` field when it completes, and ``delete_details`` in the ``metadata`` field. Example: @@ -511,8 +510,7 @@ def import_data(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Imports data into a dataset. - Returns an empty response in the + Imports data into a dataset. Returns an empty response in the ``response`` field when it completes. Example: @@ -522,7 +520,7 @@ def import_data(self, >>> >>> name = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]') >>> - >>> # TODO: Initialize ``input_config``: + >>> # TODO: Initialize `input_config`: >>> input_config = {} >>> >>> response = client.import_data(name, input_config) @@ -540,6 +538,7 @@ def import_data(self, name (str): Required. Dataset name. Dataset must already exist. All imported annotations and examples will be added. input_config (Union[dict, ~google.cloud.automl_v1beta1.types.InputConfig]): Required. The desired input location. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.automl_v1beta1.types.InputConfig` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -591,9 +590,8 @@ def export_data(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Exports dataset's data to a Google Cloud Storage bucket. - Returns an empty response in the - ``response`` field when it completes. + Exports dataset's data to a Google Cloud Storage bucket. Returns an + empty response in the ``response`` field when it completes. Example: >>> from google.cloud import automl_v1beta1 @@ -602,7 +600,7 @@ def export_data(self, >>> >>> name = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]') >>> - >>> # TODO: Initialize ``output_config``: + >>> # TODO: Initialize `output_config`: >>> output_config = {} >>> >>> response = client.export_data(name, output_config) @@ -619,6 +617,7 @@ def export_data(self, Args: name (str): Required. The resource name of the dataset. output_config (Union[dict, ~google.cloud.automl_v1beta1.types.OutputConfig]): Required. The desired output location. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.automl_v1beta1.types.OutputConfig` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -670,11 +669,10 @@ def create_model(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Creates a model. - Returns a Model in the ``response`` - field when it completes. - When you create a model, several model evaluations are created for it: - a global evaluation, and one evaluation for each annotation spec. + Creates a model. Returns a Model in the ``response`` field when it + completes. When you create a model, several model evaluations are + created for it: a global evaluation, and one evaluation for each + annotation spec. Example: >>> from google.cloud import automl_v1beta1 @@ -683,7 +681,7 @@ def create_model(self, >>> >>> parent = client.location_path('[PROJECT]', '[LOCATION]') >>> - >>> # TODO: Initialize ``model``: + >>> # TODO: Initialize `model`: >>> model = {} >>> >>> response = client.create_model(parent, model) @@ -700,6 +698,7 @@ def create_model(self, Args: parent (str): Resource name of the parent project where the model is being created. model (Union[dict, ~google.cloud.automl_v1beta1.types.Model]): The model to create. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.automl_v1beta1.types.Model` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -823,7 +822,7 @@ def list_models(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_models(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_models(parent).pages: ... for element in page: ... # process element ... pass @@ -832,17 +831,15 @@ def list_models(self, parent (str): Resource name of the project, from which to list the models. filter_ (str): An expression for filtering the results of the request. - * ``model_metadata`` - for existence of the case. - * ``dataset_id`` - for = or !=. + - ``model_metadata`` - for existence of the case. + - ``dataset_id`` - for = or !=. Some examples of using the filter are: - * ``image_classification_model_metadata:*`` --> The model has - :: - image_classification_model_metadata. - * ``dataset_id=5`` --> The model was created from a sibling dataset with - :: - ID 5. + - ``image_classification_model_metadata:*`` --> The model has + image\_classification\_model\_metadata. + - ``dataset_id=5`` --> The model was created from a sibling dataset + with ID 5. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page @@ -905,13 +902,10 @@ def delete_model(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Deletes a model. - If a model is already deployed, this only deletes the model in AutoML BE, - and does not change the status of the deployed model in the production - environment. - Returns ``google.protobuf.Empty`` in the - ``response`` field when it completes, - and ``delete_details`` in the + Deletes a model. If a model is already deployed, this only deletes the + model in AutoML BE, and does not change the status of the deployed model + in the production environment. Returns ``google.protobuf.Empty`` in the + ``response`` field when it completes, and ``delete_details`` in the ``metadata`` field. Example: @@ -980,9 +974,8 @@ def deploy_model(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Deploys model. - Returns a ``DeployModelResponse`` in the - ``response`` field when it completes. + Deploys model. Returns a ``DeployModelResponse`` in the ``response`` + field when it completes. Example: >>> from google.cloud import automl_v1beta1 @@ -1035,8 +1028,7 @@ def undeploy_model(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Undeploys model. - Returns an ``UndeployModelResponse`` in the + Undeploys model. Returns an ``UndeployModelResponse`` in the ``response`` field when it completes. Example: @@ -1164,29 +1156,26 @@ def list_model_evaluations(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_model_evaluations(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_model_evaluations(parent).pages: ... for element in page: ... # process element ... pass Args: parent (str): Resource name of the model to list the model evaluations for. - If modelId is set as \"-\", this will list model evaluations from across all + If modelId is set as "-", this will list model evaluations from across all models of the parent location. filter_ (str): An expression for filtering the results of the request. - * ``annotation_spec_id`` - for =, != or existence. See example below for - :: - the last. + - ``annotation_spec_id`` - for =, != or existence. See example below + for the last. Some examples of using the filter are: - * ``annotation_spec_id!=4`` --> The model evaluation was done for - :: - annotation spec with ID different than 4. - * ``NOT annotation_spec_id:*`` --> The model evaluation was done for - :: - aggregate of all annotation specs. + - ``annotation_spec_id!=4`` --> The model evaluation was done for + annotation spec with ID different than 4. + - ``NOT annotation_spec_id:*`` --> The model evaluation was done for + aggregate of all annotation specs. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page diff --git a/automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py b/automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py index bfad359ae38b..b1d8e0a21cb9 100644 --- a/automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py +++ b/automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py @@ -147,9 +147,10 @@ def __init__(self, ) if client_info is None: - client_info = ( - google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) - client_info.gapic_version = _GAPIC_LIBRARY_VERSION + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION, ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC @@ -183,7 +184,7 @@ def predict(self, >>> >>> name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]') >>> - >>> # TODO: Initialize ``payload``: + >>> # TODO: Initialize `payload`: >>> payload = {} >>> >>> response = client.predict(name, payload) @@ -193,19 +194,17 @@ def predict(self, payload (Union[dict, ~google.cloud.automl_v1beta1.types.ExamplePayload]): Required. Payload to perform a prediction on. The payload must match the problem type that the model was trained to solve. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.automl_v1beta1.types.ExamplePayload` params (dict[str -> str]): Additional domain-specific parameters, any string must be up to 25000 characters long. - * For Image Classification: + - For Image Classification: ``score_threshold`` - (float) A value from 0.0 to 1.0. When the model - - - makes predictions for an - image, it will only produce results that have at least this confidence - score threshold. The default is 0.5. + makes predictions for an image, it will only produce results that + have at least this confidence score threshold. The default is 0.5. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. diff --git a/automl/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py b/automl/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py index 4622fff4d3af..a6b5e777c4b5 100644 --- a/automl/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py +++ b/automl/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py @@ -141,10 +141,8 @@ def list_datasets(self): def delete_dataset(self): """Return the gRPC stub for {$apiMethod.name}. - Deletes a dataset and all of its contents. - Returns empty response in the - ``response`` field when it completes, - and ``delete_details`` in the + Deletes a dataset and all of its contents. Returns empty response in the + ``response`` field when it completes, and ``delete_details`` in the ``metadata`` field. Returns: @@ -158,8 +156,7 @@ def delete_dataset(self): def import_data(self): """Return the gRPC stub for {$apiMethod.name}. - Imports data into a dataset. - Returns an empty response in the + Imports data into a dataset. Returns an empty response in the ``response`` field when it completes. Returns: @@ -173,9 +170,8 @@ def import_data(self): def export_data(self): """Return the gRPC stub for {$apiMethod.name}. - Exports dataset's data to a Google Cloud Storage bucket. - Returns an empty response in the - ``response`` field when it completes. + Exports dataset's data to a Google Cloud Storage bucket. Returns an + empty response in the ``response`` field when it completes. Returns: Callable: A callable which accepts the appropriate @@ -188,11 +184,10 @@ def export_data(self): def create_model(self): """Return the gRPC stub for {$apiMethod.name}. - Creates a model. - Returns a Model in the ``response`` - field when it completes. - When you create a model, several model evaluations are created for it: - a global evaluation, and one evaluation for each annotation spec. + Creates a model. Returns a Model in the ``response`` field when it + completes. When you create a model, several model evaluations are + created for it: a global evaluation, and one evaluation for each + annotation spec. Returns: Callable: A callable which accepts the appropriate @@ -231,13 +226,10 @@ def list_models(self): def delete_model(self): """Return the gRPC stub for {$apiMethod.name}. - Deletes a model. - If a model is already deployed, this only deletes the model in AutoML BE, - and does not change the status of the deployed model in the production - environment. - Returns ``google.protobuf.Empty`` in the - ``response`` field when it completes, - and ``delete_details`` in the + Deletes a model. If a model is already deployed, this only deletes the + model in AutoML BE, and does not change the status of the deployed model + in the production environment. Returns ``google.protobuf.Empty`` in the + ``response`` field when it completes, and ``delete_details`` in the ``metadata`` field. Returns: @@ -251,9 +243,8 @@ def delete_model(self): def deploy_model(self): """Return the gRPC stub for {$apiMethod.name}. - Deploys model. - Returns a ``DeployModelResponse`` in the - ``response`` field when it completes. + Deploys model. Returns a ``DeployModelResponse`` in the ``response`` + field when it completes. Returns: Callable: A callable which accepts the appropriate @@ -266,8 +257,7 @@ def deploy_model(self): def undeploy_model(self): """Return the gRPC stub for {$apiMethod.name}. - Undeploys model. - Returns an ``UndeployModelResponse`` in the + Undeploys model. Returns an ``UndeployModelResponse`` in the ``response`` field when it completes. Returns: