Ejemplo n.º 1
0
class TaskWithCustomValue(PythonTask):
    custom_value = parameter.type(_MyCustomObjectValueType)
    list_of_customs = parameter.sub_type(_MyCustomObjectValueType)[List]

    report = output[str]

    def run(self):
        assert isinstance(self.custom_value, MyCustomObject)
        assert isinstance(self.list_of_customs[1], MyCustomObject)
        self.report = self.custom_value.custom + self.list_of_customs[1].custom
Ejemplo n.º 2
0
class TaskWithCustomValueInline(PythonTask):
    # works only after registration!
    custom_value = parameter[MyCustomObject]
    custom_value_with_default = parameter.value(MyCustomObject("1"))

    list_of_customs = parameter.sub_type(MyCustomObject)[List]
    set_of_customs = parameter.sub_type(MyCustomObject)[Set]
    dict_of_customs = parameter.sub_type(MyCustomObject)[Dict]

    report = output[str]

    def run(self):
        assert isinstance(self.custom_value, MyCustomObject)
        assert isinstance(self.custom_value_with_default, MyCustomObject)

        self.report = "_".join([
            c.custom for c in [
                self.custom_value,
                self.custom_value_with_default,
                self.list_of_customs[0],
                self.dict_of_customs["a"],
            ]
        ])
Ejemplo n.º 3
0
            class MyPTWithError(PipelineTask):
                wrong_param = parameter.sub_type(bool)[int]

                def band(self):
                    return None
Ejemplo n.º 4
0
class ListFoo(TTask):
    my_list = parameter.sub_type(int)[List]

    def run(self):
        super(ListFoo, self).run()
        ListFoo._val = self.my_list