Skip to content

Commit 60851fd

Browse files
Fix Linter issue for 4328
1 parent 4f08882 commit 60851fd

10 files changed

+114
-67
lines changed

notebooks/community/gapic/automl/showcase_automl_image_classification_export_edge.ipynb

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@
416416
},
417417
"outputs": [],
418418
"source": [
419-
"! gcloud storage buckets create --location=$REGION $BUCKET_NAME" ]
419+
"! gcloud storage buckets create --location=$REGION $BUCKET_NAME"
420+
]
420421
},
421422
{
422423
"cell_type": "markdown",
@@ -435,7 +436,8 @@
435436
},
436437
"outputs": [],
437438
"source": [
438-
"! gcloud storage ls --all-versions --long $BUCKET_NAME" ]
439+
"! gcloud storage ls --all-versions --long $BUCKET_NAME"
440+
]
439441
},
440442
{
441443
"cell_type": "markdown",
@@ -472,7 +474,6 @@
472474
"\n",
473475
"from google.cloud.aiplatform import gapic as aip\n",
474476
"from google.protobuf import json_format\n",
475-
"from google.protobuf.json_format import MessageToJson, ParseDict\n",
476477
"from google.protobuf.struct_pb2 import Struct, Value"
477478
]
478479
},
@@ -782,10 +783,12 @@
782783
"else:\n",
783784
" FILE = IMPORT_FILE\n",
784785
"\n",
785-
"count = ! gcloud storage cat $FILE | wc -l\n", "print(\"Number of Examples\", int(count[0]))\n",
786+
"count = ! gcloud storage cat $FILE | wc -l\n",
787+
"print(\"Number of Examples\", int(count[0]))\n",
786788
"\n",
787789
"print(\"First 10 rows\")\n",
788-
"! gcloud storage cat $FILE | head" ]
790+
"! gcloud storage cat $FILE | head"
791+
]
789792
},
790793
{
791794
"cell_type": "markdown",
@@ -1211,7 +1214,6 @@
12111214
" }\n",
12121215
" response = clients[\"model\"].export_model(name=name, output_config=output_config)\n",
12131216
" print(\"Long running operation:\", response.operation.name)\n",
1214-
" result = response.result(timeout=1800)\n",
12151217
" metadata = response.operation.metadata\n",
12161218
" artifact_uri = str(metadata.value).split(\"\\\\\")[-1][4:-1]\n",
12171219
" print(\"Artifact Uri\", artifact_uri)\n",
@@ -1240,8 +1242,10 @@
12401242
},
12411243
"outputs": [],
12421244
"source": [
1243-
"! gcloud storage ls $model_package\n", "# Download the model artifacts\n",
1244-
"! gcloud storage cp --recursive $model_package tflite\n", "\n",
1245+
"! gcloud storage ls $model_package\n",
1246+
"# Download the model artifacts\n",
1247+
"! gcloud storage cp --recursive $model_package tflite\n",
1248+
"\n",
12451249
"tflite_path = \"tflite/model.tflite\""
12461250
]
12471251
},
@@ -1299,7 +1303,8 @@
12991303
},
13001304
"outputs": [],
13011305
"source": [
1302-
"test_items = ! gcloud storage cat $IMPORT_FILE | head -n1\n", "test_item = test_items[0].split(\",\")[0]\n",
1306+
"test_items = ! gcloud storage cat $IMPORT_FILE | head -n1\n",
1307+
"test_item = test_items[0].split(\",\")[0]\n",
13031308
"\n",
13041309
"with tf.io.gfile.GFile(test_item, \"rb\") as f:\n",
13051310
" content = f.read()\n",
@@ -1442,7 +1447,8 @@
14421447
" print(e)\n",
14431448
"\n",
14441449
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
1445-
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
1450+
" ! gcloud storage rm --recursive $BUCKET_NAME"
1451+
]
14461452
}
14471453
],
14481454
"metadata": {

notebooks/community/gapic/automl/showcase_automl_image_object_detection_export_edge.ipynb

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@
416416
},
417417
"outputs": [],
418418
"source": [
419-
"! gcloud storage buckets create --location $REGION $BUCKET_NAME" ]
419+
"! gcloud storage buckets create --location $REGION $BUCKET_NAME"
420+
]
420421
},
421422
{
422423
"cell_type": "markdown",
@@ -435,7 +436,8 @@
435436
},
436437
"outputs": [],
437438
"source": [
438-
"! gcloud storage ls --all-versions --long $BUCKET_NAME" ]
439+
"! gcloud storage ls --all-versions --long $BUCKET_NAME"
440+
]
439441
},
440442
{
441443
"cell_type": "markdown",
@@ -471,9 +473,7 @@
471473
"import time\n",
472474
"\n",
473475
"from google.cloud.aiplatform import gapic as aip\n",
474-
"from google.protobuf import json_format\n",
475-
"from google.protobuf.json_format import MessageToJson, ParseDict\n",
476-
"from google.protobuf.struct_pb2 import Struct, Value"
476+
"from google.protobuf import json_format\n"
477477
]
478478
},
479479
{
@@ -783,10 +783,12 @@
783783
"else:\n",
784784
" FILE = IMPORT_FILE\n",
785785
"\n",
786-
"count = ! gcloud storage cat $FILE | wc -l\n", "print(\"Number of Examples\", int(count[0]))\n",
786+
"count = ! gcloud storage cat $FILE | wc -l\n",
787+
"print(\"Number of Examples\", int(count[0]))\n",
787788
"\n",
788789
"print(\"First 10 rows\")\n",
789-
"! gcloud storage cat $FILE | head" ]
790+
"! gcloud storage cat $FILE | head"
791+
]
790792
},
791793
{
792794
"cell_type": "markdown",
@@ -1214,7 +1216,6 @@
12141216
" }\n",
12151217
" response = clients[\"model\"].export_model(name=name, output_config=output_config)\n",
12161218
" print(\"Long running operation:\", response.operation.name)\n",
1217-
" result = response.result(timeout=1800)\n",
12181219
" metadata = response.operation.metadata\n",
12191220
" artifact_uri = str(metadata.value).split(\"\\\\\")[-1][4:-1]\n",
12201221
" print(\"Artifact Uri\", artifact_uri)\n",
@@ -1243,8 +1244,10 @@
12431244
},
12441245
"outputs": [],
12451246
"source": [
1246-
"! gcloud storage ls $model_package\n", "# Download the model artifacts\n",
1247-
"! gcloud storage cp --recursive $model_package tflite\n", "\n",
1247+
"! gcloud storage ls $model_package\n",
1248+
"# Download the model artifacts\n",
1249+
"! gcloud storage cp --recursive $model_package tflite\n",
1250+
"\n",
12481251
"tflite_path = \"tflite/model.tflite\""
12491252
]
12501253
},
@@ -1302,7 +1305,8 @@
13021305
},
13031306
"outputs": [],
13041307
"source": [
1305-
"test_items = ! gcloud storage cat $IMPORT_FILE | head -n1\n", "test_item = test_items[0].split(\",\")[0]\n",
1308+
"test_items = ! gcloud storage cat $IMPORT_FILE | head -n1\n",
1309+
"test_item = test_items[0].split(\",\")[0]\n",
13061310
"\n",
13071311
"with tf.io.gfile.GFile(test_item, \"rb\") as f:\n",
13081312
" content = f.read()\n",
@@ -1445,7 +1449,8 @@
14451449
" print(e)\n",
14461450
"\n",
14471451
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
1448-
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
1452+
" ! gcloud storage rm --recursive $BUCKET_NAME"
1453+
]
14491454
}
14501455
],
14511456
"metadata": {

notebooks/community/ml_ops/stage3/get_started_with_kubeflow_pipelines.ipynb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@
430430
},
431431
"outputs": [],
432432
"source": [
433-
"! gcloud storage buckets create --location=$REGION $BUCKET_URI" ]
433+
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
434+
]
434435
},
435436
{
436437
"cell_type": "markdown",
@@ -449,7 +450,8 @@
449450
},
450451
"outputs": [],
451452
"source": [
452-
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
453+
"! gcloud storage ls --all-versions --long $BUCKET_URI"
454+
]
453455
},
454456
{
455457
"cell_type": "markdown",
@@ -518,9 +520,9 @@
518520
},
519521
"outputs": [],
520522
"source": [
521-
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n", "\n",
522-
523-
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer" ]
523+
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n","\n",
524+
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer"
525+
]
524526
},
525527
{
526528
"cell_type": "markdown",
@@ -804,11 +806,14 @@
804806
" + \"/evaluation_metrics\"\n",
805807
" )\n",
806808
" if tf.io.gfile.exists(EXECUTE_OUTPUT):\n",
807-
" ! gcloud storage cat $EXECUTE_OUTPUT\n", " return EXECUTE_OUTPUT\n",
809+
" ! gcloud storage cat $EXECUTE_OUTPUT\n",
810+
" return EXECUTE_OUTPUT\n",
808811
" elif tf.io.gfile.exists(GCP_RESOURCES):\n",
809-
" ! gcloud storage cat $GCP_RESOURCES\n", " return GCP_RESOURCES\n",
812+
" ! gcloud storage cat $GCP_RESOURCES\n",
813+
" return GCP_RESOURCES\n",
810814
" elif tf.io.gfile.exists(EVAL_METRICS):\n",
811-
" ! gcloud storage cat $EVAL_METRICS\n", " return EVAL_METRICS\n",
815+
" ! gcloud storage cat $EVAL_METRICS\n",
816+
" return EVAL_METRICS\n",
812817
"\n",
813818
" return None\n",
814819
"\n",
@@ -1161,9 +1166,7 @@
11611166
"\n",
11621167
"\n",
11631168
"@component()\n",
1164-
"def multi_output(\n",
1165-
" text1: str, text2: str\n",
1166-
") -> NamedTuple(\n",
1169+
"def multi_output(text1: str, text2: str) -> NamedTuple(\n",
11671170
" \"Outputs\",\n",
11681171
" [\n",
11691172
" (\"output_1\", str), # Return parameters\n",
@@ -1581,7 +1584,8 @@
15811584
"delete_bucket = False\n",
15821585
"\n",
15831586
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
1584-
" ! gcloud storage rm --recursive $BUCKET_URI" ]
1587+
" ! gcloud storage rm --recursive $BUCKET_URI"
1588+
]
15851589
}
15861590
],
15871591
"metadata": {

notebooks/community/ml_ops/stage6/get_started_with_custom_tabular_model_batch.ipynb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@
464464
},
465465
"outputs": [],
466466
"source": [
467-
"! gcloud storage buckets create --location=$REGION $BUCKET_URI" ]
467+
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
468+
]
468469
},
469470
{
470471
"cell_type": "markdown",
@@ -483,7 +484,8 @@
483484
},
484485
"outputs": [],
485486
"source": [
486-
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
487+
"! gcloud storage ls --all-versions --long $BUCKET_URI"
488+
]
487489
},
488490
{
489491
"cell_type": "markdown",
@@ -890,7 +892,8 @@
890892
" f.write(json.dumps(instance) + \"\\n\")\n",
891893
"\n",
892894
"# Upload to Cloud Storage bucket\n",
893-
"! gcloud storage cp $BATCH_PREDICTION_INSTANCES_FILE $BATCH_PREDICTION_GCS_SOURCE\n", "\n",
895+
"! gcloud storage cp $BATCH_PREDICTION_INSTANCES_FILE $BATCH_PREDICTION_GCS_SOURCE\n",
896+
"\n",
894897
"print(\"Uploaded instances to: \", BATCH_PREDICTION_GCS_SOURCE)"
895898
]
896899
},
@@ -1115,7 +1118,8 @@
11151118
" BUCKET_URI + \"/batch_prediction_instances/\" + BATCH_PREDICTION_INSTANCES_FILE\n",
11161119
")\n",
11171120
"\n",
1118-
"! gcloud storage cp test.csv $BATCH_PREDICTION_GCS_SOURCE" ]
1121+
"! gcloud storage cp test.csv $BATCH_PREDICTION_GCS_SOURCE"
1122+
]
11191123
},
11201124
{
11211125
"cell_type": "markdown",
@@ -1493,7 +1497,8 @@
14931497
"delete_bucket = False\n",
14941498
"\n",
14951499
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
1496-
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}" ]
1500+
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}"
1501+
]
14971502
}
14981503
],
14991504
"metadata": {

notebooks/community/ml_ops/stage6/get_started_with_xai_and_custom_server.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@
504504
},
505505
"outputs": [],
506506
"source": [
507-
"! gcloud storage buckets create --location=$REGION $BUCKET_URI" ]
507+
"! gcloud storage buckets create --location=$REGION $BUCKET_URI"
508+
]
508509
},
509510
{
510511
"cell_type": "markdown",
@@ -523,7 +524,8 @@
523524
},
524525
"outputs": [],
525526
"source": [
526-
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
527+
"! gcloud storage ls --all-versions --long $BUCKET_URI"
528+
]
527529
},
528530
{
529531
"cell_type": "markdown",
@@ -1732,7 +1734,8 @@
17321734
"! rm -rf app\n",
17331735
"\n",
17341736
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
1735-
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}" ]
1737+
" ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}"
1738+
]
17361739
}
17371740
],
17381741
"metadata": {

notebooks/community/model_evaluation/automl_tabular_regression_model_evaluation.ipynb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@
537537
},
538538
"outputs": [],
539539
"source": [
540-
"! gcloud storage buckets create --location=$REGION --project=$PROJECT_ID $BUCKET_URI" ]
540+
"! gcloud storage buckets create --location=$REGION --project=$PROJECT_ID $BUCKET_URI"
541+
]
541542
},
542543
{
543544
"cell_type": "markdown",
@@ -556,7 +557,8 @@
556557
},
557558
"outputs": [],
558559
"source": [
559-
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
560+
"! gcloud storage ls --all-versions --long $BUCKET_URI"
561+
]
560562
},
561563
{
562564
"cell_type": "markdown",
@@ -625,8 +627,10 @@
625627
},
626628
"outputs": [],
627629
"source": [
628-
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n", "\n",
629-
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer" ]
630+
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n",
631+
"\n",
632+
"! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer"
633+
]
630634
},
631635
{
632636
"cell_type": "markdown",
@@ -1379,7 +1383,8 @@
13791383
"outputs": [],
13801384
"source": [
13811385
"# Load the results\n",
1382-
"attributions = !gcloud storage cat $feat_attrs_gcs_uri\n", "\n",
1386+
"attributions = !gcloud storage cat $feat_attrs_gcs_uri\n",
1387+
"\n",
13831388
"# Print the results obtained\n",
13841389
"attributions = json.loads(attributions[0])\n",
13851390
"print(attributions)"
@@ -1458,7 +1463,8 @@
14581463
"# Delete Cloud Storage objects\n",
14591464
"delete_bucket = False\n",
14601465
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
1461-
" ! gcloud storage rm --recursive $BUCKET_URI" ]
1466+
" ! gcloud storage rm --recursive $BUCKET_URI"
1467+
]
14621468
}
14631469
],
14641470
"metadata": {

0 commit comments

Comments
 (0)