diff --git a/src/pydo/_patch.py b/src/pydo/_patch.py index 350d70fd..6629ecc0 100644 --- a/src/pydo/_patch.py +++ b/src/pydo/_patch.py @@ -59,3 +59,4 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from pydo.operations import _patch # pylint: disable=unused-import, no-name-in-module diff --git a/src/pydo/aio/_patch.py b/src/pydo/aio/_patch.py index 37d16e19..121205d9 100644 --- a/src/pydo/aio/_patch.py +++ b/src/pydo/aio/_patch.py @@ -64,3 +64,4 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from pydo.aio.operations import _patch # pylint: disable=unused-import, no-name-in-module diff --git a/src/pydo/aio/operations/_patch.py b/src/pydo/aio/operations/_patch.py index 39ea63f6..2bd3e871 100644 --- a/src/pydo/aio/operations/_patch.py +++ b/src/pydo/aio/operations/_patch.py @@ -1,26 +1,28 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. +"""This file is for patching generated code.""" +import functools +from typing import Any, Callable -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import TYPE_CHECKING +from ._operations import RegistryOperations -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import List -__all__ = ( - [] -) # type: List[str] # Add all objects you want publicly available to users at this package level +def patch_registry_delete_repository_manifest( + func: Callable[..., Any] +) -> Callable[..., Any]: + """This patch is to address a bug in the DO API. + The delete_repository_manifest endpoint does not support url encoding. + This patch will skip url encoding for the manifest_digest parameter. + """ -def patch_sdk(): - """Do not remove from this file. + @functools.wraps(func) + def wrapper( + self, manifest_digest: str, *args: Any, **kwargs: Any + ) -> Callable[..., Any]: + return func(self, manifest_digest, *args, **kwargs, _skip_url_encoding=True) - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ + return wrapper + + +RegistryOperations.delete_repository_manifest = patch_registry_delete_repository_manifest( + RegistryOperations.delete_repository_manifest +) \ No newline at end of file diff --git a/src/pydo/operations/_patch.py b/src/pydo/operations/_patch.py index 8a843f7c..9d8c3f7a 100644 --- a/src/pydo/operations/_patch.py +++ b/src/pydo/operations/_patch.py @@ -1,27 +1,29 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +"""This file is for patching generated code. """ -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable + +from ._operations import RegistryOperations -from ._operations import DropletsOperations as Droplets -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - pass +def patch_registry_delete_repository_manifest( + func: Callable[..., Any] +) -> Callable[..., Any]: + """This patch is to address a bug in the DO API. + The delete_repository_manifest endpoint does not support url encoding. + This patch will skip url encoding for the manifest_digest parameter. + """ -__all__ = [] + @functools.wraps(func) + def wrapper( + self, manifest_digest: str, *args: Any, **kwargs: Any + ) -> Callable[..., Any]: + return func(self, manifest_digest, *args, **kwargs, _skip_url_encoding=True) + return wrapper -def patch_sdk(): - """Do not remove from this file. - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ +RegistryOperations.delete_repository_manifest = patch_registry_delete_repository_manifest( + RegistryOperations.delete_repository_manifest +) \ No newline at end of file