Skip to content

Commit e287524

Browse files
xiaozhenliu-gg5Ace Nassri
authored and
Ace Nassri
committed
chore: cleanup synth.py (#386)
1 parent 13e3530 commit e287524

24 files changed

+940
-1015
lines changed

automl/test/automlTablesDataset.v1beta1.test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ describe('Tables DatasetAPI', () => {
8484
`${cmdDataset} list-table-specs` + ` "${datasetId}" "${filter}"`
8585
);
8686
let parsedOut = output.split('\n');
87-
const outputTableId = parsedOut[1]
88-
.split(':')[1]
89-
.trim()
90-
.split('/')[7];
87+
const outputTableId = parsedOut[1].split(':')[1].trim().split('/')[7];
9188
assert.match(output, /Table Id:/);
9289

9390
// Get table
@@ -101,10 +98,7 @@ describe('Tables DatasetAPI', () => {
10198
`${cmdDataset} list-column-specs` + ` "${datasetId}" "${outputTableId}"`
10299
);
103100
parsedOut = output.split('\n');
104-
const outputColumnId = parsedOut[1]
105-
.split(':')[1]
106-
.trim()
107-
.split('/')[9];
101+
const outputColumnId = parsedOut[1].split(':')[1].trim().split('/')[9];
108102
assert.match(output, /Column Id:/);
109103

110104
// Get column

automl/test/automlTablesModel.v1beta1.test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ describe('Tables ModelAPI', () => {
4646
`${cmdModel} create-model "${datasetId}" "${tableId}" "${columnId}"` +
4747
` "${testModelName}" "${trainBudget}"`
4848
);
49-
const operationName = output
50-
.split('\n')[0]
51-
.split(':')[1]
52-
.trim();
49+
const operationName = output.split('\n')[0].split(':')[1].trim();
5350
assert.match(output, /Training started.../);
5451

5552
output = exec(`${cmdModel} get-operation-status "${operationName}"`);
@@ -112,10 +109,7 @@ describe('Tables ModelAPI', () => {
112109
it.skip('should list and get operation status', async () => {
113110
// List operations status
114111
let output = exec(`${cmdModel} list-operations-status `);
115-
const operationFullId = output
116-
.split('\n')[3]
117-
.split(':')[1]
118-
.trim();
112+
const operationFullId = output.split('\n')[3].split(':')[1].trim();
119113
assert.match(output, /Operation details:/);
120114

121115
// Get operation status

automl/test/automlTranslation.v1beta1.test.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ describe.skip('automl sample tests', () => {
3838

3939
// Create dataset
4040
output = execSync(`${cmdDataset} create-dataset -n "${testDataSetName}"`);
41-
const dataSetId = output
42-
.split('\n')[1]
43-
.split(':')[1]
44-
.trim();
41+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
4542
assert.match(
4643
output,
4744
new RegExp(`Dataset display name: ${testDataSetName}`)
@@ -60,10 +57,7 @@ describe.skip('automl sample tests', () => {
6057

6158
// Create dataset
6259
output = execSync(`${cmdDataset} create-dataset -n "${dummyDataSet}"`);
63-
const dataSetId = output
64-
.split('\n')[1]
65-
.split(':')[1]
66-
.trim();
60+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
6761
assert.match(output, new RegExp(`Dataset display name: ${dummyDataSet}`));
6862

6963
// Import Data
@@ -80,10 +74,7 @@ describe.skip('automl sample tests', () => {
8074
output = execSync(
8175
`${cmdModel} create-model -i "${dataSetId}" -m "${testModelName}" -t "2"`
8276
);
83-
const operationName = output
84-
.split('\n')[0]
85-
.split(':')[1]
86-
.trim();
77+
const operationName = output.split('\n')[0].split(':')[1].trim();
8778
assert.match(output, 'Training started...');
8879

8980
// Poll operation status, here confirming that operation is not complete yet

automl/test/automlVideoIntelligenceClassificationModel.v1beta1.test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ describe.skip('Video Intelligence ModelAPI', () => {
3939
let output = exec(
4040
`${cmdModel} create-model "${datasetId}" "${testModelName}"`
4141
);
42-
const operationName = output
43-
.split('\n')[0]
44-
.split(':')[1]
45-
.trim();
42+
const operationName = output.split('\n')[0].split(':')[1].trim();
4643
assert.match(output, /Training started.../);
4744

4845
output = exec(`${cmdModel} get-operation-status "${operationName}"`);
@@ -86,10 +83,7 @@ describe.skip('Video Intelligence ModelAPI', () => {
8683
it('should list and get operation status', async () => {
8784
// List operation status
8885
let output = exec(`${cmdModel} list-operations-status`);
89-
const operationFullId = output
90-
.split('\n')[3]
91-
.split(':')[1]
92-
.trim();
86+
const operationFullId = output.split('\n')[3].split(':')[1].trim();
9387
assert.match(output, /Operation details:/);
9488

9589
// Get operation status

automl/test/automlVision.test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ describe('auto ml vision', () => {
3939

4040
// Create dataset
4141
output = execSync(`${cmdDataset} create-dataset -n "${testDataSetName}"`);
42-
const dataSetId = output
43-
.split('\n')[1]
44-
.split(':')[1]
45-
.trim();
42+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
4643
assert.match(output, new RegExp(testDataSetName));
4744

4845
// Delete dataset
@@ -59,10 +56,7 @@ describe('auto ml vision', () => {
5956

6057
// Create dataset
6158
output = execSync(`${cmdDataset} create-dataset -n "${dummyDataSet}"`);
62-
const dataSetId = output
63-
.split('\n')[1]
64-
.split(':')[1]
65-
.trim();
59+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
6660
assert.match(output, new RegExp(dummyDataSet));
6761

6862
// Import Data

automl/test/delete-dataset.beta.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Translate Delete Dataset Tests', () => {
3232

3333
before('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936
const request = {
4037
parent: client.locationPath(projectId, LOCATION),
4138
dataset: {

automl/test/delete_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Translate Delete Dataset Tests', () => {
3232

3333
before('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936
const request = {
4037
parent: client.locationPath(projectId, LOCATION),
4138
dataset: {

automl/test/export_dataset.test.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Automl Translate Dataset Tests', () => {
3333
const client = new AutoMlClient();
3434
const prefix = 'TEST_EXPORT_OUTPUT';
3535

36-
it('should export a datset', async function() {
36+
it('should export a datset', async function () {
3737
this.retries(4);
3838
await delay(this.test);
3939
const projectId = await client.getProjectId();
@@ -58,10 +58,7 @@ describe('Automl Translate Dataset Tests', () => {
5858
.getFiles(options);
5959

6060
for (const file of files) {
61-
await storageClient
62-
.bucket(`gs://${bucketName}`)
63-
.file(file.name)
64-
.delete();
61+
await storageClient.bucket(`gs://${bucketName}`).file(file.name).delete();
6562
}
6663
});
6764
});

automl/test/import_dataset.test.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,11 @@ describe('Automl Import Dataset Test', () => {
6969
}
7070
}
7171

72-
it('should create a dataset', async function() {
72+
it('should create a dataset', async function () {
7373
this.retries(5);
7474
await delay(this.test);
7575
const projectId = await client.getProjectId();
76-
const displayName = `test_${uuid
77-
.v4()
78-
.replace(/-/g, '_')
79-
.substring(0, 26)}`;
76+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
8077
const request = {
8178
parent: client.locationPath(projectId, LOCATION),
8279
dataset: {
@@ -94,7 +91,7 @@ describe('Automl Import Dataset Test', () => {
9491
[response.name.split('/').length - 1].split('\n')[0];
9592
});
9693

97-
it('should import dataset', async function() {
94+
it('should import dataset', async function () {
9895
this.retries(5);
9996
await delay(this.test);
10097
const projectId = await client.getProjectId();
@@ -105,7 +102,7 @@ describe('Automl Import Dataset Test', () => {
105102
assert.match(import_output, /Dataset imported/);
106103
});
107104

108-
it('should delete created dataset', async function() {
105+
it('should delete created dataset', async function () {
109106
this.retries(5);
110107
await delay(this.test);
111108
const projectId = await client.getProjectId();

automl/test/language_entity_extraction_create_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Natural Language Entity Extraction Create Dataset Test', () =>
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/language_sentiment_analysis_create_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Natural Language Sentiment Analysis Create Dataset Test', () =>
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/language_text_classification_create_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Natural Language Text Classification Create Dataset Test', () =
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/translate_create_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Translate Create Dataset Test', () => {
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/translate_create_model.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Automl Translate Create Model Tests', () => {
3232
const client = new AutoMlClient();
3333
let operationId;
3434

35-
it('should create a model', async function() {
35+
it('should create a model', async function () {
3636
this.retries(5);
3737
await delay(this.test);
3838

automl/test/video-classification-create-dataset.beta.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Video Classification Create Dataset Test', () => {
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/video-object-tracking-create-dataset.beta.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Video Object Tracking Create Dataset Test', () => {
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/vision_classification_create_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Vision Classification Create Dataset Test', () => {
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

automl/test/vision_object_detection_create_dataset.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Vision Object Detection Create Dataset Test', () => {
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = await execSync(

automl/test/vision_object_detection_predict.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const {delay} = require('./util');
3131
describe('Automl Vision Object Detection Predict Test', () => {
3232
const client = new AutoMlClient();
3333

34-
it('should verify the model is deployed', async function() {
34+
it('should verify the model is deployed', async function () {
3535
this.retries(5);
3636
await delay(this.test);
3737
const projectId = await client.getProjectId();

automl/video-intelligence/classification/get-model-evaluations.v1beta1.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ async function main(
5454
// Display the model evaluations information.
5555
console.log(`\nModel evaluation name: ${response.name}`);
5656
console.log(
57-
`Model evaluation Id: ${response.name
58-
.split('/')
59-
.slice(-1)
60-
.pop()}`
57+
`Model evaluation Id: ${response.name.split('/').slice(-1).pop()}`
6158
);
6259
console.log(
6360
`Model evaluation annotation spec Id: ${response.annotationSpecId}`

automl/video-intelligence/classification/list-model-evaluations.v1beta1.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ async function main(
5050
// Display the model evaluations information.
5151
console.log(`\nModel evaluation name: ${element[i].name}`);
5252
console.log(
53-
`Model evaluation Id: ${element[i].name
54-
.split('/')
55-
.slice(-1)
56-
.pop()}`
53+
`Model evaluation Id: ${element[i].name.split('/').slice(-1).pop()}`
5754
);
5855
console.log(
5956
`Model evaluation annotation spec Id: ${element[i].annotationSpecId}`

0 commit comments

Comments
 (0)