Skip to content

Commit 5fd4e9d

Browse files
authored
[Key Vault] Drop six package in KV (Azure#27377)
1 parent 415d8b6 commit 5fd4e9d

File tree

26 files changed

+59
-91
lines changed

26 files changed

+59
-91
lines changed

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_backup_client.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import pickle
88
from typing import TYPE_CHECKING
99

10-
from six import raise_from
11-
from six.moves.urllib_parse import urlparse
10+
from urllib.parse import urlparse
1211

1312
from ._models import KeyVaultBackupResult
1413
from ._internal import KeyVaultClientBase, parse_folder_url
@@ -73,13 +72,10 @@ def begin_backup(self, blob_storage_url, sas_token, **kwargs):
7372
try:
7473
job_id = _parse_status_url(status_url)
7574
except Exception as ex: # pylint: disable=broad-except
76-
raise_from(
77-
ValueError(
78-
"The provided continuation_token is malformed. A valid token can be obtained from the "
79-
+ "operation poller's continuation_token() method"
80-
),
81-
ex,
82-
)
75+
raise ValueError(
76+
"The provided continuation_token is malformed. A valid token can be obtained from the "
77+
+ "operation poller's continuation_token() method"
78+
) from ex
8379

8480
pipeline_response = self._client.full_backup_status(
8581
vault_base_url=self._vault_url, job_id=job_id, cls=lambda pipeline_response, _, __: pipeline_response
@@ -138,13 +134,10 @@ def begin_restore(self, folder_url, sas_token, **kwargs):
138134
try:
139135
job_id = _parse_status_url(status_url)
140136
except Exception as ex: # pylint: disable=broad-except
141-
raise_from(
142-
ValueError(
143-
"The provided continuation_token is malformed. A valid token can be obtained from the "
144-
+ "operation poller's continuation_token() method"
145-
),
146-
ex,
147-
)
137+
raise ValueError(
138+
"The provided continuation_token is malformed. A valid token can be obtained from the "
139+
+ "operation poller's continuation_token() method"
140+
) from ex
148141

149142
pipeline_response = self._client.restore_status(
150143
vault_base_url=self._vault_url, job_id=job_id, cls=lambda pipeline_response, _, __: pipeline_response

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_enums.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@
33
# Licensed under the MIT License.
44
# ------------------------------------
55
from enum import Enum
6-
from six import with_metaclass
76

87
from azure.core import CaseInsensitiveEnumMeta
98

10-
# pylint:skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713)
119

12-
13-
class KeyVaultRoleScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
10+
class KeyVaultRoleScope(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1411
"""Collection of well known role scopes. This list is not exhaustive."""
1512

1613
GLOBAL = "/" #: use this if you want role assignments to apply to everything on the resource
1714
KEYS = "/keys" #: use this if you want role assignments to apply to all keys
1815

1916

20-
class KeyVaultDataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
17+
class KeyVaultDataAction(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2118
"""Supported permissions for data actions."""
2219

2320
#: Read HSM key metadata.

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_internal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------
55
from collections import namedtuple
66

7-
from six.moves.urllib_parse import urlparse
7+
from urllib.parse import urlparse
88

99
from .challenge_auth_policy import ChallengeAuthPolicy
1010
from .client_base import KeyVaultClientBase

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_internal/client_base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
# ------------------------------------
5-
# pylint:skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713)
5+
66
from typing import TYPE_CHECKING
77
from enum import Enum
8-
from six import with_metaclass
98

109
from azure.core import CaseInsensitiveEnumMeta
1110
from azure.core.pipeline.policies import HttpLoggingPolicy
@@ -20,7 +19,7 @@
2019
from azure.core.credentials import TokenCredential
2120

2221

23-
class ApiVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
22+
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2423
"""Key Vault API versions supported by this package"""
2524

2625
#: this is the default version

sdk/keyvault/azure-keyvault-administration/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"azure-common~=1.1",
7171
"azure-core<2.0.0,>=1.24.0",
7272
"isodate>=0.6.1",
73-
"six>=1.11.0",
7473
"typing-extensions>=4.0.1",
7574
],
7675
)

sdk/keyvault/azure-keyvault-administration/tests/_shared/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the MIT License.
44
# ------------------------------------
55
import json
6-
import six
6+
from urllib import parse
77

88
try:
99
from unittest import mock
@@ -47,7 +47,7 @@ def add_discrepancy(name, expected, actual):
4747
if self.url_substring and self.url_substring not in request.url:
4848
add_discrepancy("url substring", self.url_substring, request.url)
4949

50-
parsed = six.moves.urllib_parse.urlparse(request.url)
50+
parsed = parse.urlparse(request.url)
5151
if self.authority and parsed.netloc != self.authority:
5252
add_discrepancy("authority", self.authority, parsed.netloc)
5353

sdk/keyvault/azure-keyvault-administration/tests/_shared/json_attribute_matcher.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
# ------------------------------------
55
import json
66

7-
import six
8-
97
_has_json_body = lambda req: req.body and "json" in req.headers.get("Content-Type", "")
108

119

1210
def json_attribute_matcher(r1, r2):
1311
"""Tests whether two vcr.py requests have JSON content with identical attributes (ignoring values)."""
1412

1513
if _has_json_body(r1) and _has_json_body(r2):
16-
c1 = json.loads(six.ensure_str(r1.body))
17-
c2 = json.loads(six.ensure_str(r2.body))
14+
c1 = json.loads(str(r1.body))
15+
c2 = json.loads(str(r2.body))
1816
assert sorted(c1.keys()) == sorted(c2.keys())

sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_enums.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
# ------------------------------------
5-
# pylint:skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713)
5+
6+
# pylint: disable=enum-must-be-uppercase
7+
68
from enum import Enum
7-
from six import with_metaclass
89

910
from azure.core import CaseInsensitiveEnumMeta
1011

1112

12-
class CertificatePolicyAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
13+
class CertificatePolicyAction(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1314
"""The supported action types for the lifetime of a certificate"""
1415

1516
email_contacts = "EmailContacts"
1617
auto_renew = "AutoRenew"
1718

1819

19-
class CertificateContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
20+
class CertificateContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2021
"""Content type of the secrets as specified in Certificate Policy"""
2122

2223
pkcs12 = "application/x-pkcs12"
2324
pem = "application/x-pem-file"
2425

2526

26-
class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
27+
class KeyUsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2728
"""The supported types of key usages"""
2829

2930
digital_signature = "digitalSignature"
@@ -37,7 +38,7 @@ class KeyUsageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
3738
decipher_only = "decipherOnly"
3839

3940

40-
class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
41+
class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
4142
"""Supported key types"""
4243

4344
ec = "EC" #: Elliptic Curve
@@ -55,7 +56,7 @@ def _missing_(cls, value):
5556
raise ValueError(f"{value} is not a valid KeyType")
5657

5758

58-
class KeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
59+
class KeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
5960
"""Supported elliptic curves"""
6061

6162
p_256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1.
@@ -64,7 +65,7 @@ class KeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
6465
p_256_k = "P-256K" #: The SECG SECP256K1 elliptic curve.
6566

6667

67-
class WellKnownIssuerNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
68+
class WellKnownIssuerNames(str, Enum, metaclass=CaseInsensitiveEnumMeta):
6869
"""Collection of well-known issuer names"""
6970

7071
self = "Self" #: Use this issuer for a self-signed certificate

sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_shared/client_base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
# ------------------------------------
5-
# pylint:skip-file (avoids crash due to six.with_metaclass https://github.com/PyCQA/astroid/issues/713)
65
from typing import TYPE_CHECKING
76
from enum import Enum
8-
from six import with_metaclass
97

108
from azure.core import CaseInsensitiveEnumMeta
119
from azure.core.pipeline.policies import HttpLoggingPolicy
@@ -20,7 +18,7 @@
2018
from azure.core.credentials import TokenCredential
2119

2220

23-
class ApiVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
21+
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2422
"""Key Vault API versions supported by this package"""
2523

2624
#: this is the default version

sdk/keyvault/azure-keyvault-certificates/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"azure-common~=1.1",
7171
"azure-core<2.0.0,>=1.24.0",
7272
"isodate>=0.6.1",
73-
"six>=1.11.0",
7473
"typing-extensions>=4.0.1",
7574
],
7675
)

0 commit comments

Comments
 (0)