fix(diag): ruff-format fixes from pre-commit

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-06-11 16:55:13 +02:00
parent b2da8aae45
commit ef9e76236d

View File

@@ -8,12 +8,14 @@ from typing import Optional
from typing import Tuple from typing import Tuple
import click import click
from idf_py_actions.tools import PropertyDict from idf_py_actions.tools import PropertyDict
from idf_py_actions.tools import RunTool from idf_py_actions.tools import RunTool
from idf_py_actions.tools import yellow_print from idf_py_actions.tools import yellow_print
def diag(action: str, def diag(
action: str,
ctx: click.core.Context, ctx: click.core.Context,
args: PropertyDict, args: PropertyDict,
debug: bool, debug: bool,
@@ -27,8 +29,8 @@ def diag(action: str,
cmdl_tags: Tuple, cmdl_tags: Tuple,
purge_file: Optional[str], purge_file: Optional[str],
append: bool, append: bool,
output: Optional[str]) -> None: output: Optional[str],
) -> None:
diag_args: list = [sys.executable, '-m', 'esp_idf_diag'] diag_args: list = [sys.executable, '-m', 'esp_idf_diag']
def add_common_arguments(diag_args: list) -> None: def add_common_arguments(diag_args: list) -> None:
@@ -103,10 +105,14 @@ def diag(action: str,
if args.port: if args.port:
diag_args += ['--port', args.port] diag_args += ['--port', args.port]
else: else:
yellow_print( ( 'The target serial port is not specified, so ' yellow_print(
(
'The target serial port is not specified, so '
'autodetection will be used. To set it manually, use ' 'autodetection will be used. To set it manually, use '
'the "--port" option. Example: "idf.py --port ' 'the "--port" option. Example: "idf.py --port '
'/dev/ttyUSB0 diag".')) '/dev/ttyUSB0 diag".'
)
)
try: try:
RunTool('idf_diag', diag_args, args.project_dir, hints=not args.no_hints)() RunTool('idf_diag', diag_args, args.project_dir, hints=not args.no_hints)()
@@ -168,24 +174,30 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
'multiple': True, 'multiple': True,
'metavar': 'RECIPE', 'metavar': 'RECIPE',
'type': str, 'type': str,
'help': ('Recipe to use. This option can be specified multiple times. ' 'help': (
'Recipe to use. This option can be specified multiple times. '
'By default, all built-in recipes are used. RECIPE refers to ' 'By default, all built-in recipes are used. RECIPE refers to '
'the recipe file path or the file name stem for built-in recipes.'), 'the recipe file path or the file name stem for built-in recipes.'
),
}, },
{ {
'names': ['-t', '--tag', 'cmdl_tags'], 'names': ['-t', '--tag', 'cmdl_tags'],
'multiple': True, 'multiple': True,
'metavar': 'TAG', 'metavar': 'TAG',
'type': str, 'type': str,
'help': ('Consider only recipes containing TAG. This option can be specified ' 'help': (
'Consider only recipes containing TAG. This option can be specified '
'multiple times. By default, all recipes are used. Use -l/--list-recipes ' 'multiple times. By default, all recipes are used. Use -l/--list-recipes '
'option to see recipe TAG information.'), 'option to see recipe TAG information.'
),
}, },
{ {
'names': ['-a', '--append'], 'names': ['-a', '--append'],
'is_flag': True, 'is_flag': True,
'help': ('Use recipes specified with the -r/--recipe option in ' 'help': (
'combination with the built-in recipes.'), 'Use recipes specified with the -r/--recipe option in '
'combination with the built-in recipes.'
),
}, },
{ {
'names': ['-f', '--force'], 'names': ['-f', '--force'],
@@ -196,16 +208,18 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
'names': ['-o', '--output'], 'names': ['-o', '--output'],
'metavar': 'PATH', 'metavar': 'PATH',
'type': str, 'type': str,
'help': ('Diagnostic report directory PATH or zip file archive PATH. ' 'help': (
'Diagnostic report directory PATH or zip file archive PATH. '
'If not specified, the report-UUID is used as the report directory, ' 'If not specified, the report-UUID is used as the report directory, '
'and the report directory specified with the --zip option with a zip ' 'and the report directory specified with the --zip option with a zip '
'extension is used for the zip file archive.') 'extension is used for the zip file archive.'
),
}, },
{ {
'names': ['-p', '--purge', 'purge_file'], 'names': ['-p', '--purge', 'purge_file'],
'metavar': 'PATH', 'metavar': 'PATH',
'type': str, 'type': str,
'help': ('Use a custom purge file to remove sensitive information from the report.') 'help': ('Use a custom purge file to remove sensitive information from the report.'),
}, },
], ],
}, },