Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
fix: remove unnecessary double quotes in strings (#262)
Browse files Browse the repository at this point in the history
Change-Id: I79373e42991c2872ff0f8be215bbfa5b4b460f0c
  • Loading branch information
aribray committed Oct 14, 2021
1 parent 81c2d9a commit fb73bd7
Showing 1 changed file with 21 additions and 41 deletions.
62 changes: 21 additions & 41 deletions google/cloud/automl_v1beta1/services/tables/tables_client.py
Expand Up @@ -207,8 +207,7 @@ def __lookup_by_display_name(self, object_type, items, display_name):
else:
raise ValueError(
(
"Multiple {}s match display_name='{}': {}\n\n"
"Please use the `.name` (unique identifier) field instead"
"Multiple {}s match display_name='{}': {}. Please use the `.name` (unique identifier) field instead."
).format(
object_type,
display_name,
Expand All @@ -220,18 +219,14 @@ def __location_path(self, *, project=None, region=None):
if project is None:
if self.project is None:
raise ValueError(
"Either initialize your client with a value "
"for 'project', or provide 'project' as a "
"parameter for this method."
"Either initialize your client with a value for 'project', or provide 'project' as a parameter for this method."
)
project = self.project

if region is None:
if self.region is None:
raise ValueError(
"Either initialize your client with a value "
"for 'region', or provide 'region' as a "
"parameter for this method."
"Either initialize your client with a value for 'region', or provide 'region' as a parameter for this method."
)
region = self.region

Expand Down Expand Up @@ -259,8 +254,7 @@ def __dataset_from_args(
):
if dataset is None and dataset_display_name is None and dataset_name is None:
raise ValueError(
"One of 'dataset', 'dataset_name' or "
"'dataset_display_name' must be set."
"One of 'dataset', 'dataset_name' or 'dataset_display_name' must be set."
)
# we prefer to make a live call here in the case that the
# dataset object is out-of-date
Expand All @@ -285,7 +279,7 @@ def __model_from_args(
):
if model is None and model_display_name is None and model_name is None:
raise ValueError(
"One of 'model', 'model_name' or " "'model_display_name' must be set."
"One of 'model', 'model_name' or 'model_display_name' must be set."
)
# we prefer to make a live call here in the case that the
# model object is out-of-date
Expand All @@ -310,8 +304,7 @@ def __dataset_name_from_args(
):
if dataset is None and dataset_display_name is None and dataset_name is None:
raise ValueError(
"One of 'dataset', 'dataset_name' or "
"'dataset_display_name' must be set."
"One of 'dataset', 'dataset_name' or 'dataset_display_name' must be set."
)

if dataset_name is None:
Expand Down Expand Up @@ -362,7 +355,7 @@ def __model_name_from_args(
):
if model is None and model_display_name is None and model_name is None:
raise ValueError(
"One of 'model', 'model_name' or " "'model_display_name' must be set."
"One of 'model', 'model_name' or 'model_display_name' must be set."
)

if model_name is None:
Expand Down Expand Up @@ -391,12 +384,7 @@ def __log_operation_info(self, message, op):
pass
_LOGGER.info(
(
"Operation '{}' is running in the background. The returned "
"Operation '{}' can be used to query or block on the status "
"of this operation. Ending your python session will _not_ "
"cancel this operation. Read the documentation here:\n\n"
"\thttps://googleapis.dev/python/google-api-core/latest/operation.html\n\n"
"for more information on the Operation class."
"Operation '{}' is running in the background. The returned Operation '{}' can be used to query or block on the status of this operation. Ending your python session will _not_ cancel this operation. Read the documentation here:\n\n \thttps://googleapis.dev/python/google-api-core/latest/operation.html\n\n for more information on the Operation class."
).format(message, name)
)
return op
Expand Down Expand Up @@ -427,8 +415,7 @@ def __column_spec_name_from_args(
column_specs = {s.display_name: s for s in column_specs}
if column_specs.get(column_spec_display_name) is None:
raise exceptions.NotFound(
"No column with "
+ "column_spec_display_name: '{}' found".format(
"No column with column_spec_display_name: '{}' found".format(
column_spec_display_name
)
)
Expand All @@ -437,13 +424,13 @@ def __column_spec_name_from_args(
column_specs = {s.name: s for s in column_specs}
if column_specs.get(column_spec_name) is None:
raise exceptions.NotFound(
"No column with "
+ "column_spec_name: '{}' found".format(column_spec_name)
"No column with column_spec_name: '{}' found".format(
column_spec_name
)
)
else:
raise ValueError(
"Either supply 'column_spec_name' or "
"'column_spec_display_name' for the column to update"
"Either supply 'column_spec_name' or 'column_spec_display_name' for the column to update"
)

return column_spec_name
Expand Down Expand Up @@ -471,10 +458,10 @@ def __process_request_kwargs(self, request, **kwargs):
Some kwargs are for the request object and others are for
the method itself (retry, metdata).
Args:
request (proto.Message) The request object.
Returns:
dict: kwargs to be added to the method.
"""
Expand Down Expand Up @@ -596,7 +583,7 @@ def get_dataset(
"""
if dataset_name is None and dataset_display_name is None:
raise ValueError(
"One of 'dataset_name' or " "'dataset_display_name' must be set."
"One of 'dataset_name' or 'dataset_display_name' must be set."
)

if dataset_name is not None:
Expand Down Expand Up @@ -2326,18 +2313,15 @@ def create_model(
or train_budget_milli_node_hours > 72000
):
raise ValueError(
"'train_budget_milli_node_hours' must be a "
"value between 1,000 and 72,000 inclusive"
"'train_budget_milli_node_hours' must be a value between 1,000 and 72,000 inclusive"
)

if exclude_column_spec_names not in [
None,
[],
] and include_column_spec_names not in [None, []]:
raise ValueError(
"Cannot set both "
"'exclude_column_spec_names' and "
"'include_column_spec_names'"
"Cannot set both 'exclude_column_spec_names' and 'include_column_spec_names'"
)

dataset_name = self.__dataset_name_from_args(
Expand Down Expand Up @@ -2575,9 +2559,7 @@ def get_model(
ValueError: If required parameters are missing.
"""
if model_name is None and model_display_name is None:
raise ValueError(
"One of 'model_name' or " "'model_display_name' must be set."
)
raise ValueError("One of 'model_name' or 'model_display_name' must be set.")

if model_name is not None:
return self.auto_ml_client.get_model(name=model_name)
Expand Down Expand Up @@ -2824,9 +2806,7 @@ def predict(
if len(inputs) != len(column_specs):
raise ValueError(
(
"Dimension mismatch, the number of provided "
"inputs ({}) does not match that of the model "
"({})"
"Dimension mismatch, the number of provided inputs ({}) does not match that of the model ({})"
).format(len(inputs), len(column_specs))
)

Expand Down Expand Up @@ -2980,7 +2960,7 @@ def batch_predict(
input_request = {"bigquery_source": {"input_uri": bigquery_input_uri}}
else:
raise ValueError(
"One of 'gcs_input_uris'/'bigquery_input_uris' must" "be set"
"One of 'gcs_input_uris'/'bigquery_input_uris' must be set"
)

output_request = None
Expand Down

0 comments on commit fb73bd7

Please sign in to comment.