From 202e168d630ff1f0e445c4938e3c8e436535704e Mon Sep 17 00:00:00 2001 From: "MIDDLEEAST\\v-moshaban" Date: Mon, 1 Mar 2021 14:50:32 +0200 Subject: [PATCH] [samples][async] added some missing await methods --- .../samples/async_samples/sample_batch_translation_async.py | 2 +- .../sample_batch_translation_with_storage_async.py | 2 +- .../async_samples/sample_cancel_translation_job_async.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_async.py b/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_async.py index 7908ddb952294..19eb5f8de715b 100644 --- a/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_async.py +++ b/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_async.py @@ -50,7 +50,7 @@ async def batch_translation_async(self): # run translation job async with client: - job_detail = await client.create_translation_job(batch) + job_detail = await client.create_translation_job(batch) # type: JobStatusDetail print("Job initial status: {}".format(job_detail.status)) print("Number of translations on documents: {}".format(job_detail.documents_total_count)) diff --git a/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_with_storage_async.py b/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_with_storage_async.py index 8af73c3c81c0e..07f05441dcd33 100644 --- a/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_with_storage_async.py +++ b/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_batch_translation_with_storage_async.py @@ -108,7 +108,7 @@ async def batch_translation_with_storage_async(self): ) with open("translated.txt", "wb") as my_blob: - download_stream = container_client.download_blob("document.txt") + download_stream = await container_client.download_blob("document.txt") my_blob.write(await download_stream.readall()) diff --git a/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_cancel_translation_job_async.py b/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_cancel_translation_job_async.py index a777c53f092a6..323b372da79e1 100644 --- a/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_cancel_translation_job_async.py +++ b/sdk/documenttranslation/azure-ai-documenttranslation/samples/async_samples/sample_cancel_translation_job_async.py @@ -50,7 +50,7 @@ async def cancel_translation_job_async(self): print("Number of translations on documents: {}".format(job_detail.documents_total_count)) await client.cancel_job(job_detail.id) - job_detail = client.get_job_status(job_detail.id) # type: JobStatusDetail + job_detail = await client.get_job_status(job_detail.id) # type: JobStatusDetail if job_detail.status in ["Cancelled", "Cancelling"]: print("We cancelled job with ID: {}".format(job_detail.id))