Maxwell Dylla
08/20/2020, 12:09 AM@flow
decorator works well for me, but the class-based API confuses my IDE. For example, my IDE thinks the class-based result should be type `Task`:
from prefect import Flow, Task, task
@task
def func_task() -> str:
return ""
class ClassTask(Task):
def run(self) -> str:
return ""
class_task = ClassTask()
with Flow("test_type_hints") as flow:
func_result: str = func_task()
class_result: str = class_task() # Expected type 'str', got 'Task' instead
flow.run()
nicholas
08/20/2020, 12:22 AMflow.run
, which would return the type str
that you're expecting from the task's run method.Maxwell Dylla
08/20/2020, 1:13 AMnicholas
08/20/2020, 4:12 AMMaxwell Dylla
08/20/2020, 3:56 PM