2024-06-28 20:46:18 发布
网友
我得到了一个类和一个子类,并希望从frameworkperfict.io继承一个decorator@task方法
代码示例:
课程
@task def test1(self): pass
子类
def test2(self): print("succeed")
但是现在方法test2不再具有decorator@task。我不能在子类中声明@task。我是否可以覆盖该方法,但保留@task
我通常推荐这样的东西
class Base: @task def test1(self): return self.test1_impl() def test1_impl(self): ... class Child: def test1_impl(self): ...
现在Child的工作不是重写修饰函数,而是继承的修饰函数所使用的未修饰函数
Child
为什么不再次导入任务
from prefect import task
我通常推荐这样的东西
现在
Child
的工作不是重写修饰函数,而是继承的修饰函数所使用的未修饰函数为什么不再次导入任务
相关问题 更多 >
编程相关推荐