Пример #1
0
    def get_input_and_output_metadata(self, type=None):

        if type == "output" or type is None:
            # get output information
            outputs = engine.getExchangeItems(self.source_id, "OUTPUT")
            if outputs is not None:
                for output in outputs:
                    self.output_metadata[output["name"]] = output
        if type == "input" or type is None:
            # get input information
            inputs = engine.getExchangeItems(self.target_id, "INPUT")
            if inputs is not None:
                for input in inputs:
                    self.input_metadata[input["name"]] = input
Пример #2
0
    def get_input_and_output_metadata(self, type=None):

        if type == 'output' or type is None:
            # get output information
            outputs = engine.getExchangeItems(self.source_id, 'OUTPUT')
            if outputs is not None:
                for output in outputs:
                    self.output_metadata[output['name']] = output
        if type == 'input' or type is None:
            # get input information
            inputs = engine.getExchangeItems(self.target_id, 'INPUT')
            if inputs is not None:
                for input in inputs:
                    self.input_metadata[input['name']] = input
Пример #3
0
    def get_exchange_item_from_engine(self, component, type):
        if not isinstance(component, dict):
            sPrint("component needs to be type dict")
            return

        if "id" not in component:
            sPrint("Component must have 'id' as key")
            return

        if not isinstance(type, str):
            sPrint("'type' and equal to INPUT or OUTPUT")
            return

        items = engine.getExchangeItems(component["id"], type)
        if items is not None:
            return ["---"] + [item["name"] for item in items]
        return ["---"]
Пример #4
0
    def get_exchange_item_from_engine(self, component, type):
        if not isinstance(component, dict):
            sPrint("component needs to be type dict")
            return

        if "id" not in component:
            sPrint("Component must have 'id' as key")
            return

        if not isinstance(type, str):
            sPrint("'type' and equal to INPUT or OUTPUT")
            return

        items = engine.getExchangeItems(component["id"], type)
        if items is not None:
            return ["---"] + [item["name"] for item in items]
        return ["---"]
Пример #5
0
 def sort_output_model(self, models):
     output_name_list = {}
     for model_id, model_name in sorted(models.items(), key=lambda x: x[1]):
         oei = engineAccessors.getExchangeItems(model_id, type='OUTPUT')
         output_name_list[model_name] = [ei['name'] for ei in oei]
     return output_name_list
Пример #6
0
 def get_input_exchange_item_by_id(self, id):
     return engineAccessors.getExchangeItems(id, 'INPUT')
Пример #7
0
 def get_exchange_items_names(self, model_id, model_type="INPUT"):
     # model_type must match INPUT or OUTPUT
     items = engineAccessors.getExchangeItems(modelid=model_id, item=model_type.upper())
     if items is not None:
         return [item['name'] for item in items]
     return [""]