Skip to content

Commit fac161e

Browse files
RenSilvaAUCopilot
andauthored
{Core} aaz: Wrap functools.partial in staticmethod() to remove FutureWarning (#31973)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c789524 commit fac161e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/azure-cli-core/azure/cli/core/aaz/_command.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,15 @@ def decorator(cls):
327327
helps[name] = yaml.safe_dump(cls.AZ_HELP)
328328

329329
if is_preview:
330-
cls.AZ_PREVIEW_INFO = partial(PreviewItem, target=f'az {name}', object_type='command group')
330+
cls.AZ_PREVIEW_INFO = staticmethod(partial(PreviewItem,
331+
target=f'az {name}', object_type='command group'))
331332
if is_experimental:
332-
cls.AZ_EXPERIMENTAL_INFO = partial(ExperimentalItem, target=f'az {name}', object_type='command group')
333+
cls.AZ_EXPERIMENTAL_INFO = staticmethod(partial(ExperimentalItem,
334+
target=f'az {name}', object_type='command group'))
333335
if deprecated_info:
334-
cls.AZ_DEPRECATE_INFO = partial(Deprecated, target=f'az {name}', object_type='command group',
335-
**deprecated_info)
336+
cls.AZ_DEPRECATE_INFO = staticmethod(partial(Deprecated,
337+
target=f'az {name}', object_type='command group',
338+
**deprecated_info))
336339
return cls
337340

338341
return decorator
@@ -369,11 +372,13 @@ def decorator(cls):
369372
if confirmation:
370373
cls.AZ_CONFIRMATION = confirmation
371374
if is_preview:
372-
cls.AZ_PREVIEW_INFO = partial(PreviewItem, target=f'az {name}', object_type='command')
375+
cls.AZ_PREVIEW_INFO = staticmethod(partial(PreviewItem, target=f'az {name}', object_type='command'))
373376
if is_experimental:
374-
cls.AZ_EXPERIMENTAL_INFO = partial(ExperimentalItem, target=f'az {name}', object_type='command')
377+
cls.AZ_EXPERIMENTAL_INFO = staticmethod(partial(ExperimentalItem,
378+
target=f'az {name}', object_type='command'))
375379
if deprecated_info:
376-
cls.AZ_DEPRECATE_INFO = partial(Deprecated, target=f'az {name}', object_type='command', **deprecated_info)
380+
cls.AZ_DEPRECATE_INFO = staticmethod(partial(Deprecated, target=f'az {name}',
381+
object_type='command', **deprecated_info))
377382
return cls
378383

379384
return decorator

0 commit comments

Comments
 (0)