File size: 881 Bytes
9f82a2b
 
 
 
 
 
 
 
 
39105fc
9f82a2b
 
 
 
 
 
 
39105fc
9f82a2b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from typing import Any, Dict, List

import yaml


class HardwareConfig:
    def __init__(self, data: Dict[str, Any]):
        self.machine = data["machine"]
        self.description = data["description"]
        self.hardware_provider = data["hardware_provider"]
        self.hardware_type = data["hardware_type"]
        self.subsets = data["subsets"]
        self.backends = data["backends"]

    def __repr__(self):
        return (
            f"HardwareConfig(machine='{self.machine}', description='{self.description}', "
            f"hardware_provider={self.hardware_provider}, hardware_type={self.hardware_type}, subsets={self.subsets}, backends={self.backends})"
        )


def load_hardware_configs(file_path: str) -> List[HardwareConfig]:
    with open(file_path, "r") as file:
        data = yaml.safe_load(file)
    return [HardwareConfig(config) for config in data]