change(test_idf_py): ruff formatting idf_ext.py & some_ext.py

This commit is contained in:
Marek Fiala
2025-10-02 15:34:31 +02:00
parent 207199a2bb
commit 248c3a996e
2 changed files with 24 additions and 51 deletions

View File

@@ -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': {

View File

@@ -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}},
},
}