diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_authentication_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_authentication_async.py index 9882e2161d26..eb8d9ae28e04 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_authentication_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_authentication_async.py @@ -120,5 +120,4 @@ async def main(): await sample.auth_blob_url_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_common_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_common_async.py index 2b9c6412c927..18dbf25406cd 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_common_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_common_async.py @@ -226,5 +226,4 @@ async def main(): await sample.copy_blob_from_url_and_abort_copy_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_container_access_policy_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_container_access_policy_async.py index aa6d2bbbf8e3..2275d5dd04f6 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_container_access_policy_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_container_access_policy_async.py @@ -89,5 +89,4 @@ async def main(): sys.exit(1) if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_containers_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_containers_async.py index a06ecc62b079..b9809db7f3f7 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_containers_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_containers_async.py @@ -246,5 +246,4 @@ async def main(): await sample.get_container_client_from_blob_client() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_copy_blob_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_copy_blob_async.py index 723ca57ed134..737a3d11397f 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_copy_blob_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_copy_blob_async.py @@ -56,5 +56,4 @@ async def main(): print(props.copy.status) if __name__ == "__main__": - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_enumerate_blobs_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_enumerate_blobs_async.py index 10858492dc91..e98180583c57 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_enumerate_blobs_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_enumerate_blobs_async.py @@ -35,5 +35,4 @@ async def main(): print(blob.name + '\n') if __name__ == "__main__": - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_hello_world_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_hello_world_async.py index f98785851029..b0e2fb19f2d6 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_hello_world_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_hello_world_async.py @@ -212,5 +212,4 @@ async def main(): await sample.stream_block_blob() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_service_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_service_async.py index 41e7eebca265..a345c2bda818 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_service_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_service_async.py @@ -185,5 +185,4 @@ async def main(): await sample.get_blob_service_client_from_container_client_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-blob/samples/blob_samples_walk_blob_hierarchy_async.py b/sdk/storage/azure-storage-blob/samples/blob_samples_walk_blob_hierarchy_async.py index b58e9e1120eb..54e2f78698d5 100644 --- a/sdk/storage/azure-storage-blob/samples/blob_samples_walk_blob_hierarchy_async.py +++ b/sdk/storage/azure-storage-blob/samples/blob_samples_walk_blob_hierarchy_async.py @@ -87,5 +87,4 @@ async def main(): sys.exit(1) if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_async.py index 0e369386f24a..dd1d6229e651 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_async.py @@ -103,5 +103,4 @@ async def run(): if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(run()) + asyncio.run(run()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_recursive_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_recursive_async.py index 4db6d0dd1c01..ea437f2a54d1 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_recursive_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_access_control_recursive_async.py @@ -128,5 +128,4 @@ async def run(): if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(run()) + asyncio.run(run()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_directory_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_directory_async.py index b2df75ddc1d4..abf6985a1f00 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_directory_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_directory_async.py @@ -111,5 +111,4 @@ async def run(): await filesystem_client.delete_file_system() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(run()) + asyncio.run(run()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_file_system_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_file_system_async.py index f130c9e60b1f..d815235605fc 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_file_system_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_file_system_async.py @@ -227,6 +227,4 @@ async def run(): await sample.create_file_from_file_system() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(run()) - loop.close() + asyncio.run(run()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_instantiate_client_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_instantiate_client_async.py index a3d4573c20f4..d7b300e43a76 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_instantiate_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_instantiate_client_async.py @@ -40,5 +40,4 @@ async def main(): if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(run()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_service_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_service_async.py index 99ba1cee4106..87759cfed9de 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_service_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_service_async.py @@ -113,6 +113,4 @@ async def data_lake_service_sample(): await token_credential.close() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(data_lake_service_sample()) - + asyncio.run(data_lake_service_sample()) diff --git a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_upload_download_async.py b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_upload_download_async.py index e80ae4f21bb4..ab2085c68b3f 100644 --- a/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_upload_download_async.py +++ b/sdk/storage/azure-storage-file-datalake/samples/datalake_samples_upload_download_async.py @@ -125,5 +125,4 @@ async def run(): if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(run()) + asyncio.run(run()) diff --git a/sdk/storage/azure-storage-file-share/samples/file_samples_authentication_async.py b/sdk/storage/azure-storage-file-share/samples/file_samples_authentication_async.py index 439f23de025b..932a96d1be77 100644 --- a/sdk/storage/azure-storage-file-share/samples/file_samples_authentication_async.py +++ b/sdk/storage/azure-storage-file-share/samples/file_samples_authentication_async.py @@ -79,5 +79,4 @@ async def main(): await sample.authentication_shared_access_signature_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-file-share/samples/file_samples_client_async.py b/sdk/storage/azure-storage-file-share/samples/file_samples_client_async.py index e1cb791f0c0e..174187de904b 100644 --- a/sdk/storage/azure-storage-file-share/samples/file_samples_client_async.py +++ b/sdk/storage/azure-storage-file-share/samples/file_samples_client_async.py @@ -117,5 +117,4 @@ async def main(): await sample.file_copy_from_url_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-file-share/samples/file_samples_directory_async.py b/sdk/storage/azure-storage-file-share/samples/file_samples_directory_async.py index 07061373ede2..f416b3c1341d 100644 --- a/sdk/storage/azure-storage-file-share/samples/file_samples_directory_async.py +++ b/sdk/storage/azure-storage-file-share/samples/file_samples_directory_async.py @@ -145,5 +145,4 @@ async def main(): await sample.get_subdirectory_client_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-file-share/samples/file_samples_hello_world_async.py b/sdk/storage/azure-storage-file-share/samples/file_samples_hello_world_async.py index 23a4a7d16837..25bb5407ca6b 100644 --- a/sdk/storage/azure-storage-file-share/samples/file_samples_hello_world_async.py +++ b/sdk/storage/azure-storage-file-share/samples/file_samples_hello_world_async.py @@ -90,5 +90,4 @@ async def main(): await sample.upload_a_file_to_share_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-file-share/samples/file_samples_service_async.py b/sdk/storage/azure-storage-file-share/samples/file_samples_service_async.py index d909ded543a8..ea76a3b585a6 100644 --- a/sdk/storage/azure-storage-file-share/samples/file_samples_service_async.py +++ b/sdk/storage/azure-storage-file-share/samples/file_samples_service_async.py @@ -114,5 +114,4 @@ async def main(): await sample.get_share_client_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-file-share/samples/file_samples_share_async.py b/sdk/storage/azure-storage-file-share/samples/file_samples_share_async.py index 1883eee864e1..11e6eead1db9 100644 --- a/sdk/storage/azure-storage-file-share/samples/file_samples_share_async.py +++ b/sdk/storage/azure-storage-file-share/samples/file_samples_share_async.py @@ -162,5 +162,4 @@ async def main(): await sample.get_directory_or_file_client_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-queue/samples/queue_samples_authentication_async.py b/sdk/storage/azure-storage-queue/samples/queue_samples_authentication_async.py index cae2f13a02d0..5b7f97818cc7 100644 --- a/sdk/storage/azure-storage-queue/samples/queue_samples_authentication_async.py +++ b/sdk/storage/azure-storage-queue/samples/queue_samples_authentication_async.py @@ -118,5 +118,4 @@ async def main(): await sample.authentication_by_shared_access_signature_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-queue/samples/queue_samples_hello_world_async.py b/sdk/storage/azure-storage-queue/samples/queue_samples_hello_world_async.py index af70b5319b24..bc33a36a29a9 100644 --- a/sdk/storage/azure-storage-queue/samples/queue_samples_hello_world_async.py +++ b/sdk/storage/azure-storage-queue/samples/queue_samples_hello_world_async.py @@ -75,5 +75,4 @@ async def main(): await sample.queue_and_messages_example_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-queue/samples/queue_samples_message_async.py b/sdk/storage/azure-storage-queue/samples/queue_samples_message_async.py index 62f85c4ca77c..0f409074b64d 100644 --- a/sdk/storage/azure-storage-queue/samples/queue_samples_message_async.py +++ b/sdk/storage/azure-storage-queue/samples/queue_samples_message_async.py @@ -331,5 +331,4 @@ async def main(): await sample.receive_messages_with_max_messages() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) \ No newline at end of file + asyncio.run(main()) diff --git a/sdk/storage/azure-storage-queue/samples/queue_samples_service_async.py b/sdk/storage/azure-storage-queue/samples/queue_samples_service_async.py index ff7127f9eaa1..01d79059ae2f 100644 --- a/sdk/storage/azure-storage-queue/samples/queue_samples_service_async.py +++ b/sdk/storage/azure-storage-queue/samples/queue_samples_service_async.py @@ -117,5 +117,4 @@ async def main(): await sample.get_queue_client_async() if __name__ == '__main__': - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main())