-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[KeyVault] Remove references to six package #25902
Conversation
Thank you for your contribution ponopono0322! We will review the pull request and get back to you soon. |
Summary of changes
link = "https://azure.microsoft.com/en-us/"
# Before
import six
q = six.moves.urllib_parse.urlparse(link)
print(p)
# >>> ParseResult(scheme='https', netloc='azure.microsoft.com', path='/en-us/', params='', query='', fragment='')
# After
from urllib import parse
p = parse.urlparse(link)
print(q)
# >>> ParseResult(scheme='https', netloc='azure.microsoft.com', path='/en-us/', params='', query='', fragment='')
# Before
from six import raise_from
try:
zero_div = 1 / 0
except Exception as ex:
raise_from(ValueError("zero div"), ex, )
# >>> ValueError: zero div
# After
try:
zero_div = 1 / 0
except Exception as ex:
raise ValueError("zero div") from ex
# >>> ValueError: zero div
from enum import Enum, EnumMeta
class _CaseInsensitiveEnumMeta(EnumMeta):
def __getitem__(self, name):
return super().__getitem__(name.upper())
def __getattr__(cls, name):
try:
return cls._member_map_[name.upper()]
except KeyError:
raise AttributeError(name)
# Before
from six import with_metaclass
class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
PURGEABLE = "Purgeable"
RECOVERABLE_PURGEABLE = "Recoverable+Purgeable"
RECOVERABLE = "Recoverable"
RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription"
CUSTOMIZED_RECOVERABLE_PURGEABLE = "CustomizedRecoverable+Purgeable"
CUSTOMIZED_RECOVERABLE = "CustomizedRecoverable"
CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription"
print(type(DeletionRecoveryLevel), DeletionRecoveryLevel)
print(type(DeletionRecoveryLevel.PURGEABLE), DeletionRecoveryLevel.PURGEABLE)
# >>> <class '__main__._CaseInsensitiveEnumMeta'> <enum 'DeletionRecoveryLevel'>
# >>> <enum 'DeletionRecoveryLevel'> DeletionRecoveryLevel.PURGEABLE
# After
class DeletionRecoveryLevel(str, Enum, metaclass=_CaseInsensitiveEnumMeta):
PURGEABLE = "Purgeable"
RECOVERABLE_PURGEABLE = "Recoverable+Purgeable"
RECOVERABLE = "Recoverable"
RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription"
CUSTOMIZED_RECOVERABLE_PURGEABLE = "CustomizedRecoverable+Purgeable"
CUSTOMIZED_RECOVERABLE = "CustomizedRecoverable"
CUSTOMIZED_RECOVERABLE_PROTECTED_SUBSCRIPTION = "CustomizedRecoverable+ProtectedSubscription"
print(type(DeletionRecoveryLevel), DeletionRecoveryLevel)
print(type(DeletionRecoveryLevel.PURGEABLE), DeletionRecoveryLevel.PURGEABLE)
# >>> <class '__main__._CaseInsensitiveEnumMeta'> <enum 'DeletionRecoveryLevel'>
# >>> <enum 'DeletionRecoveryLevel'> DeletionRecoveryLevel.PURGEABLE
r1 = """{"body": "something", "header": "anything"}"""
# Before
import six
print(type(six.ensure_str(r1)))
# >>> <class 'str'>
# After
print(type(str(r1)))
# >>> <class 'str'>
# Before
import six
print("True") if isinstance("key", six.string_types) else print("False")
# >>> True
# After
print("True") if isinstance("key", str) else print("False")
# >>> True
bs = bytes(5)
# Before
import six
print(bs, type(six.byte2int(bs)), six.byte2int(bs))
# >>> b'\x00\x00\x00\x00\x00' <class 'int'> 0
# After
print(bs, type(bs[0]), bs[0])
# >>> b'\x00\x00\x00\x00\x00' <class 'int'> 0 I checked it reference, type and some tests, but it still needs to be modified. I ran a test proxy for clear results, but I couldn't confirm that it was working properly due to POST error at the moment (even in the main branch).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for opening a PR! I'll follow up on the generated code's use of six.with_metaclass
and will let you know if I can fix that in a separate PR.
sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_enums.py
Outdated
Show resolved
Hide resolved
...ministration/azure/keyvault/administration/_generated/v7_2/models/_key_vault_client_enums.py
Outdated
Show resolved
Hide resolved
...eyvault/azure-keyvault-administration/azure/keyvault/administration/_internal/client_base.py
Outdated
Show resolved
Hide resolved
sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_enums.py
Outdated
Show resolved
Hide resolved
sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated_models.py
Show resolved
Hide resolved
Remove pylint: skip-file six.with_metaclass
Closing in favor of #26150 |
Release app microsoft.app 2023 08 01 preview (Azure#26352) * Adds base for updating Microsoft.App from version preview/2023-05-02-preview to version 2023-08-01-preview * Updates readme * Updates API version in new specs and examples * Add type to Certificate (Azure#25380) * Add type to Certificate * lint * Add gpus property to AvailableWorkloadProfiles. (Azure#25328) * Add gpus property to AvailableWorkloadProfiles. * Fix. * Pauld/re add build and builder (Azure#25442) * cherry picked the build and builder updates * some more cleanup * added arm id format, removed extra properties, and named the resource provisioning states * Add OT and AI config (Azure#25350) * Add OT and AI config * resolve comments * Add service bind properties to dapr component (Azure#25781) * dapr component sb-bind definition add * fix * ran npx prettier * npx prettier --------- Co-authored-by: bgashirabake@gmail.com <bgashirabake@microsoft.com> * Adding patching scenario ARM API (Azure#25446) * cherry picked the build and builder updates * some more cleanup * Adding patching scenario and samples * Added to readme * Lint fix * Linting * Linting error fix * Addressed comments and added extra properties * Linting * Fixing patch skip post action * Linting * Addressing comments * Reverting patchDetails changes * Fixing pipeline error * Linting * Removed invalid required tag * Fixed examples * Addressed comments --------- Co-authored-by: Paul Dorsch <107068277+pauld-msft@users.noreply.github.com> Co-authored-by: Paul Dorsch <pauldorsch@microsoft.com> * Update microsoft.app 2023-08-01-preview for new DaprSubscription API feature (Azure#25631) * ACA Dapr Subscription: WIP Signed-off-by: Bernd Verst <github@bernd.dev> * Add Dapr Subscription examples Signed-off-by: Bernd Verst <github@bernd.dev> * complete examples Signed-off-by: Bernd Verst <github@bernd.dev> * Add DaprSubscription descriptions Signed-off-by: Bernd Verst <github@bernd.dev> * include updated readme Signed-off-by: Bernd Verst <github@bernd.dev> * fix casing Signed-off-by: Bernd Verst <github@bernd.dev> * formatting Signed-off-by: Bernd Verst <github@bernd.dev> * Use Types v5 Signed-off-by: Bernd Verst <github@bernd.dev> * Revert "Use Types v5" v5 causes several mysterious SDK build errors in this branch on this PR. To avoid this error we will stick to v3 for now. We will upgrade to v5 in a future net new branch. This reverts commit 6a43aacf16132ff1918cbeb9d9b15c74b3a55a78. --------- Signed-off-by: Bernd Verst <github@bernd.dev> * Support log streaming on build resource (Azure#25902) * updated the build resource to support build upload and log streaming, with a token to be passed in via header * add x-ms-secret and update buildendpoint -> endpoint * retrieve log stream and upload endpoint tokens through post requests, as they are secrets * remove secret flag from tokenendpoint property, as we expect users to retrieve it * rename file * updated format of how build object returns auth token * fix example * added expiration date to token response * fix auth token to also include build resource information * renamed getAuthToken -> listAuthToken and removed resource information from token response * fix examples * updated samples to be more accurate * Update serviceBinds with clientType and customizedKeys (Azure#26111) * Update serviceBinds with clientType and customizedKeys * force ci * fix missing } --------- Co-authored-by: Ahmed ElSayed <ahmels@microsoft.com> * Adds new Dapr Component Resiliency Feature to existing version `Release app microsoft.app 2023 08 01 preview` (Azure#26107) * Add Dapr Component Resiliency Policies APIs to ContainerApps 2023-08-01-preview Signed-off-by: Bernd Verst <github@bernd.dev> * Update deletion return code * Fix variable name * Remove invalid status code from example * prettify * Register new resource in readme * Remove existing import cycle * Use integers not integer strings * Fix delete status codes * More changes * Update examples * Revert "Remove existing import cycle" which causes unrelated failures This reverts commit 8ce1a74f9d12b333c43c324f1b2250a64a0f1add. --------- Signed-off-by: Bernd Verst <github@bernd.dev> * Add API spec for ContainerApp Resiliency (Azure#25732) Signed-off-by: Hal Spang <halspang@microsoft.com> * Add extendedlocation for job (Azure#26196) * Add extendedlocation for job * Add sample for container apps on connectedEnvironment * Fixes for examples * Fix connected environment example * Update old examples * removing SourceToCloud patching from 08-01-preview (Azure#26245) * Add diagnostic routes to Container App Jobs (Azure#26227) * Add diagnostic routes to Container App Jobs * Update * Update * Update * Update * Update * Update * Update operationIds --------- Co-authored-by: Michimune Kohno <mikono@microsoft.com> * Update app resiliency rest api spec (#26357) Signed-off-by: Yash Nisar <yashnisar@microsoft.com> * Fix ACA component resiliency examples (Azure#26441) * Fix arm review comments for container app (Azure#26455) * update * update * update * Fix SDK build error for Microsoft.App (Azure#26416) * Fix SDK build error for Microsoft.App * Update * update * update * update --------- Co-authored-by: Michimune Kohno <mikono@microsoft.com> * Fix arm review comments for container app (Azure#26479) * fix * update * update * Fix detectorProperties request path (Azure#26431) * fix list exception * change param to enum * fix lint error * revert not working changes * fix enum * rearrange --------- Co-authored-by: Chenghui Yu <chenghuiyu@microsoft.com> * Enable dynamicJsonColumns for log analytics configuration (Azure#26432) * Enable dynamicJsonColumn for log analysis configuration * Add missed s * Fix code style * Update container app usages value to float (Azure#26448) * update * update * update * Fix App Resiliency retry example (Azure#26560) Signed-off-by: Yash Nisar <yashnisar@microsoft.com> * Fix lint warning for container app (Azure#26523) * fix warning * fix warning * upate --------- Signed-off-by: Bernd Verst <github@bernd.dev> Signed-off-by: Hal Spang <halspang@microsoft.com> Signed-off-by: Yash Nisar <yashnisar@microsoft.com> Co-authored-by: zhenqxuMSFT <zhenqxu@microsoft.com> Co-authored-by: yalixiang <88011184+yalixiang@users.noreply.github.com> Co-authored-by: Paul Dorsch <107068277+pauld-msft@users.noreply.github.com> Co-authored-by: Michael Dai <michaelkira@live.cn> Co-authored-by: bgashirabake <85650284+bgashirabake@users.noreply.github.com> Co-authored-by: bgashirabake@gmail.com <bgashirabake@microsoft.com> Co-authored-by: Harry Li <110055355+harryli0108@users.noreply.github.com> Co-authored-by: Paul Dorsch <pauldorsch@microsoft.com> Co-authored-by: Bernd Verst <bernd.verst@microsoft.com> Co-authored-by: Ahmed ElSayed <ahmed@elsayed.io> Co-authored-by: Ahmed ElSayed <ahmels@microsoft.com> Co-authored-by: halspang <70976921+halspang@users.noreply.github.com> Co-authored-by: LaylaLiu-gmail <38268900+LaylaLiu-gmail@users.noreply.github.com> Co-authored-by: michimune <michimune@outlook.com> Co-authored-by: Michimune Kohno <mikono@microsoft.com> Co-authored-by: Yash Nisar <yashnisar@microsoft.com> Co-authored-by: Seris370 <38371667+Seris370@users.noreply.github.com> Co-authored-by: Chenghui Yu <chenghuiyu@microsoft.com>
Description
Fix #22373.
Removed
six
packageAll SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines