diff options
author | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2022-07-21 14:06:03 +0100 |
---|---|---|
committer | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2022-08-19 10:23:23 +0100 |
commit | a8ee1aee3e674c78a77801d1bf2256881ab6b4b9 (patch) | |
tree | 8463b24ba0446a49b3e012477b0834c3b5415b86 /src/mlia/core/reporting.py | |
parent | 76ec769ad8f8ed53ec3ff829fdd34d53db8229fd (diff) | |
download | mlia-a8ee1aee3e674c78a77801d1bf2256881ab6b4b9.tar.gz |
MLIA-549 Refactor API module to support several target profiles
- Move target specific details out of API module
- Move common logic for workflow event handler into a
separate class
Change-Id: Ic4a22657b722af1c1fead1d478f606ac57325788
Diffstat (limited to 'src/mlia/core/reporting.py')
-rw-r--r-- | src/mlia/core/reporting.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mlia/core/reporting.py b/src/mlia/core/reporting.py index 9006602..58a41d3 100644 --- a/src/mlia/core/reporting.py +++ b/src/mlia/core/reporting.py @@ -760,3 +760,14 @@ def _apply_format_parameters( return report return wrapper + + +def resolve_output_format(output: Optional[PathOrFileLike]) -> OutputFormat: + """Resolve output format based on the output name.""" + if isinstance(output, (str, Path)): + format_from_filename = Path(output).suffix.lstrip(".") + + if format_from_filename in ["json", "csv"]: + return cast(OutputFormat, format_from_filename) + + return "plain_text" |