Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded awaits for PagedAsyncIterableIterators #9065

Merged
merged 5 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function main() {
}

async function cleanupSampleValues(keys, client) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function main() {
}

async function cleanupSampleValues(keys, client) {
const settingsIterator = await client.listConfigurationSettings({
const settingsIterator = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function main() {
}

async function cleanupSampleValues(keys, client) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function main() {
}

async function cleanupSampleValues(keys, client) {
const settingsIterator = await client.listConfigurationSettings({
const settingsIterator = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async function main() {
}

async function cleanupSampleValues(keys, client) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function main() {
}

async function cleanupSampleValues(keys, client) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});
for await (const setting of existingSettings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function main() {
}

async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function main() {
}

async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) {
const settingsIterator = await client.listConfigurationSettings({
const settingsIterator = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function main() {
}

async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function main() {
}

async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) {
const settingsIterator = await client.listConfigurationSettings({
const settingsIterator = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function main() {
}

async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function main() {
}

async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) {
const existingSettings = await client.listConfigurationSettings({
const existingSettings = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class AppConfigurationClient {
*
* Example code:
* ```ts
* const allSettingsWithLabel = await client.listConfigurationSettings({ labels: [ "MyLabel" ] });
* const allSettingsWithLabel = client.listConfigurationSettings({ labels: [ "MyLabel" ] });
* ```
* @param options Optional parameters for the request.
*/
Expand Down Expand Up @@ -374,7 +374,7 @@ export class AppConfigurationClient {
*
* Example code:
* ```ts
* const revisionsIterator = await client.listRevisions({ keys: ["MyKey"] });
* const revisionsIterator = client.listRevisions({ keys: ["MyKey"] });
* ```
* @param options Optional parameters for the request.
*/
Expand Down
12 changes: 6 additions & 6 deletions sdk/appconfiguration/app-configuration/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ describe("AppConfigurationClient", () => {
});

it("undefined doesn't throw and will just return everything", async () => {
const settingsIterator = await client.listConfigurationSettings();
const settingsIterator = client.listConfigurationSettings();
await settingsIterator.next();
});

Expand Down Expand Up @@ -673,7 +673,7 @@ describe("AppConfigurationClient", () => {

await Promise.all(addSettingPromises);

let listResult = await client.listConfigurationSettings({
let listResult = client.listConfigurationSettings({
keyFilter: key
});

Expand Down Expand Up @@ -728,7 +728,7 @@ describe("AppConfigurationClient", () => {
});

it("exact match on label", async () => {
const revisionsWithLabelIterator = await client.listRevisions({ labelFilter: labelA });
const revisionsWithLabelIterator = client.listRevisions({ labelFilter: labelA });
const revisions = await toSortedArray(revisionsWithLabelIterator);

assertEqualSettings(
Expand All @@ -741,7 +741,7 @@ describe("AppConfigurationClient", () => {
});

it("label wildcards", async () => {
const revisionsWithLabelIterator = await client.listRevisions({
const revisionsWithLabelIterator = client.listRevisions({
labelFilter: labelA.substring(0, labelA.length - 1) + "*"
});
const revisions = await toSortedArray(revisionsWithLabelIterator);
Expand All @@ -756,7 +756,7 @@ describe("AppConfigurationClient", () => {
});

it("exact match on key", async () => {
const revisionsWithKeyIterator = await client.listRevisions({ keyFilter: key });
const revisionsWithKeyIterator = client.listRevisions({ keyFilter: key });
const revisions = await toSortedArray(revisionsWithKeyIterator);

assertEqualSettings(
Expand All @@ -771,7 +771,7 @@ describe("AppConfigurationClient", () => {
});

it("key wildcards", async () => {
const revisionsWithKeyIterator = await client.listRevisions({
const revisionsWithKeyIterator = client.listRevisions({
keyFilter: key.substring(0, key.length - 1) + "*"
});
const revisions = await toSortedArray(revisionsWithKeyIterator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe("http request related tests", function() {
});

it("custom client request ID", async () => {
const iterator = await client.listConfigurationSettings({
const iterator = client.listConfigurationSettings({
requestOptions: {
customHeaders: {
"x-ms-client-request-id": "this is my custom client request id"
Expand All @@ -146,7 +146,7 @@ describe("http request related tests", function() {
});

it("default client request ID", async () => {
const iterator = await client.listConfigurationSettings();
const iterator = client.listConfigurationSettings();
await iterator.next();
});
});
Expand Down
2 changes: 1 addition & 1 deletion sdk/appconfiguration/app-configuration/test/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function createAppConfigurationClientForTests(
}

export async function deleteKeyCompletely(keys: string[], client: AppConfigurationClient) {
const settingsIterator = await client.listConfigurationSettings({
const settingsIterator = client.listConfigurationSettings({
keyFilter: keys.join(",")
});

Expand Down
3 changes: 2 additions & 1 deletion sdk/formrecognizer/ai-form-recognizer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ async function main() {
const apiKey = "<api key>";
const client = new FormTrainingClient(endpoint, new AzureKeyCredential(apiKey));

const result = await client.listCustomModels();
// returns an async iteratable iterator that supports paging
const result = client.listCustomModels();
let i = 0;
for await (const modelInfo of result) {
console.log(`model ${i++}:`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function main() {

const client = new FormTrainingClient(endpoint, new AzureKeyCredential(apiKey));

const result = await client.listCustomModels();
const result = client.listCustomModels();
let i = 0;
for await (const modelInfo of result) {
console.log(`model ${i++}:`);
Expand Down
8 changes: 4 additions & 4 deletions sdk/storage/storage-blob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ const blobServiceClient = new BlobServiceClient(

async function main() {
let i = 1;
let iter = await blobServiceClient.listContainers();
for await (const container of iter) {
let containers = blobServiceClient.listContainers();
for await (const container of containers) {
console.log(`Container ${i++}: ${container.name}`);
}
}
Expand Down Expand Up @@ -390,8 +390,8 @@ async function main() {
const containerClient = blobServiceClient.getContainerClient(containerName);

let i = 1;
let iter = await containerClient.listBlobsFlat();
for await (const blob of iter) {
let blobs = containerClient.listBlobsFlat();
for await (const blob of blobs) {
console.log(`Blob ${i++}: ${blob.name}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function main() {

// 1. List blobs by hierarchy
console.log("Listing blobs by hierarchy");
let iter = await containerClient.listBlobsByHierarchy("/");
let iter = containerClient.listBlobsByHierarchy("/");
for await (const item of iter) {
if (item.kind === "prefix") {
console.log(`\tBlobPrefix: ${item.name}`);
Expand All @@ -82,7 +82,7 @@ async function main() {

// 2. Generator syntax .next() and passing a prefix
console.log("Listing blobs by hierarchy, specifying a prefix");
iter = await containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
iter = containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
let entity = await iter.next();
while (!entity.done) {
let item = entity.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function main() {
// 1. List blobs
console.log("Listing all blobs using iter");
let i = 1;
let iter = await containerClient.listBlobsFlat();
let iter = containerClient.listBlobsFlat();
for await (const blob of iter) {
console.log(`Blob ${i++}: ${blob.name}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function main() {
// 1. List Containers
console.log("Listing all containers using iter");
let i = 1;
let iter = await blobServiceClient.listContainers();
let iter = blobServiceClient.listContainers();
for await (const container of iter) {
console.log(`Container ${i++}: ${container.name}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function main() {

// 1. List blobs by hierarchy
console.log("Listing blobs by hierarchy");
let iter = await containerClient.listBlobsByHierarchy("/");
let iter = containerClient.listBlobsByHierarchy("/");
for await (const item of iter) {
if (item.kind === "prefix") {
console.log(`\tBlobPrefix: ${item.name}`);
Expand All @@ -83,7 +83,7 @@ export async function main() {

// 2. Generator syntax .next() and passing a prefix
console.log("Listing blobs by hierarchy, specifying a prefix");
iter = await containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
iter = containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
let entity = await iter.next();
while (!entity.done) {
let item = entity.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function main() {
// 1. List blobs
console.log("Listing all blobs using iter");
let i = 1;
let iter = await containerClient.listBlobsFlat();
let iter = containerClient.listBlobsFlat();
for await (const blob of iter) {
console.log(`Blob ${i++}: ${blob.name}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function main() {

// 1. List Containers
let i = 1;
let iter = await blobServiceClient.listContainers();
let iter = blobServiceClient.listContainers();
for await (const container of iter) {
console.log(`Container ${i++}: ${container.name}`);
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob/src/Clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6685,7 +6685,7 @@ export class ContainerClient extends StorageClient {
* Example using `iter.next()`:
*
* ```js
* let iter = await containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
* let iter = containerClient.listBlobsByHierarchy("/", { prefix: "prefix1/" });
* let entity = await iter.next();
* while (!entity.done) {
* let item = entity.value;
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob/test/blobserviceclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe("BlobServiceClient", () => {
await containerClient1.create({ metadata: { key: "val" } });
await containerClient2.create({ metadata: { key: "val" } });

const iterator = await blobServiceClient.listContainers({
const iterator = blobServiceClient.listContainers({
includeMetadata: true,
prefix: containerNamePrefix
});
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob/test/containerclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ describe("ContainerClient", () => {
blobClients.push(blobClient);
}

const iterator = await containerClient.listBlobsFlat({
const iterator = containerClient.listBlobsFlat({
includeCopy: true,
includeDeleted: true,
includeMetadata: true,
Expand Down
8 changes: 4 additions & 4 deletions sdk/storage/storage-file-datalake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ const datalakeServiceClient = new DataLakeServiceClient(

async function main() {
let i = 1;
let iter = await datalakeServiceClient.listFileSystems();
for await (const fileSystem of iter) {
let fileSystems = datalakeServiceClient.listFileSystems();
for await (const fileSystem of fileSystems) {
console.log(`File system ${i++}: ${fileSystem.name}`);
}
}
Expand Down Expand Up @@ -429,8 +429,8 @@ async function main() {
const fileSystemClient = datalakeServiceClient.getFileSystemClient(fileSystemName);

let i = 1;
let iter = await fileSystemClient.listPaths();
for await (const path of iter) {
let paths = fileSystemClient.listPaths();
for await (const path of paths) {
console.log(`Path ${i++}: ${path.name}, is directory: ${path.isDirectory}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe("DataLakeFileSystemClient", () => {
fileClients.push(fileClient);
}

const iterator = await fileSystemClient.listPaths({
const iterator = fileSystemClient.listPaths({
userPrincipalName: true,
recursive: true,
path: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe("DataLakeServiceClient", () => {
await fileSystemClient1.create({ metadata: { key: "val" } });
await fileSystemClient2.create({ metadata: { key: "val" } });

const iterator = await serviceClient.listFileSystems({
const iterator = serviceClient.listFileSystems({
includeMetadata: true,
prefix: fileSystemNamePrefix
});
Expand Down
Loading