Skip to content

Commit c7bfd80

Browse files
chore(python): use black==22.3.0 (googleapis#1107)
Source-Link: googleapis/synthtool@6fab84a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Morgan Du <[email protected]>
1 parent d5ae1b9 commit c7bfd80

443 files changed

Lines changed: 39763 additions & 11987 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/.OwlBot.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae
16+
digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe

docs/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@
361361
intersphinx_mapping = {
362362
"python": ("https://python.readthedocs.org/en/latest/", None),
363363
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
364-
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
364+
"google.api_core": (
365+
"https://googleapis.dev/python/google-api-core/latest/",
366+
None,
367+
),
365368
"grpc": ("https://grpc.github.io/grpc/python/", None),
366369
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
367370
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),

google/cloud/aiplatform/datasets/dataset.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ def _create_and_import(
351351

352352
def _import_and_wait(self, datasource):
353353
_LOGGER.log_action_start_against_resource(
354-
"Importing", "data", self,
354+
"Importing",
355+
"data",
356+
self,
355357
)
356358

357359
import_lro = self._import(datasource=datasource)
@@ -435,7 +437,8 @@ def _create(
435437
)
436438

437439
def _import(
438-
self, datasource: _datasources.DatasourceImportable,
440+
self,
441+
datasource: _datasources.DatasourceImportable,
439442
) -> operation.Operation:
440443
"""Imports data into managed dataset by directly calling API client.
441444

google/cloud/aiplatform/explain/lit.py

Lines changed: 130 additions & 126 deletions
Large diffs are not rendered by default.

google/cloud/aiplatform/explain/metadata/tf/v1/saved_model_metadata_builder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def get_metadata_protobuf(self) -> explanation_metadata.ExplanationMetadata:
120120
ExplanationMetadata object format of the explanation metadata.
121121
"""
122122
return explanation_metadata.ExplanationMetadata(
123-
inputs=self._inputs, outputs=self._outputs,
123+
inputs=self._inputs,
124+
outputs=self._outputs,
124125
)
125126

126127

google/cloud/aiplatform/explain/metadata/tf/v2/saved_model_metadata_builder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,6 @@ def get_metadata_protobuf(self) -> explanation_metadata.ExplanationMetadata:
134134
ExplanationMetadata object format of the explanation metadata.
135135
"""
136136
return explanation_metadata.ExplanationMetadata(
137-
inputs=self._inputs, outputs=self._outputs,
137+
inputs=self._inputs,
138+
outputs=self._outputs,
138139
)

google/cloud/aiplatform/featurestore/entity_type.py

Lines changed: 85 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def __init__(
120120
)
121121

122122
self._featurestore_online_client = self._instantiate_featurestore_online_client(
123-
location=self.location, credentials=credentials,
123+
location=self.location,
124+
credentials=credentials,
124125
)
125126

126127
def _get_featurestore_name(self) -> str:
@@ -231,11 +232,15 @@ def update(
231232
update_mask = field_mask_pb2.FieldMask(paths=update_mask)
232233

233234
gapic_entity_type = gca_entity_type.EntityType(
234-
name=self.resource_name, description=description, labels=labels,
235+
name=self.resource_name,
236+
description=description,
237+
labels=labels,
235238
)
236239

237240
_LOGGER.log_action_start_against_resource(
238-
"Updating", "entityType", self,
241+
"Updating",
242+
"entityType",
243+
self,
239244
)
240245

241246
update_entity_type_lro = self.api_client.update_entity_type(
@@ -347,7 +352,9 @@ def list(
347352
)
348353

349354
def list_features(
350-
self, filter: Optional[str] = None, order_by: Optional[str] = None,
355+
self,
356+
filter: Optional[str] = None,
357+
order_by: Optional[str] = None,
351358
) -> List["featurestore.Feature"]:
352359
"""Lists existing managed feature resources in this EntityType.
353360
@@ -399,11 +406,17 @@ def list_features(
399406
"""
400407
self.wait()
401408
return featurestore.Feature.list(
402-
entity_type_name=self.resource_name, filter=filter, order_by=order_by,
409+
entity_type_name=self.resource_name,
410+
filter=filter,
411+
order_by=order_by,
403412
)
404413

405414
@base.optional_sync()
406-
def delete_features(self, feature_ids: List[str], sync: bool = True,) -> None:
415+
def delete_features(
416+
self,
417+
feature_ids: List[str],
418+
sync: bool = True,
419+
) -> None:
407420
"""Deletes feature resources in this EntityType given their feature IDs.
408421
WARNING: This deletion is permanent.
409422
@@ -558,7 +571,8 @@ def create(
558571
gapic_entity_type.description = description
559572

560573
api_client = cls._instantiate_client(
561-
location=featurestore_name_components["location"], credentials=credentials,
574+
location=featurestore_name_components["location"],
575+
credentials=credentials,
562576
)
563577

564578
created_entity_type_lro = api_client.create_entity_type(
@@ -659,7 +673,7 @@ def _validate_and_get_create_feature_requests(
659673
self,
660674
feature_configs: Dict[str, Dict[str, Union[bool, int, Dict[str, str], str]]],
661675
) -> List[gca_featurestore_service.CreateFeatureRequest]:
662-
""" Validates feature_configs and get requests for batch feature creation
676+
"""Validates feature_configs and get requests for batch feature creation
663677
664678
Args:
665679
feature_configs (Dict[str, Dict[str, Union[bool, int, Dict[str, str], str]]]):
@@ -756,7 +770,9 @@ def batch_create_features(
756770
)
757771

758772
_LOGGER.log_action_start_against_resource(
759-
"Batch creating features", "entityType", self,
773+
"Batch creating features",
774+
"entityType",
775+
self,
760776
)
761777

762778
batch_created_features_lro = self.api_client.batch_create_features(
@@ -861,12 +877,14 @@ def _validate_and_get_import_feature_values_request(
861877
for feature_id in set(feature_ids)
862878
]
863879

864-
import_feature_values_request = gca_featurestore_service.ImportFeatureValuesRequest(
865-
entity_type=entity_type_name,
866-
feature_specs=feature_specs,
867-
entity_id_field=entity_id_field,
868-
disable_online_serving=disable_online_serving,
869-
worker_count=worker_count,
880+
import_feature_values_request = (
881+
gca_featurestore_service.ImportFeatureValuesRequest(
882+
entity_type=entity_type_name,
883+
feature_specs=feature_specs,
884+
entity_id_field=entity_id_field,
885+
disable_online_serving=disable_online_serving,
886+
worker_count=worker_count,
887+
)
870888
)
871889

872890
if isinstance(data_source, gca_io.AvroSource):
@@ -913,11 +931,14 @@ def _import_feature_values(
913931
EntityType - The entityType resource object with imported feature values.
914932
"""
915933
_LOGGER.log_action_start_against_resource(
916-
"Importing", "feature values", self,
934+
"Importing",
935+
"feature values",
936+
self,
917937
)
918938

919939
import_lro = self.api_client.import_feature_values(
920-
request=import_feature_values_request, metadata=request_metadata,
940+
request=import_feature_values_request,
941+
metadata=request_metadata,
921942
)
922943

923944
_LOGGER.log_action_started_against_resource_with_lro(
@@ -1013,15 +1034,17 @@ def ingest_from_bq(
10131034

10141035
bigquery_source = gca_io.BigQuerySource(input_uri=bq_source_uri)
10151036

1016-
import_feature_values_request = self._validate_and_get_import_feature_values_request(
1017-
entity_type_name=self.resource_name,
1018-
feature_ids=feature_ids,
1019-
feature_time=feature_time,
1020-
data_source=bigquery_source,
1021-
feature_source_fields=feature_source_fields,
1022-
entity_id_field=entity_id_field,
1023-
disable_online_serving=disable_online_serving,
1024-
worker_count=worker_count,
1037+
import_feature_values_request = (
1038+
self._validate_and_get_import_feature_values_request(
1039+
entity_type_name=self.resource_name,
1040+
feature_ids=feature_ids,
1041+
feature_time=feature_time,
1042+
data_source=bigquery_source,
1043+
feature_source_fields=feature_source_fields,
1044+
entity_id_field=entity_id_field,
1045+
disable_online_serving=disable_online_serving,
1046+
worker_count=worker_count,
1047+
)
10251048
)
10261049

10271050
return self._import_feature_values(
@@ -1136,15 +1159,17 @@ def ingest_from_gcs(
11361159
if gcs_source_type == "avro":
11371160
data_source = gca_io.AvroSource(gcs_source=gcs_source)
11381161

1139-
import_feature_values_request = self._validate_and_get_import_feature_values_request(
1140-
entity_type_name=self.resource_name,
1141-
feature_ids=feature_ids,
1142-
feature_time=feature_time,
1143-
data_source=data_source,
1144-
feature_source_fields=feature_source_fields,
1145-
entity_id_field=entity_id_field,
1146-
disable_online_serving=disable_online_serving,
1147-
worker_count=worker_count,
1162+
import_feature_values_request = (
1163+
self._validate_and_get_import_feature_values_request(
1164+
entity_type_name=self.resource_name,
1165+
feature_ids=feature_ids,
1166+
feature_time=feature_time,
1167+
data_source=data_source,
1168+
feature_source_fields=feature_source_fields,
1169+
entity_id_field=entity_id_field,
1170+
disable_online_serving=disable_online_serving,
1171+
worker_count=worker_count,
1172+
)
11481173
)
11491174

11501175
return self._import_feature_values(
@@ -1300,7 +1325,8 @@ def ingest_from_df(
13001325

13011326
finally:
13021327
bigquery_client.delete_dataset(
1303-
dataset=temp_bq_dataset.dataset_id, delete_contents=True,
1328+
dataset=temp_bq_dataset.dataset_id,
1329+
delete_contents=True,
13041330
)
13051331

13061332
return entity_type_obj
@@ -1321,9 +1347,11 @@ def _get_bq_schema_field(
13211347
Returns:
13221348
bigquery.SchemaField: bigquery.SchemaField
13231349
"""
1324-
bq_data_type = utils.featurestore_utils.FEATURE_STORE_VALUE_TYPE_TO_BQ_DATA_TYPE_MAP[
1325-
feature_value_type
1326-
]
1350+
bq_data_type = (
1351+
utils.featurestore_utils.FEATURE_STORE_VALUE_TYPE_TO_BQ_DATA_TYPE_MAP[
1352+
feature_value_type
1353+
]
1354+
)
13271355
bq_schema_field = bigquery.SchemaField(
13281356
name=name,
13291357
field_type=bq_data_type["field_type"],
@@ -1383,21 +1411,27 @@ def read(
13831411
)
13841412

13851413
if isinstance(entity_ids, str):
1386-
read_feature_values_request = gca_featurestore_online_service.ReadFeatureValuesRequest(
1387-
entity_type=self.resource_name,
1388-
entity_id=entity_ids,
1389-
feature_selector=feature_selector,
1414+
read_feature_values_request = (
1415+
gca_featurestore_online_service.ReadFeatureValuesRequest(
1416+
entity_type=self.resource_name,
1417+
entity_id=entity_ids,
1418+
feature_selector=feature_selector,
1419+
)
13901420
)
1391-
read_feature_values_response = self._featurestore_online_client.read_feature_values(
1392-
request=read_feature_values_request, metadata=request_metadata
1421+
read_feature_values_response = (
1422+
self._featurestore_online_client.read_feature_values(
1423+
request=read_feature_values_request, metadata=request_metadata
1424+
)
13931425
)
13941426
header = read_feature_values_response.header
13951427
entity_views = [read_feature_values_response.entity_view]
13961428
elif isinstance(entity_ids, list):
1397-
streaming_read_feature_values_request = gca_featurestore_online_service.StreamingReadFeatureValuesRequest(
1398-
entity_type=self.resource_name,
1399-
entity_ids=entity_ids,
1400-
feature_selector=feature_selector,
1429+
streaming_read_feature_values_request = (
1430+
gca_featurestore_online_service.StreamingReadFeatureValuesRequest(
1431+
entity_type=self.resource_name,
1432+
entity_ids=entity_ids,
1433+
feature_selector=feature_selector,
1434+
)
14011435
)
14021436
streaming_read_feature_values_responses = [
14031437
response
@@ -1417,7 +1451,8 @@ def read(
14171451
]
14181452

14191453
return self._construct_dataframe(
1420-
feature_ids=feature_ids, entity_views=entity_views,
1454+
feature_ids=feature_ids,
1455+
entity_views=entity_views,
14211456
)
14221457

14231458
@staticmethod

google/cloud/aiplatform/featurestore/feature.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,21 @@ def update(
224224
update_mask = field_mask_pb2.FieldMask(paths=update_mask)
225225

226226
gapic_feature = gca_feature.Feature(
227-
name=self.resource_name, description=description, labels=labels,
227+
name=self.resource_name,
228+
description=description,
229+
labels=labels,
228230
)
229231

230232
_LOGGER.log_action_start_against_resource(
231-
"Updating", "feature", self,
233+
"Updating",
234+
"feature",
235+
self,
232236
)
233237

234238
update_feature_lro = self.api_client.update_feature(
235-
feature=gapic_feature, update_mask=update_mask, metadata=request_metadata,
239+
feature=gapic_feature,
240+
update_mask=update_mask,
241+
metadata=request_metadata,
236242
)
237243

238244
_LOGGER.log_action_started_against_resource_with_lro(
@@ -605,11 +611,13 @@ def create(
605611
create_feature_request.parent = entity_type_name
606612

607613
api_client = cls._instantiate_client(
608-
location=entity_type_name_components["location"], credentials=credentials,
614+
location=entity_type_name_components["location"],
615+
credentials=credentials,
609616
)
610617

611618
created_feature_lro = api_client.create_feature(
612-
request=create_feature_request, metadata=request_metadata,
619+
request=create_feature_request,
620+
metadata=request_metadata,
613621
)
614622

615623
_LOGGER.log_create_with_lro(cls, created_feature_lro)

0 commit comments

Comments
 (0)