From 85c676eec32529afd45915027402708549093e0e Mon Sep 17 00:00:00 2001 From: Yujin Cho Date: Fri, 29 Jul 2022 23:48:48 +0900 Subject: [PATCH 1/7] Improve the readability of source code Change str.format() formatting of the source code to f-string formatting. --- .../azure-keyvault-keys/samples/hello_world.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py index e5d4290af592..ca37333f37d0 100644 --- a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py +++ b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py @@ -48,7 +48,7 @@ key_ops = ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey"] key_name = "rsaKeyName" rsa_key = client.create_rsa_key(key_name, size=key_size, key_operations=key_ops) -print("RSA Key with name '{0}' created of type '{1}'.".format(rsa_key.name, rsa_key.key_type)) +print(f"RSA Key with name '{rsa_key.name}' created of type '{rsa_key.key_type}'") # Let's create an Elliptic Curve key with algorithm curve type P-256. # if the key already exists in the Key Vault, then a new version of the key is created. @@ -56,12 +56,12 @@ key_curve = "P-256" key_name = "ECKeyName" ec_key = client.create_ec_key(key_name, curve=key_curve) -print("EC Key with name '{0}' created of type '{1}'.".format(ec_key.name, ec_key.key_type)) +print(f"EC Key with name '{ec_key.name}' created of type '{ec_key.key_type}'") # Let's get the rsa key details using its name print("\n.. Get a Key by its name") rsa_key = client.get_key(rsa_key.name) -print("Key with name '{0}' was found.".format(rsa_key.name)) +print(f"Key with name '{rsa_key.name}' was found.") # Let's say we want to update the expiration time for the EC key and disable the key to be usable # for cryptographic operations. The update method allows the user to modify the metadata (key attributes) @@ -72,17 +72,15 @@ ec_key.name, ec_key.properties.version, expires_on=expires, enabled=False ) print( - "Key with name '{0}' was updated on date '{1}'".format(updated_ec_key.name, updated_ec_key.properties.updated_on) + f"Key with name '{updated_ec_key.name}' was updated on date '{updated_ec_key.properties.updated_on}'" ) print( - "Key with name '{0}' was updated to expire on '{1}'".format( - updated_ec_key.name, updated_ec_key.properties.expires_on - ) + f"Key with name '{updated_ec_key.name}' was updated to expire on '{updated_ec_key.properties.expires_on}'" ) # The RSA key is no longer used, need to delete it from the Key Vault. print("\n.. Delete Keys") client.begin_delete_key(ec_key.name) client.begin_delete_key(rsa_key.name) -print("Deleted key '{0}'".format(ec_key.name)) -print("Deleted key '{0}'".format(rsa_key.name)) +print(f"Deleted key '{ec_key.name}'") +print(f"Deleted key '{rsa_key.name}'") From 4abe827d52a7e1c5466f1569b58822e8e82638d9 Mon Sep 17 00:00:00 2001 From: Yujin Cho Date: Sat, 20 Aug 2022 15:37:33 +0900 Subject: [PATCH 2/7] Fix drop python 3.6 --- .../azure-ai-language-conversations/CHANGELOG.md | 1 + .../azure-ai-language-conversations/README.md | 3 ++- .../azure-ai-language-conversations/samples/README.md | 2 +- sdk/cognitivelanguage/azure-ai-language-conversations/setup.py | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md index de31fb6099a0..333cc5d6bc16 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bugs Fixed ### Other Changes +* This version and all future versions will require Python 3.7+. Python 3.6 is no longer supported. ## 1.1.0b2 (2022-07-01) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index 6cc4906862e0..9022df38c0aa 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -12,13 +12,14 @@ Conversational Language Understanding - aka **CLU** for short - is a cloud-based ## _Disclaimer_ _Azure SDK Python packages support for Python 2.7 ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ +_Python 3.7 or later is required to use this package. For more details, please refer to [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy)._ ## Getting started ### Prerequisites -* Python 3.6 or later is required to use this package. +* Python 3.7 or later is required to use this package. * An [Azure subscription][azure_subscription] * An existing Azure Language Service Resource diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md index 8207514c83e8..c6ffcec5f241 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md @@ -31,7 +31,7 @@ These sample programs show common scenarios for the Conversational Language Unde ## Prerequisites -- Python 3.6 or later is required to use this package. +- Python 3.7 or later is required to use this package. - You must have an [Azure subscription][azure_subscription] and an [Azure CLU account][azure_clu_account] to run these samples. diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py b/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py index 7e5d1c2296b5..26191bf3d4ca 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py @@ -50,14 +50,13 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "License :: OSI Approved :: MIT License", ], - python_requires=">=3.6", + python_requires=">=3.7", zip_safe=False, packages=find_packages(exclude=[ 'tests', From 0fb568f1d2d5e0366367596250fe15f5f7fe3ae6 Mon Sep 17 00:00:00 2001 From: Yujin Cho Date: Sat, 20 Aug 2022 16:55:29 +0900 Subject: [PATCH 3/7] style: revert keyvault --- .../samples/hello_world.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py index ca37333f37d0..1ce6fd2d3ecd 100644 --- a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py +++ b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py @@ -15,9 +15,8 @@ # # 3. Set environment variable VAULT_URL with the URL of your key vault # -# 4. Set up your environment to use azure-identity's DefaultAzureCredential. To authenticate a service principal with -# environment variables, set AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID -# (See https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/keyvault/azure-keyvault-keys#authenticate-the-client) +# 4. Set up your environment to use azure-identity's DefaultAzureCredential. For more information about how to configure +# the DefaultAzureCredential, refer to https://aka.ms/azsdk/python/identity/docs#azure.identity.DefaultAzureCredential # # 5. Key create, get, update, and delete permissions for your service principal in your vault # @@ -48,7 +47,7 @@ key_ops = ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey"] key_name = "rsaKeyName" rsa_key = client.create_rsa_key(key_name, size=key_size, key_operations=key_ops) -print(f"RSA Key with name '{rsa_key.name}' created of type '{rsa_key.key_type}'") +print("RSA Key with name '{0}' created of type '{1}'.".format(rsa_key.name, rsa_key.key_type)) # Let's create an Elliptic Curve key with algorithm curve type P-256. # if the key already exists in the Key Vault, then a new version of the key is created. @@ -56,12 +55,12 @@ key_curve = "P-256" key_name = "ECKeyName" ec_key = client.create_ec_key(key_name, curve=key_curve) -print(f"EC Key with name '{ec_key.name}' created of type '{ec_key.key_type}'") +print("EC Key with name '{0}' created of type '{1}'.".format(ec_key.name, ec_key.key_type)) # Let's get the rsa key details using its name print("\n.. Get a Key by its name") rsa_key = client.get_key(rsa_key.name) -print(f"Key with name '{rsa_key.name}' was found.") +print("Key with name '{0}' was found.".format(rsa_key.name)) # Let's say we want to update the expiration time for the EC key and disable the key to be usable # for cryptographic operations. The update method allows the user to modify the metadata (key attributes) @@ -72,15 +71,17 @@ ec_key.name, ec_key.properties.version, expires_on=expires, enabled=False ) print( - f"Key with name '{updated_ec_key.name}' was updated on date '{updated_ec_key.properties.updated_on}'" + "Key with name '{0}' was updated on date '{1}'".format(updated_ec_key.name, updated_ec_key.properties.updated_on) ) print( - f"Key with name '{updated_ec_key.name}' was updated to expire on '{updated_ec_key.properties.expires_on}'" + "Key with name '{0}' was updated to expire on '{1}'".format( + updated_ec_key.name, updated_ec_key.properties.expires_on + ) ) # The RSA key is no longer used, need to delete it from the Key Vault. print("\n.. Delete Keys") client.begin_delete_key(ec_key.name) client.begin_delete_key(rsa_key.name) -print(f"Deleted key '{ec_key.name}'") -print(f"Deleted key '{rsa_key.name}'") +print("Deleted key '{0}'".format(ec_key.name)) +print("Deleted key '{0}'".format(rsa_key.name)) \ No newline at end of file From c9150da37ad0ed8092f9c8fe9e674bd4dc6f5b36 Mon Sep 17 00:00:00 2001 From: Yujin Cho Date: Sat, 20 Aug 2022 17:00:46 +0900 Subject: [PATCH 4/7] style: revert keyvault --- sdk/keyvault/azure-keyvault-keys/samples/hello_world.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py index 1ce6fd2d3ecd..6f3d6b61c587 100644 --- a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py +++ b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py @@ -17,6 +17,7 @@ # # 4. Set up your environment to use azure-identity's DefaultAzureCredential. For more information about how to configure # the DefaultAzureCredential, refer to https://aka.ms/azsdk/python/identity/docs#azure.identity.DefaultAzureCredential +# (See https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/keyvault/azure-keyvault-keys#authenticate-the-client) # # 5. Key create, get, update, and delete permissions for your service principal in your vault # From 23a19f4ba0341584c9bacc8b00f20f769495d6ad Mon Sep 17 00:00:00 2001 From: Yujin Cho Date: Sat, 20 Aug 2022 17:06:34 +0900 Subject: [PATCH 5/7] style: revert keyvault --- sdk/keyvault/azure-keyvault-keys/samples/hello_world.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py index 6f3d6b61c587..d5d2248a16c7 100644 --- a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py +++ b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py @@ -85,4 +85,4 @@ client.begin_delete_key(ec_key.name) client.begin_delete_key(rsa_key.name) print("Deleted key '{0}'".format(ec_key.name)) -print("Deleted key '{0}'".format(rsa_key.name)) \ No newline at end of file +print("Deleted key '{0}'".format(rsa_key.name)) From 7f84f5385c3faf552aeb4e4844f4429ad60aa63c Mon Sep 17 00:00:00 2001 From: Yujin Cho Date: Sat, 20 Aug 2022 17:07:54 +0900 Subject: [PATCH 6/7] style: revert keyvault --- sdk/keyvault/azure-keyvault-keys/samples/hello_world.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py index d5d2248a16c7..e5d4290af592 100644 --- a/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py +++ b/sdk/keyvault/azure-keyvault-keys/samples/hello_world.py @@ -15,8 +15,8 @@ # # 3. Set environment variable VAULT_URL with the URL of your key vault # -# 4. Set up your environment to use azure-identity's DefaultAzureCredential. For more information about how to configure -# the DefaultAzureCredential, refer to https://aka.ms/azsdk/python/identity/docs#azure.identity.DefaultAzureCredential +# 4. Set up your environment to use azure-identity's DefaultAzureCredential. To authenticate a service principal with +# environment variables, set AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID # (See https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/keyvault/azure-keyvault-keys#authenticate-the-client) # # 5. Key create, get, update, and delete permissions for your service principal in your vault From a3804f885daed555550eb61d7ce557035ab7c29f Mon Sep 17 00:00:00 2001 From: Wonhyeong Seo Date: Tue, 23 Aug 2022 17:18:16 +0900 Subject: [PATCH 7/7] fix: README.md to only warn of python2.7 --- sdk/cognitivelanguage/azure-ai-language-conversations/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index 9022df38c0aa..cdaa26e354a3 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -12,7 +12,6 @@ Conversational Language Understanding - aka **CLU** for short - is a cloud-based ## _Disclaimer_ _Azure SDK Python packages support for Python 2.7 ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -_Python 3.7 or later is required to use this package. For more details, please refer to [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy)._ ## Getting started