Exemple #1
0
    def parse(self,
              key: str,
              instruction: dict,
              symbol_table: SymbolTable,
              path: Path = None) -> SimulationInstruction:
        ParameterValidator.assert_keys(
            instruction.keys(),
            ["dataset", "simulation", "type", "export_formats"],
            "SimulationParser", key)

        signals = [
            signal.item
            for signal in symbol_table.get_by_type(SymbolType.SIGNAL)
        ]
        simulation = symbol_table.get(instruction["simulation"])
        dataset = symbol_table.get(instruction["dataset"])

        exporters = self.parse_exporters(instruction)

        process = SimulationInstruction(signals=signals,
                                        simulation=simulation,
                                        dataset=dataset,
                                        name=key,
                                        exporters=exporters)
        return process
    def __init__(self, symbol_table: SymbolTable, specification: dict):
        assert any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in [t for t in SymbolType]), \
            "DefinitionParserOutput: symbol table has not been populated by objects of any type."

        self.symbol_table = symbol_table
        self.specification = specification