From 248c3a996e9b1d685a0fcd97e60a7d357619f46e Mon Sep 17 00:00:00 2001 From: Marek Fiala Date: Thu, 2 Oct 2025 15:34:31 +0200 Subject: [PATCH] change(test_idf_py): ruff formatting idf_ext.py & some_ext.py --- tools/test_idf_py/extra_path/some_ext.py | 16 ++++--- tools/test_idf_py/idf_ext.py | 59 ++++++------------------ 2 files changed, 24 insertions(+), 51 deletions(-) diff --git a/tools/test_idf_py/extra_path/some_ext.py b/tools/test_idf_py/extra_path/some_ext.py index e00e529dde..2024164cdf 100644 --- a/tools/test_idf_py/extra_path/some_ext.py +++ b/tools/test_idf_py/extra_path/some_ext.py @@ -1,18 +1,20 @@ -# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 def action_extensions(base_actions, project_path): def some_callback(ut_apply_config_name, ctx, args): print('!!! From some subcommand') def some_global_callback(ctx, global_args, tasks): - print('!!! From some global callback: %s' % global_args.some_extension_option) + print(f'!!! From some global callback: {global_args.some_extension_option}') return { - 'global_options': [{ - 'names': ['--some-extension-option'], - 'help': 'Help for option --some-extension-option', - 'default': 'test', - }], + 'global_options': [ + { + 'names': ['--some-extension-option'], + 'help': 'Help for option --some-extension-option', + 'default': 'test', + } + ], 'global_action_callbacks': [some_global_callback], 'actions': { 'extra_subcommand': { diff --git a/tools/test_idf_py/idf_ext.py b/tools/test_idf_py/idf_ext.py index 9396bcf352..fbc555432f 100644 --- a/tools/test_idf_py/idf_ext.py +++ b/tools/test_idf_py/idf_ext.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 def action_extensions(base_actions, project_path=None): def echo(name, *args, **kwargs): @@ -12,44 +12,19 @@ def action_extensions(base_actions, project_path=None): # Add global options extensions = { 'global_options': [ - { - 'names': ['--test-0'], - 'help': 'Non-deprecated option.', - 'deprecated': False - }, - { - 'names': ['--test-1'], - 'help': 'Deprecated option 1.', - 'deprecated': True - }, - { - 'names': ['--test-2'], - 'help': 'Deprecated option 2.', - 'deprecated': 'Please update your parameters.' - }, + {'names': ['--test-0'], 'help': 'Non-deprecated option.', 'deprecated': False}, + {'names': ['--test-1'], 'help': 'Deprecated option 1.', 'deprecated': True}, + {'names': ['--test-2'], 'help': 'Deprecated option 2.', 'deprecated': 'Please update your parameters.'}, { 'names': ['--test-3'], 'help': 'Deprecated option 3.', - 'deprecated': { - 'custom_message': 'Please update your parameters.' - } - }, - { - 'names': ['--test-4'], - 'help': 'Deprecated option 4.', - 'deprecated': { - 'since': 'v4.0', - 'removed': 'v5.0' - } + 'deprecated': {'custom_message': 'Please update your parameters.'}, }, + {'names': ['--test-4'], 'help': 'Deprecated option 4.', 'deprecated': {'since': 'v4.0', 'removed': 'v5.0'}}, { 'names': ['--test-5'], 'help': 'Deprecated option 5.', - 'deprecated': { - 'since': 'v2.0', - 'removed': 'v3.0', - 'exit_with_error': True - } + 'deprecated': {'since': 'v2.0', 'removed': 'v3.0', 'exit_with_error': True}, }, ], 'actions': { @@ -70,25 +45,21 @@ def action_extensions(base_actions, project_path=None): 'names': ['--test-sub-1'], 'help': 'Deprecated subcommand option 1', 'default': None, - 'deprecated': True + 'deprecated': True, }, ], - 'arguments': [{ - 'names': ['test-arg-0'], - }], + 'arguments': [ + { + 'names': ['test-arg-0'], + } + ], }, 'test-1': { 'callback': echo, 'help': 'Deprecated command 1', - 'deprecated': 'Please use alternative command.' - }, - 'test-2': { - 'callback': echo, - 'help': 'Deprecated command 2', - 'deprecated': { - 'exit_with_error': True - } + 'deprecated': 'Please use alternative command.', }, + 'test-2': {'callback': echo, 'help': 'Deprecated command 2', 'deprecated': {'exit_with_error': True}}, }, }