From b4973298d0170a4e568ce58619ec415346bffb3f Mon Sep 17 00:00:00 2001 From: Ren Silva Date: Tue, 26 Aug 2025 16:08:47 +1000 Subject: [PATCH] {Core} `aaz`: Wrap `functools.partial` in `staticmethod()` to remove FutureWarning (#31973) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../azure/cli/core/aaz/_command.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/aaz/_command.py b/src/azure-cli-core/azure/cli/core/aaz/_command.py index 9c9105b8ada..577d8a7cf45 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_command.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_command.py @@ -327,12 +327,15 @@ def decorator(cls): helps[name] = yaml.safe_dump(cls.AZ_HELP) if is_preview: - cls.AZ_PREVIEW_INFO = partial(PreviewItem, target=f'az {name}', object_type='command group') + cls.AZ_PREVIEW_INFO = staticmethod(partial(PreviewItem, + target=f'az {name}', object_type='command group')) if is_experimental: - cls.AZ_EXPERIMENTAL_INFO = partial(ExperimentalItem, target=f'az {name}', object_type='command group') + cls.AZ_EXPERIMENTAL_INFO = staticmethod(partial(ExperimentalItem, + target=f'az {name}', object_type='command group')) if deprecated_info: - cls.AZ_DEPRECATE_INFO = partial(Deprecated, target=f'az {name}', object_type='command group', - **deprecated_info) + cls.AZ_DEPRECATE_INFO = staticmethod(partial(Deprecated, + target=f'az {name}', object_type='command group', + **deprecated_info)) return cls return decorator @@ -369,11 +372,13 @@ def decorator(cls): if confirmation: cls.AZ_CONFIRMATION = confirmation if is_preview: - cls.AZ_PREVIEW_INFO = partial(PreviewItem, target=f'az {name}', object_type='command') + cls.AZ_PREVIEW_INFO = staticmethod(partial(PreviewItem, target=f'az {name}', object_type='command')) if is_experimental: - cls.AZ_EXPERIMENTAL_INFO = partial(ExperimentalItem, target=f'az {name}', object_type='command') + cls.AZ_EXPERIMENTAL_INFO = staticmethod(partial(ExperimentalItem, + target=f'az {name}', object_type='command')) if deprecated_info: - cls.AZ_DEPRECATE_INFO = partial(Deprecated, target=f'az {name}', object_type='command', **deprecated_info) + cls.AZ_DEPRECATE_INFO = staticmethod(partial(Deprecated, target=f'az {name}', + object_type='command', **deprecated_info)) return cls return decorator