Title
j

Josh

01/14/2022, 11:01 PM
I’m running into a mypy issue with Prefect Tasks. Mypy will product an error
error: <nothing> not callable
for the task run when I try to test it out
class MyTask(Task):
    def run(self): 
        # do something
        return True

if __name__ == "__main__":
    my_task = MyTask()
    with Flow("My Flow") as flow:
        my_task()
    flow.run()
mypy will register the line where I call the task run as trying to call nothing.
my_task()
User Error: Had something else in the namespace with the same variable name so was getting a clashing issue
k

Kevin Kho

01/14/2022, 11:16 PM
I don’t know mypy well but maybe you can assign it to a variable?