From a4fb8c72f15146c95df16c25e75f03344e9814fd Mon Sep 17 00:00:00 2001 From: Benjamin Klimczak Date: Wed, 11 Jan 2023 12:32:02 +0000 Subject: MLIA-591 Create interface for target profiles New class 'TargetProfile' is used to load and verify target profiles. Change-Id: I76373a923e2e5f55c4e95860635afe9fc5627a5d --- src/mlia/target/tosa/config.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/mlia/target/tosa/config.py') diff --git a/src/mlia/target/tosa/config.py b/src/mlia/target/tosa/config.py index 22805b7..826e719 100644 --- a/src/mlia/target/tosa/config.py +++ b/src/mlia/target/tosa/config.py @@ -1,19 +1,21 @@ -# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. +# SPDX-FileCopyrightText: Copyright 2022-2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 """TOSA target configuration.""" -from mlia.target.config import IPConfiguration -from mlia.utils.filesystem import get_profile +from typing import Any +from mlia.target.config import TargetProfile -class TOSAConfiguration(IPConfiguration): # pylint: disable=too-few-public-methods + +class TOSAConfiguration(TargetProfile): """TOSA configuration.""" - def __init__(self, target_profile: str) -> None: + def __init__(self, **kwargs: Any) -> None: """Init configuration.""" - target_data = get_profile(target_profile) - target = target_data["target"] - - if target != "tosa": - raise Exception(f"Wrong target {target} for TOSA configuration") - + target = kwargs["target"] super().__init__(target) + + def verify(self) -> None: + """Check the parameters.""" + super().verify() + if self.target != "tosa": + raise ValueError(f"Wrong target {self.target} for TOSA configuration.") -- cgit v1.2.1