perf python: Fix MetricGroup return type in perf.pyi

The metrics() function can return a dictionary where the value is either
a string or a list of strings, so the type signature in the stub file
should be Union[str, List[str]].

Fixes: 430da3cd03b4 ("perf python: Add perf.pyi stubs file")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Ian Rogers 2026-08-09 00:14:51 -07:00 committed by Namhyung Kim
parent b3d7c6c1a9
commit b9514a9a13

View File

@ -1,5 +1,5 @@
"""Type stubs for the perf Python module."""
from typing import Callable, Dict, List, Optional, Any, Iterator
from typing import Callable, Dict, List, Optional, Any, Iterator, Union
def config_get(name: str) -> Optional[str]:
"""Get a configuration value from perf config.
@ -12,7 +12,7 @@ def config_get(name: str) -> Optional[str]:
"""
...
def metrics() -> List[Dict[str, str]]:
def metrics() -> List[Dict[str, Union[str, List[str]]]]:
"""Get a list of available metrics.
Returns: