Exemple #1
0
    def __setattr__(self, key, value):
        # Check if key already exists
        if Port.is_port(value):
            value.name = key
            self.add_port(value)

        super(Task, self).__setattr__(key, value)
Exemple #2
0
    def add_port(self, new_port):
        if not Port.is_port(new_port):
            raise TypeError("Task ports must be of type Port")

        if new_port.direction == 'Input':
            self.__task_json['inputPortDescriptors'].append(new_port)
        elif new_port.direction == 'Output':
            self.__task_json['outputPortDescriptors'].append(new_port)