From 7507bff2d1fdd349ad3d3aa158c305684619793e Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 10 Mar 2022 22:23:13 +0000 Subject: [PATCH 1/2] chore(deps): allow google-api-core v2 on v1 release --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e6af67da..029c0461 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ version = "1.0.1" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.14.0, < 2.0.0dev", + "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", 'enum34; python_version < "3.4"', ] extras = { From c401fe81e2be94c5a243f6d9ec5b39d663ef7e00 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Fri, 1 Apr 2022 19:52:05 +0000 Subject: [PATCH 2/2] chore: update black version --- docs/conf.py | 12 +- .../gapic/prediction_service_client.py | 6 +- .../proto/prediction_service_pb2_grpc.py | 72 +++--- .../cloud/automl_v1/proto/service_pb2_grpc.py | 155 ++++++------- .../gapic/prediction_service_client.py | 6 +- .../proto/prediction_service_pb2_grpc.py | 82 +++---- .../automl_v1beta1/proto/service_pb2_grpc.py | 205 ++++++++---------- .../automl_v1beta1/tables/tables_client.py | 16 +- noxfile.py | 2 +- 9 files changed, 268 insertions(+), 288 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0b6aebeb..d8c4ea10 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -65,9 +65,9 @@ master_doc = "index" # General information about the project. -project = u"google-cloud-automl" -copyright = u"2019, Google" -author = u"Google APIs" +project = "google-cloud-automl" +copyright = "2019, Google" +author = "Google APIs" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -261,7 +261,7 @@ ( master_doc, "google-cloud-automl.tex", - u"google-cloud-automl Documentation", + "google-cloud-automl Documentation", author, "manual", ) @@ -296,7 +296,7 @@ ( master_doc, "google-cloud-automl", - u"google-cloud-automl Documentation", + "google-cloud-automl Documentation", [author], 1, ) @@ -315,7 +315,7 @@ ( master_doc, "google-cloud-automl", - u"google-cloud-automl Documentation", + "google-cloud-automl Documentation", author, "google-cloud-automl", "google-cloud-automl Library", diff --git a/google/cloud/automl_v1/gapic/prediction_service_client.py b/google/cloud/automl_v1/gapic/prediction_service_client.py index d6df5e54..b3c23621 100644 --- a/google/cloud/automl_v1/gapic/prediction_service_client.py +++ b/google/cloud/automl_v1/gapic/prediction_service_client.py @@ -185,8 +185,10 @@ def __init__( ) self.transport = transport else: - self.transport = prediction_service_grpc_transport.PredictionServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + self.transport = ( + prediction_service_grpc_transport.PredictionServiceGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) ) if client_info is None: diff --git a/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py b/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py index 1970e0b2..03418f2a 100644 --- a/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py +++ b/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py @@ -12,16 +12,16 @@ class PredictionServiceStub(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.Predict = channel.unary_unary( "/google.cloud.automl.v1.PredictionService/Predict", request_serializer=google_dot_cloud_dot_automl__v1_dot_proto_dot_prediction__service__pb2.PredictRequest.SerializeToString, @@ -37,45 +37,45 @@ def __init__(self, channel): class PredictionServiceServicer(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def Predict(self, request, context): """Perform an online prediction. The prediction result will be directly - returned in the response. - Available for following ML problems, and their expected request payloads: - * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Text Classification - TextSnippet, content up to 60,000 characters, - UTF-8 encoded. - * Text Extraction - TextSnippet, content up to 30,000 characters, - UTF-8 NFC encoded. - * Translation - TextSnippet, content up to 25,000 characters, UTF-8 - encoded. - * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 - encoded. - """ + returned in the response. + Available for following ML problems, and their expected request payloads: + * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Text Classification - TextSnippet, content up to 60,000 characters, + UTF-8 encoded. + * Text Extraction - TextSnippet, content up to 30,000 characters, + UTF-8 NFC encoded. + * Translation - TextSnippet, content up to 25,000 characters, UTF-8 + encoded. + * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 + encoded. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def BatchPredict(self, request, context): """Perform a batch prediction. Unlike the online - [Predict][google.cloud.automl.v1.PredictionService.Predict], batch - prediction result won't be immediately available in the response. Instead, - a long running operation object is returned. User can poll the operation - result via [GetOperation][google.longrunning.Operations.GetOperation] - method. Once the operation is done, - [BatchPredictResult][google.cloud.automl.v1.BatchPredictResult] is returned - in the [response][google.longrunning.Operation.response] field. Available - for following ML problems: - * Image Classification - * Image Object Detection - * Text Extraction - """ + [Predict][google.cloud.automl.v1.PredictionService.Predict], batch + prediction result won't be immediately available in the response. Instead, + a long running operation object is returned. User can poll the operation + result via [GetOperation][google.longrunning.Operations.GetOperation] + method. Once the operation is done, + [BatchPredictResult][google.cloud.automl.v1.BatchPredictResult] is returned + in the [response][google.longrunning.Operation.response] field. Available + for following ML problems: + * Image Classification + * Image Object Detection + * Text Extraction + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1/proto/service_pb2_grpc.py b/google/cloud/automl_v1/proto/service_pb2_grpc.py index 0ad90914..d45d47e2 100644 --- a/google/cloud/automl_v1/proto/service_pb2_grpc.py +++ b/google/cloud/automl_v1/proto/service_pb2_grpc.py @@ -24,26 +24,26 @@ class AutoMlStub(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}`. + 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}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.CreateDataset = channel.unary_unary( "/google.cloud.automl.v1.AutoMl/CreateDataset", request_serializer=google_dot_cloud_dot_automl__v1_dot_proto_dot_service__pb2.CreateDatasetRequest.SerializeToString, @@ -139,139 +139,130 @@ def __init__(self, channel): class AutoMlServicer(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}`. + 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}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def CreateDataset(self, request, context): - """Creates a dataset. - """ + """Creates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetDataset(self, request, context): - """Gets a dataset. - """ + """Gets a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListDatasets(self, request, context): - """Lists datasets in a project. - """ + """Lists datasets in a project.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateDataset(self, request, context): - """Updates a dataset. - """ + """Updates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteDataset(self, request, context): """Deletes a dataset and all of its contents. - Returns empty response in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns empty response in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ImportData(self, request, context): - """Imports data into a dataset. - """ + """Imports data into a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportData(self, request, context): """Exports dataset's data to the provided output location. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetAnnotationSpec(self, request, context): - """Gets an annotation spec. - """ + """Gets an annotation spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def CreateModel(self, request, context): """Creates a model. - Returns a Model in the [response][google.longrunning.Operation.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 a Model in the [response][google.longrunning.Operation.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. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModel(self, request, context): - """Gets a model. - """ + """Gets a model.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModels(self, request, context): - """Lists models. - """ + """Lists models.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteModel(self, request, context): """Deletes a model. - Returns `google.protobuf.Empty` in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns `google.protobuf.Empty` in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateModel(self, request, context): - """Updates a model. - """ + """Updates a model.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeployModel(self, request, context): """Deploys a model. If a model is already deployed, deploying it with the - same parameters has no effect. Deploying with different parametrs - (as e.g. changing + same parameters has no effect. Deploying with different parametrs + (as e.g. changing - [node_number][google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata.node_number]) - will reset the deployment state without pausing the model's availability. + [node_number][google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata.node_number]) + will reset the deployment state without pausing the model's availability. - Only applicable for Text Classification, Image Object Detection; all other - domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection; all other + domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -279,39 +270,37 @@ def DeployModel(self, request, context): def UndeployModel(self, request, context): """Undeploys a model. If the model is not deployed this method has no effect. - Only applicable for Text Classification, Image Object Detection; - all other domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection; + all other domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportModel(self, request, context): """Exports a trained, "export-able", model to a user specified Google Cloud - Storage location. A model is considered export-able if and only if it has - an export format defined for it in - [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. + Storage location. A model is considered export-able if and only if it has + an export format defined for it in + [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModelEvaluation(self, request, context): - """Gets a model evaluation. - """ + """Gets a model evaluation.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModelEvaluations(self, request, context): - """Lists model evaluations. - """ + """Lists model evaluations.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1beta1/gapic/prediction_service_client.py b/google/cloud/automl_v1beta1/gapic/prediction_service_client.py index 57cedc90..14888426 100644 --- a/google/cloud/automl_v1beta1/gapic/prediction_service_client.py +++ b/google/cloud/automl_v1beta1/gapic/prediction_service_client.py @@ -189,8 +189,10 @@ def __init__( ) self.transport = transport else: - self.transport = prediction_service_grpc_transport.PredictionServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + self.transport = ( + prediction_service_grpc_transport.PredictionServiceGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) ) if client_info is None: diff --git a/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py b/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py index 8049017e..39d41bb1 100644 --- a/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py +++ b/google/cloud/automl_v1beta1/proto/prediction_service_pb2_grpc.py @@ -12,16 +12,16 @@ class PredictionServiceStub(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.Predict = channel.unary_unary( "/google.cloud.automl.v1beta1.PredictionService/Predict", request_serializer=google_dot_cloud_dot_automl__v1beta1_dot_proto_dot_prediction__service__pb2.PredictRequest.SerializeToString, @@ -37,51 +37,51 @@ def __init__(self, channel): class PredictionServiceServicer(object): """AutoML Prediction API. - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def Predict(self, request, context): """Perform an online prediction. The prediction result will be directly - returned in the response. - Available for following ML problems, and their expected request payloads: - * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes - up to 30MB. - * Text Classification - TextSnippet, content up to 60,000 characters, - UTF-8 encoded. - * Text Extraction - TextSnippet, content up to 30,000 characters, - UTF-8 NFC encoded. - * Translation - TextSnippet, content up to 25,000 characters, UTF-8 - encoded. - * Tables - Row, with column values matching the columns of the model, - up to 5MB. Not available for FORECASTING + returned in the response. + Available for following ML problems, and their expected request payloads: + * Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes + up to 30MB. + * Text Classification - TextSnippet, content up to 60,000 characters, + UTF-8 encoded. + * Text Extraction - TextSnippet, content up to 30,000 characters, + UTF-8 NFC encoded. + * Translation - TextSnippet, content up to 25,000 characters, UTF-8 + encoded. + * Tables - Row, with column values matching the columns of the model, + up to 5MB. Not available for FORECASTING - [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]. - * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 - encoded. - """ + [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]. + * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 + encoded. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def BatchPredict(self, request, context): """Perform a batch prediction. Unlike the online - [Predict][google.cloud.automl.v1beta1.PredictionService.Predict], batch - prediction result won't be immediately available in the response. Instead, - a long running operation object is returned. User can poll the operation - result via [GetOperation][google.longrunning.Operations.GetOperation] - method. Once the operation is done, - [BatchPredictResult][google.cloud.automl.v1beta1.BatchPredictResult] is - returned in the [response][google.longrunning.Operation.response] field. - Available for following ML problems: - * Image Classification - * Image Object Detection - * Video Classification - * Video Object Tracking * Text Extraction - * Tables - """ + [Predict][google.cloud.automl.v1beta1.PredictionService.Predict], batch + prediction result won't be immediately available in the response. Instead, + a long running operation object is returned. User can poll the operation + result via [GetOperation][google.longrunning.Operations.GetOperation] + method. Once the operation is done, + [BatchPredictResult][google.cloud.automl.v1beta1.BatchPredictResult] is + returned in the [response][google.longrunning.Operation.response] field. + Available for following ML problems: + * Image Classification + * Image Object Detection + * Video Classification + * Video Object Tracking * Text Extraction + * Tables + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py b/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py index eb049c20..c162e8c4 100644 --- a/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py +++ b/google/cloud/automl_v1beta1/proto/service_pb2_grpc.py @@ -30,26 +30,26 @@ class AutoMlStub(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}`. + 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}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.CreateDataset = channel.unary_unary( "/google.cloud.automl.v1beta1.AutoMl/CreateDataset", request_serializer=google_dot_cloud_dot_automl__v1beta1_dot_proto_dot_service__pb2.CreateDatasetRequest.SerializeToString, @@ -175,181 +175,168 @@ def __init__(self, channel): class AutoMlServicer(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}`. + 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}`. - Currently the only supported `location_id` is "us-central1". + Currently the only supported `location_id` is "us-central1". - On any input that is documented to expect a string parameter in - snake_case or kebab-case, either of those cases is accepted. - """ + On any input that is documented to expect a string parameter in + snake_case or kebab-case, either of those cases is accepted. + """ def CreateDataset(self, request, context): - """Creates a dataset. - """ + """Creates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetDataset(self, request, context): - """Gets a dataset. - """ + """Gets a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListDatasets(self, request, context): - """Lists datasets in a project. - """ + """Lists datasets in a project.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateDataset(self, request, context): - """Updates a dataset. - """ + """Updates a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteDataset(self, request, context): """Deletes a dataset and all of its contents. - Returns empty response in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns empty response in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ImportData(self, request, context): """Imports data into a dataset. - For Tables this method can only be called on an empty Dataset. - - For Tables: - * A - [schema_inference_version][google.cloud.automl.v1beta1.InputConfig.params] - parameter must be explicitly set. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + For Tables this method can only be called on an empty Dataset. + + For Tables: + * A + [schema_inference_version][google.cloud.automl.v1beta1.InputConfig.params] + parameter must be explicitly set. + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportData(self, request, context): """Exports dataset's data to the provided output location. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetAnnotationSpec(self, request, context): - """Gets an annotation spec. - """ + """Gets an annotation spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetTableSpec(self, request, context): - """Gets a table spec. - """ + """Gets a table spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListTableSpecs(self, request, context): - """Lists table specs in a dataset. - """ + """Lists table specs in a dataset.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateTableSpec(self, request, context): - """Updates a table spec. - """ + """Updates a table spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetColumnSpec(self, request, context): - """Gets a column spec. - """ + """Gets a column spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListColumnSpecs(self, request, context): - """Lists column specs in a table spec. - """ + """Lists column specs in a table spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def UpdateColumnSpec(self, request, context): - """Updates a column spec. - """ + """Updates a column spec.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def CreateModel(self, request, context): """Creates a model. - Returns a Model in the [response][google.longrunning.Operation.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 a Model in the [response][google.longrunning.Operation.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. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModel(self, request, context): - """Gets a model. - """ + """Gets a model.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModels(self, request, context): - """Lists models. - """ + """Lists models.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeleteModel(self, request, context): """Deletes a model. - Returns `google.protobuf.Empty` in the - [response][google.longrunning.Operation.response] field when it completes, - and `delete_details` in the - [metadata][google.longrunning.Operation.metadata] field. - """ + Returns `google.protobuf.Empty` in the + [response][google.longrunning.Operation.response] field when it completes, + and `delete_details` in the + [metadata][google.longrunning.Operation.metadata] field. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def DeployModel(self, request, context): """Deploys a model. If a model is already deployed, deploying it with the - same parameters has no effect. Deploying with different parametrs - (as e.g. changing + same parameters has no effect. Deploying with different parametrs + (as e.g. changing - [node_number][google.cloud.automl.v1beta1.ImageObjectDetectionModelDeploymentMetadata.node_number]) - will reset the deployment state without pausing the model's availability. + [node_number][google.cloud.automl.v1beta1.ImageObjectDetectionModelDeploymentMetadata.node_number]) + will reset the deployment state without pausing the model's availability. - Only applicable for Text Classification, Image Object Detection and Tables; all other domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection and Tables; all other domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -357,60 +344,58 @@ def DeployModel(self, request, context): def UndeployModel(self, request, context): """Undeploys a model. If the model is not deployed this method has no effect. - Only applicable for Text Classification, Image Object Detection and Tables; - all other domains manage deployment automatically. + Only applicable for Text Classification, Image Object Detection and Tables; + all other domains manage deployment automatically. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportModel(self, request, context): """Exports a trained, "export-able", model to a user specified Google Cloud - Storage location. A model is considered export-able if and only if it has - an export format defined for it in + Storage location. A model is considered export-able if and only if it has + an export format defined for it in - [ModelExportOutputConfig][google.cloud.automl.v1beta1.ModelExportOutputConfig]. + [ModelExportOutputConfig][google.cloud.automl.v1beta1.ModelExportOutputConfig]. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportEvaluatedExamples(self, request, context): """Exports examples on which the model was evaluated (i.e. which were in the - TEST set of the dataset the model was created from), together with their - ground truth annotations and the annotations created (predicted) by the - model. - The examples, ground truth and predictions are exported in the state - they were at the moment the model was evaluated. + TEST set of the dataset the model was created from), together with their + ground truth annotations and the annotations created (predicted) by the + model. + The examples, ground truth and predictions are exported in the state + they were at the moment the model was evaluated. - This export is available only for 30 days since the model evaluation is - created. + This export is available only for 30 days since the model evaluation is + created. - Currently only available for Tables. + Currently only available for Tables. - Returns an empty response in the - [response][google.longrunning.Operation.response] field when it completes. - """ + Returns an empty response in the + [response][google.longrunning.Operation.response] field when it completes. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def GetModelEvaluation(self, request, context): - """Gets a model evaluation. - """ + """Gets a model evaluation.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ListModelEvaluations(self, request, context): - """Lists model evaluations. - """ + """Lists model evaluations.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") diff --git a/google/cloud/automl_v1beta1/tables/tables_client.py b/google/cloud/automl_v1beta1/tables/tables_client.py index 378eca61..fd36c327 100644 --- a/google/cloud/automl_v1beta1/tables/tables_client.py +++ b/google/cloud/automl_v1beta1/tables/tables_client.py @@ -35,12 +35,12 @@ def to_proto_value(value): """translates a Python value to a google.protobuf.Value. - Args: - value: The Python value to be translated. + Args: + value: The Python value to be translated. - Returns: - Tuple of the translated google.protobuf.Value and error if any. - """ + Returns: + Tuple of the translated google.protobuf.Value and error if any. + """ # possible Python types (this is a Python3 module): # https://simplejson.readthedocs.io/en/latest/#encoders-and-decoders # JSON Python 2 Python 3 @@ -183,8 +183,10 @@ def __init__( self.auto_ml_client = client if prediction_client is None: - self.prediction_client = gapic.prediction_service_client.PredictionServiceClient( - credentials=credentials, client_info=client_info_, **kwargs + self.prediction_client = ( + gapic.prediction_service_client.PredictionServiceClient( + credentials=credentials, client_info=client_info_, **kwargs + ) ) else: self.prediction_client = prediction_client diff --git a/noxfile.py b/noxfile.py index dfccb58c..e1a03258 100644 --- a/noxfile.py +++ b/noxfile.py @@ -23,7 +23,7 @@ import nox -BLACK_VERSION = "black==19.3b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] if os.path.exists("samples"):